1

I have esri ascii grid raster files like

ncols 4
nrows 3
xllcorner 0
yllcorner 0
cellsize 1
nodata_value -999
1 2 3 4
4 21 3 3
3 2 31 1 

How can I convert this into vectorized (WKT) format when simplifying / reducing polygons via a binning of the values i.e. neighbors within a range of 0...10...20...30 should be put into the same polygon.

Naively this translates to

1.0;POLYGON ((1 3, 0 3, 0 2, 1 2, 1 3))
4.0;POLYGON ((1 1, 1 2, 0 2, 0 1, 1 1))
3.0;POLYGON ((0 1, 0 0, 1 0, 1 1, 0 1))
2.0;POLYGON ((1 2, 2 2, 2 3, 1 3, 1 2))
21.0;POLYGON ((1 1, 2 1, 2 2, 1 2, 1 1))
2.0;POLYGON ((1 1, 1 0, 2 0, 2 1, 1 1))
3.0;POLYGON ((3 1, 4 1, 4 2, 3 2, 3 3, 2 3, 2 1, 3 1))
31.0;POLYGON ((3 1, 2 1, 2 0, 3 0, 3 1))
4.0;POLYGON ((3 2, 4 2, 4 3, 3 3, 3 2))
1.0;POLYGON ((4 0, 4 1, 3 1, 3 0, 4 0))

I can aggregate/bin the numbers into a range from 0...100 with steps of 10 and group-by aggregate (ST_CONCAT/ST_UNION) the geometries, but this is not what I want to achieve. I.e. When creating the polygons I would rather only want to create them in aggregated fashion. So for the value range, it should be already in the binned range, and for the polygons they should be considered neighbors if a) next to each other b) binning interval is the same.

3
  • What GIS software are you using? What have you tried? – PolyGeo Jun 2 '17 at 12:24
  • open source: gdal, geotools, ogr Currently I tried to use ST_UNION like concatenation of the polygons into multiploygons but this is not what I am after. I want to have separate polygons but fewer of them. I am looking for something similar to postgis.net/docs/manual-2.2/ST_Simplify.html i.e. currently I am binning only the values, but during the process of poligonize-everything I would also like to reduce the polygon count and get fewer but bigger polygons – Georg Heiler Jun 2 '17 at 12:25
  • I read that geotools is providing DouglasPeuckerSimplifier and TopologyPreservingSimplifier which will simplify a single Geometry, I would rather want to simplify across geometries have a smaller number of polygons. – Georg Heiler Jun 2 '17 at 13:15
0

I think reclassification is the right tool. Gdal supports this and Getools PolygonExtractionProcess via classificationRanges as well.

Here I declared my bins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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