11

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.

MarkL
  • 153
  • 1
  • 1
  • 6

5 Answers5

3

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 e.g. 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!)

Dennis G
  • 21,405
  • 19
  • 96
  • 133
  • There are a bunch of programs, such as GPSBabel, for instance. I guess my main concern is to have a fairly accurate representation of my travel. 100m is huge in European cities with lots of small streets, turns, and twists. 100m on a straight highway isn't that big deal. – MarkL Dec 08 '10 at 17:48
  • I hear you, problem is that there are limitations with Google's API ;-) When opting for a paid plan they probably are able to lift these restrictions, but the paid plans are expensive. Again: Look at the KML file at hand, are there ONLY waypoints in there? I had an KML file created once and for every node the color, thickness etc. was defined, whereas it only needs to be defined once. – Dennis G Dec 08 '10 at 19:00
  • I managed to get it down to 72MB, with 100m between points. It looks a bit inaccurate but is still representative of my travel path. So now I guess I will have to split it in 8 chunks; still, it will take time to load everything. Oh well. I thought there was an easier way. Thanks. – MarkL Dec 08 '10 at 19:37
0

For some magical reason when you create a KMZ using Geosetter > export to google earth. The KMZ's it creates although much larger than 5mb load into google earth no problem.

W148SMH
  • 152
  • 1
  • 11
0

I reduced a 5 MB kml file to about 1.3 MB. Step one is to remove all track points and many path points. Only two points are needed for a straight line but GPS receivers might record dozens.

There are automated tools to filter tracks but I prefer to hand-edit.
Step two is to optimize the style information in the kml file. Google Earth Desktop (GED) is useful for editing paths and setting styles, but it never seems to delete a style so you end up with a megabyte (in my case) of duplicate identical styles.

The kml file is in plain text so any text editor can be used to merge styles and delete duplicates. This task is tedious and likely to result in errors, so I found a workaround:

Make a duplicate kml file as a backup and remove all the style information. This is simple and quick. Save the file and open it in GED.
I organised all elements with shared styles into kml folders. Then set the style of each folder resulting in one definition for hundreds of paths or way points.

There is a final foible (bug?) in GED; when you share a folder style, all the folders below including those that are not sub-folders inherit the style.
This is an odd behavior - a bug in my opinion!
So drag the folder to be altered to the bottom of the list. Set the shared style and then drag it back to the top or middle.

I have folders for walks, public-transport-routes, long-distance-paths, bus-stops, train-stations, parking, pubs, points-of-interest and hazards so I need to set about nine styles.
This only takes a minute or two so it's an efficient solution not needing additional software.

As I add new walks and pubs to the file, the duplicate styles start to accumulate again so from time to time the optimization has to be re-done. This is the optimized kml file.

Filnor
  • 1,290
  • 2
  • 23
  • 28
0

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.

Aaron Kreider
  • 1,705
  • 5
  • 22
  • 44
0

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.

Duncan_m
  • 2,526
  • 2
  • 21
  • 19