Reputation: 2387
Is there any way to add Layers, Points, Directions or any data to a map in the Google My Maps, using API?
I have searched in Google but didn't find a solution to do this.
Upvotes: 52
Views: 27131
Reputation: 1574
This is not a fantastic solution — and it does not use the API — but it might fit your needs. Instead of using the API you could write a browser console script that adds each new item. You could probably even run this through a headless browser and remove any manual interaction altogether.
eg.
fetch('https://example.com/newLocations')
.then((response) => response.json())
.then((newLocations) => {
newLocations.forEach(location => {
document.querySelector("#mapsprosearch-field").value = location.name + ", " + location.city;
document.querySelector("#mapsprosearch-button > div").click();
document.querySelector("#addtomap-button").click();
// etc.
});
});
—
UPDATE
Re-opened as of Feb 2021 — API support for this has been assigned. So hopefully we get support soon! https://issuetracker.google.com/issues/35820262
Upvotes: 3
Reputation: 32148
Currently there is no any API to access MyMaps programmatically.
I can see a feature request for this in the public issue tracker:
https://issuetracker.google.com/issues/35820262
It looks like Google is evaluating the feasibility to implement the API, however, no timeline provided at the moment.
Please star this feature request to express your interest and receive further updates.
UPDATE
As of April 2018 it looks like Google decided do not implement the API for Google MyMaps and marked the aforementioned feature request as Infeasible.
Upvotes: 49