javascript - Google Maps API Reverse Lookup Address Details Accuracy -
I am using Google Maps API for an address reverse lookup, especially country, city and zip code. . The problem I have with GOOcoder is that when you input a particular latitude LNG, you get a series of results based on the accuracy of the details of the details. For example, if you click on the road, you can tell the accuracy of 8 and The address looks like this; "street, city, country code" or "street, city zip code, country code" . And if you click on another place, you can get the accuracy of address 5; City zip code, country code
All I am looking for is city, zip code and country. Is there any way to force Google Maps to ascertain the accuracy of 5 days or to force different parts of the city, zip codes and breakdown elements in the country?
I'm using this code to get information:
& lt; Html xmlns = "http://www.w3.org/1999/xhtml" xmlns: v = "vase: schema-microsoft-com: vml" & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; Title & gt; Google Maps JavaScript API Example: Reverse GeoCoder & lt; / Title & gt; & Lt; Script src = "http://maps.google.com/maps?file=api&v=2&key=ABQ1AAAMkjr3Dq_JK6GSFYDFzaHTBRoJ0TBOI_XK4bTNi9dL2l04KlxphRNL_k0peOib9IHF6T2KwlVmOb6uQ" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Var map; Var Geododer; Know the address; Function initialize () {var zoom = 10; Map = new GMap2 (document.getElementById ("map_canvas")); Map.setCenter (new GLatLng (40.730885, -73.997383), zoom); Map.setUIToDefault (); GEvent.addListener (map, "click", getAddress); GeoCoder = New GCLient Geocoder (); } Function getAddress (overlay, landing) {if (latlng! = Null) {address = latlng; Geocoder.getLocations (latlng, showAddress); }} Show showres (feedback) {map.clearOverlays (); If (! Response; response.Status.code! = 200) {Warning ("Status code:" + response.Status.code); } Else {place = response.Placemark [0]; Point = new GLatLng (place.Point.coordinates [1], place.Point.coordinates [0]); Marker = new GM marker (point); Map.addOverlay (marker); Var Message = '& lt; B & gt; Original latitude: & lt; / B & gt; + Response.name + '& lt; Br / & gt; + '& Lt; B & gt; Latlng: & lt; / B & gt; + Location.point Chordinate [1] + "," + place.point. Chordinate [0] + '& lt; Br> + '& Lt; B & gt; Status Code: & lt; / B & gt; + Response.Status.code + '& lt; Br> + '& Lt; B & gt; Status request: & lt; / B & gt; + Response.Status.request + '& lt; Br> + '& Lt; B & gt; Address: & lt; / B & gt; + Place.address + '& lt; Br> + '& Lt; B & gt; Accuracy: & lt; / B & gt; + Place Find Details Contingency + '& lt; Br> + '& Lt; B & gt; Country code: & lt; / B & gt; '+ Place. Enter the address. Country. Country code; Marker.openInfoWindowHtml (message); }} & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body onload = "initialize ()" & gt; & Lt; Div id = "map_canvas" style = "width: 800px; height: 600px" & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;
Any help would be greatly appreciated. My last idea is to parse the address string, but it looks like an overlap. There should be a cleaner way.
I am currently looking at the getLocations () method, maybe I can see the field that parse the JSON result.
Thanax.
You have to handle different accuracy levels in your app ... the API can not do everything for you is ;). I believe it would be good if you can direct the Geocoder on the exact level you want, it is not present at this point. Google may implement this in the future, but by then, you have to parse the results in your app. Various accuracy values are broken in this post:
Comments
Post a Comment