I've created KML files of some world regions for display using the Google Maps API. This has been working fine, but one region has recently started displaying as if the data's corrupt. You can see what I mean here:
https://drive.google.com/file/d/0B9u3tNbtEyFRMTdwQTdEa0U5S2s/view?pli=1
If I load the same KML in Google My Maps it still displays correctly:
https://www.google.com/maps/d/viewer?mid=z8mYjxPmAgBQ.kGn7mza0JOSU
It used to display fine, but now even if I roll back to previous versions of the file it displays in this weird way.
The KML regions are created using QGIS's Vector > Geoprocessing Tools > Dissolve tool to merge countries (to shp files), which I then save off as KML. Data is from Natural Earth's ne_50m_admin_0_countries data set.
Does anyone know what might be going wrong?
I would say that the Google Maps KML rendering engine has some issues. It works when I use the geoxml3 third party parser to render it, but not when I use the Google Maps Javascript API v3 KmlLayer to render it.
rendered with geoxml3
Note that the performance with third party parsers will depend on the complexity of the KML. Tile base rendering like used in KmlLayer will almost always perform better.
issue #8003 in the Google Maps Javascript API ve issue tracker
I thought I was going crazy. This was working for years until some days ago.
I agree it seems to be where polygons cross the "international date line" or anti-meridian. I see straight lines horizontally across the map.
Furthermore I swapped out my KML file for another from a different source, SAME problem. Thanks for restoring my sanity, I wasted a stressful day trying to fix this, I think it is a Google problem. ps. they work fine in Google Earth.
Related
I have a site that contains kml. The kml is shown as a layer in Google Maps. The maps are on the same site. Until recently (may 12th), this worked fine, but now it stopped working. The kml itself is OK, it can be used in Google Earth. When I copy the kml to another site I can load it in Google Maps without any problem.
Is it possible that my site is on a "blacklist" for some reason? Traffic is low. I did not use an API key. I do now but that did not solve the problem.
You can see the difference here:
1 - with kml from my site
2 - with kml placed elsewhere
The first one fails, the second one works. The kml placed elsewhere is an exact copy of the kml from my site. The kml from my site is served with media-type application/vnd.google-earth.kml+xml. It is dynamically generated.
In my case i got FETCH_ERROR on kml status-
Because my site allow only tls 1.2 secure connection.
When i put the files on another server- it's work.
Update 1-
It happend again after sometime, this time use the same domain helped.
from the Google Maps documentation
From February 2015, maps created in the classic Google Maps — https://maps.google.com/ — will no longer load KML/KMZ files from external websites. However, we know that KML files are a really useful way to work with geographic data, so we’ve added KML to Google My Maps, and continue to support this format with other Google Maps APIs. We hope that one of these options will meet your needs.
Both are valid, the one that doesn't works returns a KmlStatus of FETCH_ERROR. As a guess, I would say that the dynamic generation is taking too long. But there might be some security on your server that is preventing Google's server from fetching it.
from the documentation
FETCH_ERROR The document could not be fetched.
from your site
doesn't work with Google Map KmlLayer
Returns KmlStatus: FETCH_ERROR
Works through a proxy with the third party parser geoxml3
placed elsewhere
works with Google Maps KmlLayer
The problem automagically solved itself by waiting a few days. We can only guess what caused it, maybe a temporary glitch on our server which caused Google to stay away for a while and/or sploil it's cache. Anyhow, thanks for the reactions, at least I learned something about testing my kml.
Im working on a project to create a google map of an internal floorplan of my company's buildings. I dont want to use google's new indoor maps features as we dont want the floorplans available to the public. I was wanting to create an entirely custom map and just use the google maps engine and strip away the traditional world map tileset. Is this possible and how would I go about do it? Currently our floorplans are in an image file so a way to import those easily would be ideal.
I faced this problem creating an app last summer. It does not look like Google Maps (at least at that time) allowed for custom map tiles. I ended up implementing my own Map function, however I used XML files to create colored maps. The functionality would be the same if you wanted to use images, however.
The only drawback is that the features do not have such things that are built in with Google Maps, like dropped pins, etc. due to the fact that it is a custom built module. The repo is on GitHub here: https://github.com/krmannix/SmartMart
The Android Activity that holds the map is located within SmartMart/SmartMart/src/com/example/searchcell3/MapListActivity.java
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.
Is it possible to use my own map instead of google maps for my app. How can I do that...Where should I look?
I think you need Open Street Maps (OSM). I have a little GPS app (Maverick Pro) on my Droid, and it can use 3 types of maps: google, bing, and "OSM". The latter seems to be what you need:
http://wiki.openstreetmap.org/wiki/Main_Page
You would need a few things:
A source for data about your geography, in the US see the TIGER Line data published by the Census Bureau.
Software to render the geo data into maps that are visually meaningful, for example Mapnik. Use something like OpenLayers to generate the
movability and nice user features people expect.
Software to deliver the rendered maps efficiently to your users, ie TileCache.
There is a nice summary of this FOSS approach here: http://m.alistapart.com/articles/takecontrolofyourmaps
You may want to check out MapTiler, an open source map tiling tool for Google Maps (and other mapping systems) which runs on Windows and Mac OS X.
MapTiler will automate the tiling process for you through a simple GUI wizard, and in addition, once the tiling process is finished, it will also generate a simple HTML viewer where you can see the results immediately.
Custom Map Tile Overlays are quite an advanced topic in the Google Maps API (even the documentation will warn you in red about this). However, I am sure you will be able to use and understand the HTML viewer of MapTiler.
PostGIS, Geoserver, GeoWebCache, OpenLayers, + GeoEXT gets you all the software you need.
Data is up to you and some of the examples above are good ideas.
this question is kind-of programming related but not exactly - see how we go...
I am trying to view a trip i have made using a gps tracking device onto google maps as one continuous line, however, when i upload the KML file onto google maps it is arbitrarily broken into about 7 different segments.
The trip was made in one go and when shown in google earth it is shown as one continuous line.
I have inspected the KML file and all coordinates are contained within the same single linestring element.
Does anyone know why this is occuring?
Regards
Grant.
It looks like other people have experienced the same problem that you're having, but I was unable to find a solution. It seems that this is just a bug in the Google Maps KML parser.
If you don't mind creating your own map with the Google Maps API, you should be able to parse the file with no problem. There are also some sites like this one which will create a map from your KML file.