Google Map (Http://maps.google.comProbably the most complete Ajax network application. He provides users with maps that can be moved around, scaled, run passes, and even annotations. You can display the location you want to see by map, satellite image, or their combination .) Google Allows network developers to use Google Maps on their own sites through APIS. To use this API, You need:Http://www.google.com/apis/maps/To obtain a free developer serial number. On the website, you can also find related 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 name or a subdirectory of this domain name. The example in this chapter uses a serial number that works on the local server.Http: // localhost/Instead of running them in a file system. After obtaining the developer serial number, you can link to include all the maps in the document header.Code. The bold "your key" should be replaced with the serial number obtained from Google -- if you try to run the code in this example on a different server rather than a local server, then you must modify the serial number in this example file. <SCRIPT src = "http://maps.google.com/maps? File = api _ & Amp; V = 2 & amp; Key =
Your key"Type =" text/JavaScript "> </SCRIPT>
■ Warning: This URL may change in the future, so check the homepage of this API to ensure that it will not suddenly work normally. The most likely change is the V parameter in the URL, which indicates the API version. The next step is to obtain the latitude and longitude values of the position you want to display. If you are in the United States, you are lucky because Http://geocoder.us/ There is a free service on which the address can be converted to the latitude and longitude values. For example, if you want to display the location of Hollywood DreamWorks in California Melrose 5555 Street, you can Http://geocoder.us/demo.cgi? Address = 5555 + Melrose + Ave % 2C + Hollywood % 2C + Ca Upper Obtain the data. The result is
Address5555 Melrose avelos Angeles ca 90038latitude34. 083517 ° N 34 ° 5 '0.7 "longpolling-118.321951 ° W 118 ° 19' 19.0"
The simpler way is to use the http://www.localsearchmaps.com (instructions in the http://emad.fano.us/blog? P = 277) and http://www.zeesource.net/maps/geocoding.doon Rest applicationsProgramInterface. The former returns code compatible with Google map APIs (unfortunately these old APIs are outdated, but this may have been modified by the time this book was published ), the latter returns a series of comma-separated latitude and longitude information-both return global information, not just American information. With this information, you can add your own map to your website. As an example of a worldwide address, we use the street where I am located in North London, England. The coordinates of my street are 51.5623 ° latitude and-0.0934 ° longitude. Using this API to provide you with this information and method, it is very easy to display the map of my region.