google maps multiple line segments - google-maps

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.

Related

Google Maps mangling KML

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.

Google Maps will not load KML layer from my site

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.

How to create a floormap using google maps api

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

KML file from Massachusetts GIS - display in Google Maps API

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.

Can the onStop event in a KML network link be used with Google Maps v3?

I've been trying to get a simple example working where a kml layer within the google map will automatically update the contents on each zoom/pan. I've been testing using a simple server php file that returns a placemark in the middle of the specified bbox; our goal is to use this model to perform server side clustering. I've got the sample working in google earth using a php file linked through network kml.
Network KML file:
http://crv.vividsolutions.com/test/kml/layer2.kml
When I added the same network kml as a layer in google maps the php file on the server was only accessed the first time. The layer came up as expected and displayed the point in the middle of the screen, however after panning the map the data was not refreshed (the point was not moved to the center of the map). Based on the access logs, a bbox was passed down to the kml server with the first request, however there were not any subsequent requests. My test map can be found here:
http://crv.vividsolutions.com/test/kml/index.php
I've located an issue which looks to be related (id=2697). [I could only include 2 links on this post otherwise would have linked it].
After trying a couple things, I did manage to get the desired behaviour however the solution involves dropping the existing JS layer object and adding a fresh on every pan. This seems a bit heavy handed. I was hoping someone might have an alternative solution to get the same behaviour without the overhead associated with creating a new Layer object on each pan/zoom.
Layer swap example (works but clunky): Same server as index.php ... just rename to index2.php [ran into the smap bot link limit].
The KML reference says onStop is supported in google maps.
original link (no longer valid)
updated link
partially "onStop" is supported