Reputation: 4547
I have a ton of saved places that appear on my Google Maps - but there is no way to manage, filter or search them. Is there a way to access these locations by API?
I scanned the maps api and can't find any reference. Is there another Google API that makes this available?
Upvotes: 32
Views: 15113
Reputation: 21
When accessing the Google maps list through https://www.google.com/maps and the "Saved" menu entry to the left, a request to www.google.com/maps/preview/entitylist/getlist
returns a json-like data structure that contains the name, comment and coordinates of the entries in the list.
The first 4 characters of the returned value are not part of the json data structure. In the remaining object, the list of places is found in a nested list in cleaned_data[[1]][[9]]
(R notation).
The elements of this list can be parsed with a an R function like this:
# Function to convert a single entry to a GPX waypoint
to_gpx <- function(x) {
# Extract name, latitude, longitude, and comment from the list
name <- x[[3]]
lat <- x[[2]][[6]][3]
lon <- x[[2]][[6]][4]
comment <- x[[4]] # Extract the comment
# Create the GPX waypoint string including the comment as description
gpx_string <- paste0(
'<wpt lat="', lat, '" lon="', lon, '">',
'<name>', name, '</name>',
'<desc>', comment, '</desc>',
'</wpt>'
)
return(gpx_string)
}
To not having to deal with credentials and sessions and stuff, I made a firefox plugin that parses any replies from that url and converts them to gpx. The source code can be found here: https://github.com/tux2000/Google-Maps-Lists-GPX-Exporter-Firefox and the plugin can be installed from here: https://addons.mozilla.org/en-US/firefox/addon/google-maps-lists-gpx-exporter/
Upvotes: 1
Reputation: 129
2022: I created a gist for parsing saved places from a shared list via python. It is really unstable because its a quick&dirty solution but maybe it will help someone: https://gist.github.com/ByteSizedMarius/8c9df821ebb69b07f2d82de01e68387d
Edit: The above answer did not yet take pagination into consideration. Please see my answer here.
Upvotes: 6
Reputation: 1407
There do have a REST API can retrieve the saved places.
http://www.google.com/bookmarks/?output=xml
Visit this link to get more information. https://www.google.com/bookmarks/
There are also api like:
https://www.google.com/bookmarks/find?q=conf&output=xml&num=10000 https://www.google.com/bookmarks/lookup?
But seems like they have been deprecated and most of document are not available anymore. Use them as you own risk.
Upvotes: 10
Reputation: 2554
Currently the list of saved places in My Maps is not available via an API. There is a feature request tracking this you can use to follow along @ https://code.google.com/p/gmaps-api-issues/issues/detail?id=2953.
Upvotes: 8