6

Can someone explain how the ogr2ogr simplify works?

I am trying to use raster data which has a spectral resolution of 30m. The vector file that I am trying to import into Google Fusion is large in size and so I was recommended to use ogr2ogr with tolerance of 0.00001.

Can someone explain the unit of the tolerance?

I assumed that it would be decimal degrees but the resulting KML still has around 10 decimal points.

3
  • Read about Douglas-Peucker simplification. Commented Apr 25, 2015 at 20:38
  • Thanks. Do you know what the unit on the tolerance is? Like if I specify 0.00001, what does that mean in terms of accuracy? Commented Apr 25, 2015 at 22:18
  • What has your raster (with a "spatial", not "spectral"?) resolution of 30m got to do with the vector data? Nothing? Commented Apr 26, 2015 at 20:29

1 Answer 1

5

You may still have 10dp numbers reported, but count the number of nodes in the modified file, and it should be far fewer that the original.

The tolerance unit is whatever the unit of your map data uses. 0.000001° would keep destination paths no more than 0.000001° (a metre 10 cm or so) from their original location. It would be far too small if your data were in metric UTM format.

Clarification: My original estimate was off by an order of magnitude. It would have been 0.00001° that would have been around a metre. I say around, as fractions of a degree vary by location, and aren't always equal. For example, where I live, 0.000001° N↔S is roughly 11 cm, but 0.000001° E↔W is only about 8 cm.

OGR only simplifies on fractions/multiples of the layer's unit. If your layer is EPSG 4326, you're going to have to live with fractions of a degree, and perhaps slight variations in tolerance over large objects. If you wish the unit to stay constant, convert to a projection such as UTM, and then the unit you use will be fractions/multiples of metres/feet/US survey feet, etc.

To find out the layer's units from the command line:

ogrinfo -al -so dataset 

Under the CS section of the output, it should show something like ANGLEUNIT["degree" … or LENGTHUNIT["metre" …

4
  • It is less that meter en.wikipedia.org/wiki/Decimal_degrees. You would also need a tool for reducing the precision of coordinates from 10 to 6 decimals but that is lacking from the KML driver of GDAL at the moment trac.osgeo.org/gdal/ticket/2461. Commented Apr 26, 2015 at 7:33
  • I see. So because my data is in WGS84, the unit will be decimal degrees only? Or is there a separate unit that is also maintained? How do I check this other unit, if it so exists? Commented Apr 26, 2015 at 16:37
  • Rather than trying to figure out the mysterious unit, I just used trial and error plugging in different numbers until I got the desired effect. (I suppose even if they documented it further I probably wouldn't understand it anyway.) Commented Jul 5 at 11:15
  • 1
    @DanJacobson - ogrinfo -al -so dataset removes all trial and error. Under the CS section of the output, it should show something like ANGLEUNIT["degree" … or LENGTHUNIT["metre" … Commented Jul 5 at 16:17

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.