Google Maps (http://maps.google.com is probably the most complete AJAX network application. The maps he provides to users can be moved around, scaled, and executed, even with annotations. You can use maps, satellite images, or the way they mix to show where you want to see them. Google allows web developers to use Google Maps on their own sites via an API approach. To use this API, you need to register to get a free developer serial number on its homepage: http://www.google.com/apis/maps/. On the website you can also find relevant documents and many examples that teach you how to use Google Maps. This serial number allows you to use a map in a single domain or a subdirectory of this domain. The example in this chapter uses a serial number that works on the computer, which means that you need to run them on the local server via http://localhost/instead of the file system. After you get the developer serial number, you can link to JavaScript that contains all the map code in the header of the document. The bold "Your key" should be replaced with the serial number you obtained from Google-if you are trying to run the example code on a different server than the local server, you must modify the serial number in the example file. <script src= "Http://maps.google.com/maps?file=api_ &v=2&key=
your key"Type=" Text/javascript > </script> warns: This URL may change in the future, so check the home page of the API to make sure it doesn't suddenly fail to work properly. What is most likely to change is the V parameter in the URL, which represents the version of the API. The next step you want to take is to get the latitude and longitude values of the location you want to display. If you are in the United States, then you are lucky because there is a free service on the http://geocoder.us/that translates the address into latitude and longitude values. For example, if you want to show the location of California State Hollywood DreamWorks, its location at number No. 5555 on Melrose Avenue, then you can get from http://geocoder.us/demo.cgi?address=5555+Melrose+Ave%2C+ Get the data on the HOLLYWOOD%2C+CA. The result is address 5555 Melrose Ave Los Angeles CA 90038 Latitude 34.083517°n 34°5 ' 0.7 ' longitude -118.321951°w 118°19 ' 19.0 ' A simpler approach is to use http:// Www.localsearchmaps.com (description on http://emad.fano.us/blog/?p=277) and http://www.zeesource.net/maps/geocoding.do Rest application interface. The former returns code that is compatible with the Google Maps API (unfortunately, these old APIs are now obsolete, but this may have been modified by the time the book was published, which returns a series of comma-separated latitude and longitude information-both of which return global information, not just American information. When you have this information, you can add your own map to your site. As an example of a world-wide address, we use the street in north London, England, where I live. The coordinates of my street are 51.5623° latitude and –0.0934° longitude. Using this API to provide you with these information and methods, it is easy to show the map of my area.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.