There is a map created in the new Google maps engine editor. Now the map needs to be exported as KML using Curl. Previous version of the maps editor (now called "MyPlaces" or "My Maps classical version") allows export the map by ID using this template for URL:
https://maps.google.com/maps/ms?oe=UTF8&hl=ru&msa=0&msid=${ID}&output=kml
New map ID neither looks like the old one (zv44oKISEgzs.kzcf044WEB9o vs 107197571518206937258.000453b7c5de92024cf27 respectively), nor it does fit the export API. Google responds with 200 OK but with empty response body.
Is there any similar API call in the new Maps Engine to get the map exported as KML with just a line of shell?
Found, thanks to all :)
First, make the map public in the Google Map Engine web application:
Click green "Share" button at the right top corner of the map;
Click "Change" access type for anyone;
Select "Anyone with the link" and "Can view" below (shown here);
Click "Save".
Then you can easily download this map as KML using this URL template:
https://mapsengine.google.com/map/kml?mid=${ID}
UPDATE: Google started sending the KML file as KMZ. Don't panic, KMZ is just a zip archive of single KML file. To fix the algorithm just add funzip tool (apt-get install unzip) in the end of shell pipe like this:
curl -s 'https://mapsengine.google.com/map/kml?mid=${ID}' | funzip
Or use an unzip library native to your language. Keep having fun with Google API updates!
Related
I have a number of maps in the original Google Maps "My Maps" which I have been maintaining for some time now. I noticed that Google now has Google Maps Engine which appears to be a bit more powerful and would allow me to combine all my maps into a single map with multiple layers.
However, I would rather not remake all of my maps in this new system. I attempted to export/import the data from My Maps to the Engine using KML, but Engine will not accept KML for import. Likewise, My Maps does not appear to export to CSV or XLSX, the formats which Engine will accept.
Is there some method to export maps from "My Maps" and import them into Engine?
Actually it seems like the google maps engine does indeed give you option of importing the maps you saved in your 'My Maps' as layers on to your map. Have a look at the screencap below:
It has the option of uploading your csv or xlsx files, but there's also the option right under to add the maps you saved in "My Maps". I assume you'll need to be logged into your Google account with the saved maps to access this though.
I have geographical data which is represented by a set of points (latitudes and longitudes which form lines), the data is in json. I want to create a Google Map on my website with that data, but the map should also be editable by the user, so he can move the lines, add markers etc.
I could create it using the Google Maps API - with it I can draw polylines, add markers but everything has to be done by my javascript which adds a lot of work.
Google Maps offers a regular user a really nice map editor. To create a map with it the user has to click through the interface or import a KML file.
What I was thinking about, was mixing methods 1. and 2. like this:
a) Export my data to a KML file
b) Import the KML file to a users Google Maps account
c) The user can edit the map with the awesome Google Maps editor
d) Embed the map back on my website with embed code
The problem is with point b) - is it possible to import a KML file to Google Maps using some request/api call?
if you mean on android, yes you can call googlemaps app as an intent from your app and supply a kml file for it to show.
String kmlWebAddress = "http://www.afischer-online.de/sos/AFTrack/tracks/e1/01.24.Soltau2Wietzendorf.kml";
String uri = String.format(Locale.ENGLISH, "geo:0,0?q=%s",kmlWebAddress);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
if you mean online, then you can do so by calling googlemaps and appending "?q=http://www.yourdomain.com/yourfile.kml".
like this:
www.googlemaps.com?q=http://www.afischer-online.de/sos/AFTrack/tracks/e1/01.24.Soltau2Wietzendorf.kml
The Google maps script I have seems to load the example KML from Chicago files fine, but when I add my own, it fails. The KML standard is 2.2 - why doesn't Google Maps manage to read it (Google Earth seems to work fine)? When I tried to validate the file it said there were some errors - is there any way around it given that this is an output I get from an application?
geoxml3, KmlLayer and Google Maps load your kml for me. My server doesn't support KML with the .kml extension, just as XML with the .xml extension because it isn't configured for the KML/KMZ MIME types, you might have the same problem on your server.
See this issue on the Google Maps API v3 issue tracker regarding the "spikes" on the line.
Another option would be to to see what KmlLayer.getStatus() returns (Kml Status:DOCUMENT_NOT_FOUND). The cta.kml example returns Kml Status:OK.
I created a map with a few markers and saved it at http://maps.google.com/.
Is there a way to edit the map with an API, like inserting and deleting markers from it?
Or, is there a way to add markers to the default preview at http://maps.google.com/ without saving it? (Possibly through adding parameters to the URL).
The problem raises due to contract between Google Maps and Israel's map provider, which doesn't allow Google to show Israel's streets through an API, and only through the interactive map at http://maps.google.com/.
Thanks ahead!
if you are using Google Maps API, you can save markers in an database, so, you can inser, delete, update markers. When you load you web app where you are using the API you have to create an XML file with coordenates and info, then use a javascript to read XML file
Where would I need to host an xml file in order to use it in Google maps for GEORss ??
From google api docs...
var georssLayer = new google.maps.KmlLayer('http://api.flickr.com/services/feeds/geo/?g=322338#N20&lang=en-us&format=feed-georss');
georssLayer.setMap(map);
this seems to do a great job of creating the info popouts and everything...
It would seem i cannot have one locally...
So i guess i need an aspx or ashx to push the xml...but does it have to be web accessible?
Thx
Yes, it needs to be web accessible because Google converts the GeoRSS to KML on the server side:
"The Google Maps API supports the KML and GeoRSS data formats for displaying geographic information. These data formats are displayed on a map using a KmlLayer object, whose constructor takes the URL of a publicly accessible KML or GeoRSS file.
The Maps API converts the provided geographic XML data into a KML representation which is displayed on the map using a V3 tile overlay."
http://code.google.com/apis/maps/documentation/javascript/overlays.html#KMLLayers
If you are hosting a static XML file, you might use Amazon Web Service's Simple Storage Service: http://aws.amazon.com/s3/