Mapping 400MB KML data in Google Maps
Re,
I have a KML file that's 400MB large - 1 week of travel and 5000km logged. It's already stripped of non-essential data. GPX file from that is around 80MB or 2.5MB zipped. KML file is around 30MB. I am not sure how many waypoints there are but must be hundreds of thousand.
How would I go about mapping it on Google Maps? Is there a way to reduce the file without compromising the quality of my tracks? I am using jQuery and Google Maps API v2 or v3.
Thanks.
Well it is very easy using a KML file with the Google Maps API. An example would be the following:
KmlLayer(http://myserver/kmlfile.kml)
See the API 3.0 Reference on the KmlLayer here.
But you have a problem with your large KML file. The current maximum for an uncompressed KML file is 10MB , a lot smaller than your 30MB. See the reference on KML support here.
In my experience adding large KML files to a map is also very slow. So loading your eg 9MB file will take lots of time. What I suggest you do is to reduce the size of the file.
Do you really need all those hundreds of thousands of waypoints? What was your logging stepping? Like each 10 seconds? Do you need to have your location down to the meter, isn't every 100meters enough? Btw: Are you working on an internet-based thing? I remember Google Earth supporting arbitrary large KML files (but certainly larger than the maps API).
I don't know any track-smothing programs or "waypoint remover", but there surely are such things out there and that is what you will need to make your KML file smaller (also 30MB still sounds very large to me, are you sure it is only waypoints or do you have decriptions and the like in the KML? Could you shorten these? Colors? Use global KML colors instead of defining the color for each waypoint!)
I split a much smaller kml/kmz file into several chunks. However I still noticed MASSIVE slowdowns when I tried to get near the limit. Typically Google Maps would not show the markers when I was at full extent of the map, and would only do so if I zoomed in (and thus it had much fewer markers to deal with).
Often it would only show the markers on a portion of the map tiles, and the other map tiles would be empty.
Even Chrome, which is the fastest browser for this, could barely handle it.
It would be worth considering importing your KML file into a fusion table..
http://www.google.com/fusiontables/public/tour/index.html
The subsequent performance will be spectacular compared to adding overlays based on a KML file.
链接地址: http://www.djcxy.com/p/3998.html