Getting the placeid, latitude and longitude for the Google Maps Javascript API


Need the place id or anything from the Places Search results for whatever you’re doing with the Google Maps API?

I got mine using the Google Places API Text Search Service:  https://developers.google.com/places/documentation/search#TextSearchRequests

If you put in your API key and an address in the following url, you’ll get what you need for the Google Maps Javascript API or wherever else. This includes placeid (in the results as place_id), latitude and longitude. You can use any text query in place of the postcode I used, just replace the spaces with + or %20 (either will encode the space for use in the url).

https://maps.googleapis.com/maps/api/place/textsearch/json?query=EC2M+7QH&key=[YOUR KEY]

,

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting this comment, you are agreeing to the use of Akismet which helps reduce spam. You can view Akismet’s privacy policy here. Your email, website and name are also stored on this site.