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.
Answer from xomena on Stack OverflowSending location data to Google My Maps for custom map creation/update
Using the Google Maps API to get around the 10 layer limit in My Maps
dont use 1 layer for each line. use multiple routes in one layer
More on reddit.comAccess restricted Google My Maps and access it through Javascript API
How can I automatically convert maps.app.goo.gl links into coordinates or Plus Codes with high accuracy?
Videos
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.
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
In Seattle, bus routes that operate north of downtown often continue from downtown as a different route; this is called "interlining" and increases operational efficiency, not to mention lowers operating costs substantially. An example of this is route 33, which connects the Magnolia neighborhood with downtown, then continues as a route 124 to the suburb of Tukwila.
I want to map out the bus routes in Seattle using the "draw a line" tool in My Maps, and have interlined routes correspond to one "layer". However, there are more than ten interline pairs; here's a sample:
| Route A into downtown | Route B out of Downtown |
|---|---|
| 1-Kinnear | 14-Mount Baker |
| 2-West Queen Anne | 13-Seattle Pacific Univ. (U-shaped route) |
| 3/4-North Queen Anne | 3-Madrona |
| 4- Judkins | |
| 5-Greenwood | 21-35th Ave SW |
| 26X-East Green Lake/Northgate Express | 131-South Park/Burien |
And so on. I won't be able to use the standard Google Maps UI for this purpose because it limits you to 10 layers, so I'll have to use the API. But that's the problem, I have no damn idea how to even start doing something like this. All I know is I have to use something called "custom controls" to display all the different routes as though they were "layers".
dont use 1 layer for each line. use multiple routes in one layer
As the other commenter says, if you're drawing lines by hand, you can put as many as you want in a single layer.
If you're using the "directions" feature, it might seem like you can only have one route per layer. But a dirty trick is to export the map (or layer) to KML and then reimport it. The route will have been flattened to a simple line and two points, which you can drag into any other layer. In this way, you can fit any number of routes into a single layer also.
I have a CSV file with around 150 maps. app.goo.gl short links like /HuptUo4n5uJnyEEH6 (this is just a random place in Mexico city) and I need to extract precise latitude/longitude coordinates or Plus Codes from each one.
I'm willing to use the Google Maps API if necessary, but I couldn't find a documented method that handles short links like these directly.
Is there any reliable way to:
Expand the short link to get the full destination?
Extract accurate coordinates or the corresponding Plus Code?
Automate this for many links?
I want to integrate this into a script, ideally with minimal rate-limiting or accuracy issues. Any insights or recommended tools would be much appreciated!
Thanks in advance
First you need to register with google and get a MAPS api key:
http://code.google.com/apis/maps/signup.html
Then you need to embed some javascript in your pages/templates:
<script src="http://maps.google.com/maps?file=api&v=2&key=__your_key_here__" type="text/javascript"></script>
Another bit to draw the actual map:
<script type="text/javascript">
//<![CDATA[
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(51.16349933440274, 4.371164292063712 ), 6);
var point = new GLatLng(51.16349933440274, 4.371164292063712);
var marker = createMarker(point,'<div style="width:240px"> \
Place: <b>ANTWERPEN </b><br> \
</div>')
map.addOverlay(marker);
}
}
//]]>
</script>
This tutorial was useful:
http://econym.org.uk/gmap
The maps API documentation is very good:
http://code.google.com/apis/maps/documentation/javascript/
Note that version 3 of the maps api has recently been released (it has lots of enhancements for mobile browsers, so you might want to look into that).
This might be a candidate to be moved to stackoverflow.com
Google maps provide a very good API so you can show google maps on your website. Most webmasters are using google maps to help customers find the location of their business ( usually on contact pages ). Others are building full applications based on google maps. It is very easy to implement google maps on any website. Read Here