Tuesday, 13 February 2018

python - Spatial Classification


I am not sure what to call my problem. From this image, I have a set of classified polygons (colored). I would like a way to classify the white polygons in the image.


I don’t have any attributes to base the classification on other than proximity to a classified polygon. I have tried a naïve approach by using the near tool in Arc. This works fine enough but it becomes sensitive to outliers. For example, a set of unclassified polygons may be surrounded by polygons of category "A" but if there is a single “island” polygon of category "B" nearby, they’ll be classified the same as the island polygon.


I am looking for a way to rank the likelihood that an unclassified polygon belongs to a particular category based on proximity to arbitrary k-polygons. For example, if there is a polygon of category "B" immediately adjacent to an unclassified polygon but the next five closest polygons are of category "A", I'd like the system to rank the unclassified polygon as category "A".


I am wondering if there’s anything in R that would solve my problem. Really, any off the shelf method would work (python, qgis, postgis, arc). enter image description here



Answer



For anyone reading this, I eventually worked out a solution in PostGIS to select the nearest k neighbors (i.e. 9) and select the most common occurring class from the nearest neighbors. Then, I assigned that class to the white polygons. This approach was less sensitive to single, misplaced polygon classes.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...