I'm able to import a KML/KMZ layer hosted on my local drive just fine into Google Maps. No issues. However, when I attempt to host the same layer on Google Drive and import from Google Drive, I get the following error:
The file contains invalid or unsupported data, or the file is too large to parse.
I also notice that the icon of the KML file on drive is not the standard Globe icon (it is a globe when placed on my local drive) - but rather, it looks like:
</>
What is happening here? I need to import from Google Drive so I'd like to figure this out. This also begs the question: if I do end up just adding the data from my local drive, what happens if I remove the KML from my drive? Is the data in Google Maps dependent upon it, or once the KML is added to Google Maps, does that KML now exist independently in the cloud?
Related
I have a website that users can download GPX files from and the manually upload them into Google Earth to view their journey. Is there a way to connect the website to Google Earth to automatically show them their journey rather than them having to download and reupload?
Google Earth natively understands KML format but can also convert other formats (E.g. GPX, Shapefiles, CSV, etc.) into KML to view locally.
If the website URLs provided KML then you could create a KML file with a Networklink which would automatically load the latest content when Google Earth was started and display the KML features.
But being the source are GPX files, Google Earth first needs to import and convert those files into KML to display. GPX is just XML and relatively easy to convert into KML so you may consider programatic scripting or coding options to fetch the GPX files then convert them into KML.
I've been pulling KML files from the Mass GIS service via their export feature:
http://maps.massgis.state.ma.us/map_ol/oliver.php
For example, a KML output of Population Density per Square Mile looks like this when exported:
http://evrkusd.fatcow.com/populationpersquaremile.kml
I try to add it to my Google Map and nothing shows up, although this code works fine with other kml files from other sources.
var NewLayer = new google.maps.KmlLayer('http://evrkusd.fatcow.com/populationpersquaremile.kml');
NewLayer.setMap(map);
I'm getting the idea that some of the kml tags are outdated or are not accepted by Google Maps API.
Is anyone able to get this file to work for them? Any ideas how I can (preferably easily) update this file to work with Google Maps? I'm going to be using multiple KML files like this, so I'm hoping I can do a fairly quick fix.
Your KML file is still too big:
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/populationpersquaremile.kml
If you click on the "load KmlLayer" button, it will show you the status return by attempting to load that file in KmlLayer:
Kml Status:DOCUMENT_TOO_LARGE
Your "partial" KML files are not valid xml, if I make the one you posted valid, it works with geoxml3, but the Google Maps API v3 KmlLayer still says it is too big.
See the documentation, the maximum fetched size of a raw KML file is 3M, your file is 7M+.
Fusion Tables can handle much larger KML than client-side maps, up 100MB total (though some limits apply to features). So that might be a solution.
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.
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 have copied all of the files for the Google example http://gmaps-samples-v3.googlecode.com/svn/trunk/toomanymarkers/toomanymarkers.html to my PC, but the KML layer does not appear when I tick the checkbox.
The files I copied are:
functions.js
markers.js
markers.kml
toomanymarkers.html
I have also copied these to http://www.performit.co.uk/misc/maps/toomanymarkers/toomanymarkers.html and it doesn't work there either.
Am I missing something? Do I need to have an environment set up for the files to load?
The KML file must be publicly accessible via the web, so this will not work if you are developing locally. Google accesses and processes the file, returning that data as location, zoom level, markers, polylines, polygons, etc.
What is the actual URL to your KML file? Copy that, and past it into the Search Maps box of GoogleMaps. If it's valid KML, GM will process it and display your KML data.
It appears to be a web server configuration issue. When I try to access http://www.performit.co.uk/misc/maps/toomanymarkers/markers.kml, I get a 500 server error. It appears to me that functions.js tries to access that URL. So, I'd look into that. By comparison, http://gmaps-samples-v3.googlecode.com/svn/trunk/toomanymarkers/toomanymarkers.html happily serves up the KML file.