Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

Commented Issue: RasterToPolygon Issue [23952]

$
0
0
There are two parts to this issue:

Part 1:

DotSpatial.Tools.RasterToPolygon isn't always working. Some sample data is in the attachment.
DEM_w.tif is the raster file we start with. It is a grid representing watersheds by specific ID numbers at each cell. The function DotSpatial.Tools.RastertoPoly is intended to take ANY grid of numbers and create separate polygons for each id number.

So, all of the cells that have value 1 should be merged into a single polygon with an attribute table value "1". All cells with value 2 should be merged into a single polygon with attribute table value "2" and so forth.

If you run the function on this data, you will see that it "sort of" works. Some polygons are created and some polygons are NOT created. I believe that the problem occurs when a a watershed has a few cells that are connected by the corner of one cell.

The immediate need is to get this function to just work as expected - i.e. to create the polygons for each group of cells.

In the case where there is a set of cells that are separated from other cells, but they have the same number, they should be added as a "PART" in a "MULTIPART" polygon. That way when the user selects the polygon, it should show all the parts of it (i.e. all the places that had the same value in the original raster).


Part 2....

I also included in the zip file a shapefile called WatershedPolys.shp. This is a more advanced output from a similar operation, except in this case, the "stairstep" effect on angled cells is removed or smoothed through. I created this with MapWindow 4.x.

The other cool thing about this output is that it if cells from the same watershed are connected at the corner, it creates a smooth path between them, rather than separate MULTIPART polygons. See the attached pdf picture file in the attached zip.

for Part 2, we should add an overload to DotSpatial.Tools.RasterToPolygon where you can add an optional "ConnectionGrid" (flow direction grid) and get the smooth solution. The attached file DEM_p.tif is an example connection grid for the smooth solution...
Comments: Associated with changeset 71525: RasterToPolygon: added overload method that takes into account connection grid.
This is a part 2 of #23952.
(smoothing of boundary cells is not fully implemented yet)

Viewing all articles
Browse latest Browse all 3973

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>