On May 16, 11:53 am, hrose1234 <[email protected]> wrote: > Is thee an api that I could just pass in the street address and get > back the lat and lng like this: > > var geocoder = new GClientGeocoder(); > var latlng = geocoder.getLatLng(address); > var lat = latlng.lat(); > var lng = latlng.lng(); >
geocoding is asyncronous. You need to do the processing of the latitude and longitude in the callback function: http://econym.org.uk/gmap/async.htm > Than I could do some math to the lat and lng variables and put then in > the GLatLng call like this: > > var nwLat = lat - offset; > var nwLng = lng + offset; > > map.addOverlay(new GPolygon([new GLatLng > (nwLat, nwLng), new GLatLng(42.353486,-71.136582), new GLatLng > (42.350259,-71.136239), new GLatLng(42.350243,-71.140273),new > GLatLng > (42.353383,-71.140434)], "#F62817", 5, 0.7, "#F62817", 1 )); > > I'm also new to JavaScript, so please let me know what will work and > what will not. > > It looks like GClientGeocoder() doesn't have such a method, only a > call back function that I don't understand how I get the lat and lng > numbers I need to do the math with. I think it was GMarker had the: > > var lat = latlng.lat(); > var lng = latlng.lng(); > > That I need, but still don't understand, this should be easier. :-( Look at the examples of using the GClientGeocoder in the documentation and in Mike Williams' tutorial: http://econym.org.uk/gmap/ -- Larry > > Thanks, > Rose > > On May 15, 2:05 pm, "[email protected]" <[email protected]> > wrote: > > > On May 15, 9:55 am, hrose1234 <[email protected]> wrote: > > > > And, what map api do I need to get the lat and lng of the street > > > address? > > > That is called geocoding and is supported by the Google Maps > > API.http://code.google.com/apis/maps/documentation/services.html#Geocoding > > > > On May 15, 1:45 am, "[email protected]" <[email protected]> > > > wrote: > > > > > On May 14, 8:23 pm, hrose1234 <[email protected]> wrote: > > > > > > Hi, > > > > > > I'm trying to make a perfect square around a marker, say a block > > > > > wide. > > > > > > I first do this: > > > > > > marker.msg=address; > > > > > map.addOverlay(marker); > > > > > > Now, I thought if I could get the lat lng of the marker, I would know > > > > > the center of my square. > > > > > > Then, I would need an api that I could pass the marker's lat lng and > > > > > it would return a lat and lng say, North West one block. > > > > > Define "block"? If is is a street intersection, you are out of luck. > > > > If it is a square of a predetermined size, then you don't need an API, > > > > you need math. > > > > > > If there is > > > > > such an api out there, I could use this api to get my four points I > > > > > need into GPolygon to create the square around the mark, that is say, > > > > > a block wide. > > > > > > Would this be the best way to make a perfect square around a mark that > > > > > is always one block wide? > > > > > > Code examples would help me here. :-) > > > > > > Thanks, > > > > > -Rose- Hide quoted text - > > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
