6

I am looking for a method to expand certain areas of a single polygon to meet a minimum distance requirement. For example, the screenshot shows a polygon in green where I want to expand areas to a minimum distance of 2.5 km. The solid black polygon is a rough example of what I hope to accomplish. Buffering everything by X distance will not work because I am trying to preserve as much of the original shape and area as possible. How can I expand certain areas to meet the minimum 2.5 km requirement and minimize any increase in total area?

I am interested in any vector or raster based approaches and I am using ArcGIS for Desktop with a Basic license and the ArcGIS distribution of Python.

enter image description here

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Aaron
  • 51,658
  • 28
  • 154
  • 317
  • 2
    a minimum distance of/from what? – Midavalo Aug 03 '16 at 03:28
  • 2
    Is your end goal to make the green polygon look like the black polygon? Or you just want to expand the green by 2.5km and limit by the black? How about a buffer and a clip? – Fezter Aug 03 '16 at 03:35
  • @Midavalo If you were to draw a line from one side to another in the polygon. there should always be at least 2.5 km distance. The black polygon is a rough example of the intended output. – Aaron Aug 03 '16 at 04:00
  • @Fezter The black polygon is an example of the intended output. I don't think a buffer and clip would work because it would increase the area of the original polygon by too much and I there is no polygon to use as a clipper. I've edited the question to clarify. – Aaron Aug 03 '16 at 04:01
  • 1
    @Aaron is the assumption that the 2.5km (min) line is perpendicular to the one side or the other? Otherwise your corners will always be an issue – Midavalo Aug 03 '16 at 04:27
  • 1
    You need medial axis. Euclidian distance from it will define areas to grow. Buffer of 1.25 will do – FelixIP Aug 03 '16 at 04:28
  • I agree with FelixIP. There's a tool in FME (I know you want an arc solution) that allows you to create "skeleton" centrelines - can't remember the name of the transformer. From there you can buffer. Not sure how to accomplish that in arc with a basic license but it's probably possible with manipulating the geometry in Python. Maybe some other libraries other than arcpy. – Fezter Aug 03 '16 at 05:42
  • The only issue here is axis, for that definition of opposite sides can be useful. After that even raster solution possible, just connecting points where distance to a line=distance to B. Merging of buffer and original is some sort of solution – FelixIP Aug 03 '16 at 06:11
  • 2
    These posts might help for finding medial centrelines: http://gis.stackexchange.com/q/5305/7424 and http://gis.stackexchange.com/q/177/7424 and http://gis.stackexchange.com/q/2775/7424 – Fezter Aug 03 '16 at 06:11
  • @FelixIP I think you are on to something here. I can envision how to calculate the medial axis, although how would Euclidean Distance define which areas to grow? – Aaron Aug 03 '16 at 12:03
  • 1
    FYI, this python library, pySkeleton, will calculate the straight skeleton of a polygon. – Fezter Aug 04 '16 at 00:08

2 Answers2

6

Input:

enter image description here

Action, field calculator, python:

!Shape!.convexHull()

Output:

enter image description here

Please note that above is not solution for OP.

Possible workaround:

Inputs:

enter image description here Output and "prove": enter image description here

As one can see definition of "opposite" sites is crucial. It is near obvious in your example though.

I have my own script to create axis, it is untidy and I don't want to share it. Let me know if you are struggling with axis drawing, I'll post raster solution

Raster solution to get axis:

@Aaron Create empty polyline feature class, start editing it, select original polygon, copy/paste it to the line. All this is because of Basic type license, so that you cannot use feature to line tool.

You need this line for 1st step:

arcpy.gp.EucDistance_sa("Converted_Graphics_2", "D:/Scratch/distance", "", "20", "")

This shows hillshade of above distance raster:

enter image description here

arcpy.gp.Slope_sa("distance", "D:/Scratch/slope", "DEGREE", "1")
arcpy.gp.RasterCalculator_sa("""Con("distance" == 0,200,"slope")""", "D:/Scratch/cost")
arcpy.SelectLayerByAttribute_management("Source_Dest", "NEW_SELECTION", "Name" = 'A')
arcpy.gp.CostBackLink_sa("Source_Dest", "cost", "D:/Scratch/blink", "", "")
arcpy.gp.RasterCalculator_sa("""Int(Power(2,"blink"-1))""", "D:/Scratch/flowdir")
arcpy.SelectLayerByAttribute_management("Source_Dest", "NEW_SELECTION","Name" = 'B')
arcpy.gp.CostPath_sa("Source_Dest", "flowdir", "flowdir", "D:/Scratch/path", "EACH_CELL", "FID")
arcpy.gp.StreamToFeature_sa("path", "flowdir", "D:/Scratch/axis.shp", "SIMPLIFY")

Result shows AXIS created at the last step by blue arrows line:

enter image description here

FelixIP
  • 22,922
  • 3
  • 29
  • 61
  • Note: You must be in an edit session for this to work, since you are modifying the geometry. – jbalk Aug 03 '16 at 06:24
  • It is not a case unless there is related table in database. Most of field calculations including geometry field can be done outside of editing session – FelixIP Aug 03 '16 at 06:58
  • 1
    @Aaron see update. When using this approach make sure your environment extent is slightly bigger than your polygon, so that points A,B sitting inside it. Use reasonable cell size to make it work faster – FelixIP Aug 04 '16 at 01:31
4

It is unlikely that you will be able to perform this task automatically. You may be able to get close using convex hull. This will create a polygon that encloses the shape like this:Red Line is Convex Hull

This is available with an ArcGIS Basic license level using the field calculator.

jbalk
  • 7,505
  • 1
  • 17
  • 39
  • If you are not comfortable using the field calculator and have access to QGIS, there is a convex hull tool in the vector toolbox in QGIS. – jbalk Aug 03 '16 at 05:58
  • There's a Convex Hull tool in ArcGIS too, doesn't just need to be done through field calculator. – Midavalo Aug 03 '16 at 06:04
  • 1
    @Midavalo note that the Minimum Bounding Geometry is available at an ArcGIS Basic level, but (annoyingly) the Convex Hull is not – Stephen Lead Aug 03 '16 at 06:15
  • @StephenLead thanks for the heads-up - I had checked the licensing info at the bottom of the page but missed the note further up. – Midavalo Aug 03 '16 at 06:19
  • 2
    You can download "Create Convex Hull" tool from this link: http://www.arcgis.com/home/item.html?id=7ce38f8d64dd44f7873051069e56461f and add it to ArcToolbox. It works with all license levels. – ahmadhanb Aug 03 '16 at 06:20
  • 1
    OK since you changed the language of the answer, I am removing my down vote, though solution is not valid – FelixIP Aug 03 '16 at 07:02