The picture below is a single polygon. One of the polygons within this layer is a road (highlighted in blue) which runs through the middle of other polygons within that layer. I want the road polygon to be merged with the adjacent polygons, or alternatively, deleted, and the gap where the road was to be filled with the adjacent polygons.
It would be simple to do manually, but there are hundreds of polygons impacted and I'm wondering if there is a better way to do this.
Hi @BenPearse ,
You can use Union in ArcGIS Pro or ArcMap.
Analysis Tools > Overlay > Union
then use Select (from Analysis Tools > Extract) or do a definition query on the output to filter out road.
Can you clarify if your road polygons *overlap* the other polygons, or if all polygons in this dataset have disjoint (not intersecting) interiors?
If the road polygons overlap the other polygons, then I agree that Union is a solution. However, if all polygon interiors are disjoint, then this will not work.
I don't have a good answer for how to achieve a solution in the latter case using strictly esri-supplied vector operations.
But I know how to do it using esri operations on rasters. :beaming_face_with_smiling_eyes:
In that case, if the coordinates of your polygon vertices are not too sacred, you can rasterize your polygons at a suitable resolution, assign NODATA to the road polygon, then use Euclidean Allocation or Distance Allocation tools to 'spread' neighboring polygon IDs into the NODATA cells.
I can elaborate on this if you think this approach is worth pursuing.
spatial analyst team
No my road polygons don't overlap so the union wouldn't work.
The coordinates of my vertices are not sacred, although I would need to convert them back to polygons that are fairly similar to my original vector layer.
I would definitely be interested in hearing your approach, the only caveat is that I don't currently have the spatial analyst extension. I'm pushing my supervisor to get it though, so maybe this could add to my argument for it.
Here's one approach.
1.Select all roads from your input polygons.
2. reverse the selection (so only non-road polygons are selected)
3. execute polygon to raster gp tool, using an attribute that uniquely identifies each non-road polygon as the 'value_field' parameter. We'll call this output raster "PolyR". Here's an example of what "PolyR" might look like (the white is nodata):
4. use that as the input to the Euclidean Allocation tool.
5. The output should look something like this. We'll call this 'ErasedRoadsR":
6. In ErasedRoadsR, the cell values from PolyR have been 'spread' to the nearest NODATA cells.
Here are "PolyR" and "EraseRoadsR" shown together, using transparency for the latter. in EraseRoadsR each NODATA cell from POlyR is assigned the value of its closest DATA neighbor, thus 'filling in' the NODATA gaps.
7. Finally, you can use the RasterToPolygon GP tool to convert back to a polygon feature class. You can use the 'Simply' parameter to get rid of the jaggies.
Hope this helps,
A colleague recommended the Eliminate GP tool, which might be an option.
Can you post a representative sample of your dataset ? (please make sure its anonymized so that no personal information is present in the attributes). There might be a way to avoid altering polygon coordinates outside of the road area, but I'd like to test that first.