Reverse Geocode Locations in Google My Maps (Custom Map Locations to Street Addesses) - google-maps-markers

I have a custom map in Google's "My Maps" with a list of locations. What is the easiest way to reverse geocode these to the street addresses? i.e. I would like to export the data as a list of locations + the associated addresses. The CSV export built in just exports the location names.

From the map page's HTML (URL looks like: https://www.google.com/maps/d/u/0/edit?mid=.....https://www.google.com/maps/d/u/0/viewer?mid=XXXX), you can first pull the var _pageData = .... JSON object (accessible on window._pageData).
From that you can pull the list of places with the associated place_id. These can then be resolved to the location info using the https://maps.googleapis.com/maps/api/place/details/json API.

Related

How to search for locations using Tags inside OpenStreetMap

Using the Nominatim APIs, am able to do a search based on a query. However, all the results returned have a Tag associated with them, like leisure=fitness_centre.
How can I, thus, use the OpenStreetMap APIs to search a given location (say London) for all the fitness_centre tags? Idea is to be able to search the map, zero in a location (say London, Oxford etc.) and then search for all places/locations with Tag [leisure=fitness_centre]
Using Google Places API, one can search using tags using something like below (specifying type=gym) -
https://maps.googleapis.com/maps/api/place/search/json?location=51.509865,-0.118092&radius=50000&sensor=true&key=&types=gym
Only issue with the Google Places API is that they are extremely pricey!!, so looking for OpenStreetMap as an alternative.
For searching specific objects in OSM, Overpass API is usually a good choice.
There is a nice frontend available called overpass turbo. Open the wizard, enter "leisure=fitness_centre in London" and it will generate an appropriate query:
[out:json][timeout:25];
{{geocodeArea:London}}->.searchArea;
(
node["leisure"="fitness_centre"](area.searchArea);
way["leisure"="fitness_centre"](area.searchArea);
relation["leisure"="fitness_centre"](area.searchArea);
);
out body;
>;
out skel qt;
Then hit run to see the results on the map: https://overpass-turbo.eu/s/1fbg
Please note that the {{geocodeArea:London}}->.searchArea; part is a feature added by the overpass turbo frontend. Overpass API won't understand this geocoding request. Instead, you have to replace it with an area query and the corresponding relation ID (in this case area(id:3600065606)->.searchArea;).
Another thing to note is that Overpass API servers shouldn't be used for heavy queries or commercial purposes. If you need this kind of service then install your own Overpass API instance or use a commercial Overpass API provider.

Google Place Autocomplete API not returning latest city name

I'm making use of google's Place Autocomplete API to get list of cities,
https://developers.google.com/places/web-service/autocomplete.
Problem is when I search "Bombay", it should return the new city name
"Mumbai". Same for "Calcutta" instead "Kolkata" and "Madras" to "Chennai".
Google Place Search api returns all the right renamed city names but unfortunately it's not for autocomplete use.
In Text search API you will get new names :
https://maps.googleapis.com/maps/api/place/autocomplete/json?key=YOUR_KEY&types=city&query=Bombay
So If you can use above API you can use.
In autocomplete add types=(cities) but it returning old names only, I think google data is not updated.
https://maps.googleapis.com/maps/api/place/autocomplete/json?key=YOUR_KEY&types=(cities)&input=Bombay
I think the fool proof solution for this is to use Google place autocomplete and get a list of predictions. Then use the first prediction's place_id as an input for Google Place details
Step 1
Step 2

How to save list as a value in set in Redis

I am trying to save a list as value in set for specific keys but could not find any way, Is it possible in redis?. I am not sure weather we can use redis save data like this . If not please correct me and help to do that.
I want to store sample data like in below format
publisher
{ NAME : Domain,
//list
Urls : {
url1,
url2,
}
}
......................
.....................
You can't store like this in Redis. Instead you can use a reference of that list inside the value and make use of it.
Here is an example:
I have a hash contains NAME and urls. where urls is a list.
hset("publisher","NAME","Domain");
hset("publisher","Urls","UrlsList");
When you get Urls from hget("publisher","Urls"). Do an lrange("UrlsList",0,-1) this will fetch you all values in that list.

Can I obtain the country name with Google Places API?

On the request for current place I receive a list of places. Every place has an address but that address is a string so I can't get only the country name.
Could someone help me on this matter?
Country is only explicitly available when using the Place Details API, not the Places API. (https://developers.google.com/maps/documentation/places/web-service/details)
You first need to look up a place_id for the specific place you're looking for. You then use your place_id to pull details from the Details API, which includes information like:
Fully formatted address, including country
Address components
Sample reviews
Phone # and website
Operating hours
If you have read the Google Places Autocomplete doc,you must know about API properties.you can use the type as '(region)' and will return you many results (plus country).And if you look inside address_components field (it's array with dynamic length),you will see,that the last item of array is what you need.Here is a great page to read a correct doc and try examples yourself.
http://www.w3docs.com/learn-javascript/places-autocomplete.html

How to get Country for Google Places API nearby search

I'm using Google Places API to get nearby places, but I've noticed that while I get the place names and addresses, the results don't include the Country.
Is there a way to get the country included in the results?
This is the call I'm using:
https://maps.googleapis.com/maps/api/place/nearbysearch/xml?location=<lat,lng>&radius=100&sensor=true&key=<api_key>
Thanks!
The Geocoding API is what you want.
Try
http://maps.googleapis.com/maps/api/geocode/json?address=Calgary,%20Alberta&sensor=false
it'll return fully formatted address info in several ways (split by administrative level, formatted as an address,etc.)
also the place Types blog in google api will help..link is here

Resources