Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simplify (reduce number of points) in KML?

I have a similar problem to this post. I need to display up to 1000 polygons on an embedded Google map. The polygons are in a SQL database, and I can render each one as a single KML file on the fly using a custom HttpHandler (in ASP.NET), like this http://alpha.foresttransparency.org/concession.1.kml .

Even on my (very fast) development machine, it takes a while to load up even a couple dozen shapes. So two questions, really:

  1. What would be a good strategy for rendering these as markers instead of overlays once I'm beyond a certain zoom level?

  2. Is there a publicly available algorithm for simplifying a polygon (reducing the number of points) so that I'm not showing more points than make sense at a certain zoom level?

like image 992
Herb Caudill Avatar asked Oct 10 '08 20:10

Herb Caudill


People also ask

How do I reduce a KML file?

To reduce the size of your . kml or . shp file without degrading the quality of the data, zip the file by saving it as a KMZ or SHZ. Just open the file and click either save as KMZ or save as SHZ.

How do I extract coordinates from a KML file?

One way to extract coordinates from your KML is to upload your KML to Google's Fusion Tables. If Google Earth parses your data then most likely you'll be able to import into a Fusion Table. Short-cut to create a "Fusion Table" is simply clicking "Create a Fusion Table" from here and pick your KML file.

Can you edit a KML file?

You can edit KML files in a notepad editor, such as Notepad++ or Sublime Text. This can allow you to rearrange folders, and change layer order. The folders use the XML tag "Folder", and items inside the folder can be "Placemarks", "Document", "GroundOverlay" and others.


1 Answers

For your second question: you need the Douglas-Peucker Generalization Algorithm

like image 66
PiedPiper Avatar answered Sep 29 '22 21:09

PiedPiper