Thank you - that snippet totally worked! But what do people do if they reach the daily 2500 request limit?
Thanks, Alex On Dec 21, 4:12 am, blob <[email protected]> wrote: > If you want to store the goecoded data first in a database (which is > more than a good idea because for already gecoded addresses you don't > have to repeat the geocoding again and again) you can use the Google > geocoding API. > > This is a short sample (in PHP) how you can use the geocoding API: > > $address = utf8_encode($address); > > // call geoencoding api with param json for output > $geoCodeURL = "http://maps.google.com/maps/api/geocode/json? > address=". > urlencode($address)."&sensor=false"; > > $result = json_decode(file_get_contents($geoCodeURL), true); > > $coords['status'] = $result["status"]; > $coords['lat'] = $result["results"][0]["geometry"]["location"] > ["lat"]; > $coords['lng'] = $result["results"][0]["geometry"]["location"] > ["lng"]; > > // next it's up to you to store the coords in your database > > If you are using PHP you can also use the simpleGMapAPI > (http://www.rvs.uni-bielefeld.de/~heiko/projects/simpleGMapAPI/) which > provides wrappers in PHP for the geocoding APIs of Google Maps and > OpenStreetMap. > > On 21 Dez., 08:47, Alex Genadinik <[email protected]> wrote: > > > Hi Larry, > > > Is there a simple way to geocode the data when I first store it in the > > database? Is there a code snippet you could provide? > > > I have been looking for examples, but they mostly involve relatively > > complex AJAX an JSON code. I'm thinking there must be something east > > like > > map.getLongitude() and map.getLatitude() and then I could just store > > those values in the database. Is there something very similar that I > > could do? > > > Thanks, > > Alex > > > On Dec 20, 6:58 pm, "[email protected]" <[email protected]> > > wrote: > > > > On Dec 20, 9:45 pm, Alex Genadinik <[email protected]> wrote: > > > > > Hi, > > > > > I am a newbie who has read through newbie examples but is still > > > > confused :) > > > > > I need to let the user choose some options, fetch the data from the > > > > database, then perform geolocation on that data and place markers. > > > > I would suggest geocoding the data when it is stored in the database > > > rather than after it is fetched (allows you to fix problem points, add > > > coordinates for places the geocoder doesn't know, etc). > > > > > Any tips on how to do that? Some code examples would be greatly > > > > appreciated! I am a little inexperienced with JSON and AJAX which is > > > > adding to my difficulties. > > > > Have you seen these > > > articles?http://code.google.com/apis/maps/documentation/javascript/articles.html > > > > -- Larry > > > > > Thank you! > > > > - Alex > > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
