1

I have a KML file which shows up fine on Google Earth but is missing lines on Google Maps. I have realized that this is because those lines have geometry that is too complex. The map in general probably has about 10x more points than it needs.

I have found a few sites online which will simplify the KML file but this file seems too big for that (8 Mb).

I read that Leaflet has a library called simplify which can help with this but I am new to JavaScript and would prefer a simpler alternative.

0
3

use ogr2ogr with the -simplify flag. Simplify tolerance must be in map units. If your coordinates are in degree you must also use degree (0.00009 degree ~ 1 m close to the equator)  

ogr2ogr -f KML -simplify 0.0001 outfile.kml infile.kml
4
  • 1
    I tried that, get this error: "The output driver does not natively support DateTime type for field timestamp. Misconversation can happen, -mapFieldType can be used to control field type conversion." The output file looks identical to the input file when viewed in google earth and is almost the same size. I tried adjusting the number of decimal places but still no noticeable difference in the output file. – user3335946 May 22 '16 at 1:11
  • Can you confirm the spatial reference system you are using? The values above are for unprojected data (lat/lon). If you use a projected reference system (eg UTM or Web Merkator) you will use meters and need much higher numbers (~10 meter - 50 meter) – Thomas May 30 '16 at 13:55
  • The error message you get refers to the timestamp field. There seems to be an issue with the conversion. This shouldn't have an effect on the simplification of the geometry. However, to be sure you can try to exclude it by using the -select [field list] flag – Thomas May 30 '16 at 13:59
  • I get the same issue with "The output driver does not natively support DateTime type for field timestamp. Misconversation can happen, -mapFieldType can be used to control field type conversion.", using the Sentinel-2 tiles KML index file. Is there a kind of "laundery" possible? – markusN Dec 15 '16 at 22:11
0

You can use the Simplify Geometries tool in QGIS.

Click Vector > Geometry Tools > Simplify Geometries. This will only work with lines or polygons.

You can also select by a query, edit the layer, and delete unneeded features.

Not the answer you're looking for? Browse other questions tagged or ask your own question.