On Dec 13, 5:42 am, mark watanabe <yaksu...@gmail.com> wrote: > I have a form with google maps embedded into it where the user drags > the marker to create a point in another application. Everything is > working except I need to reverse geocode the lat and long to pull > country state and city. I know you can make calls to something like > this: > > http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73... > > but I have no idea how to make the call or integrate it into my code...
Use the client-side geocoder: http://code.google.com/apis/maps/documentation/javascript/v2/services.html#Geocoding -- Larry > > Code in my form to create the map: > > <p class="cf_text">Latitude: <input class="required" type="text" > name="latitude" id="latitude" value="38.41055825094609" /> > Longitude: <input class="required" type="text" name="longitude" > id="longitude" value="-96.416015625"/> > <br /><br /> > <div id="map" style="width: 670px; height: 430px"></div><?php > if ( !$mainframe->isSite() ) {return;} > $doc =& JFactory::getDocument(); > $doc->addScript('http://maps.google.com/maps?file=api&v=2&key=XXXXXXXXXXXXXXXXXXXXXXXX... > ?> > > The Javascript in my form: > > window.addEvent('domready', function() { > if (GBrowserIsCompatible()) > { > // create map and add controls > var map = new GMap2(document.getElementById("map")); > map.setMapType(G_HYBRID_MAP); > map.addControl(new GLargeMapControl()); > map.addControl(new GMapTypeControl()); > > // set centre point of map > var centrePoint = new GLatLng('38.41055825094609', '-96.416015625'); > map.setCenter(centrePoint, 14); map.setZoom(4); > > // add a draggable marker > var marker = new GMarker(centrePoint, {draggable: true}); > map.addOverlay(marker); > > // add a drag listener to the map > GEvent.addListener(marker, "dragend", function() { > var point = marker.getPoint(); > map.panTo(point); > document.getElementById("latitude").value = point.lat(); > document.getElementById("longitude").value = point.lng();}); > } > }); > > Any help would be greatly appreciated! -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" group. To post to this group, send email to google-maps-...@googlegroups.com. To unsubscribe from this group, send email to google-maps-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.