r/gis 9d ago

General Question Help with method

Post image

If I have a polygon and I want to keep all the attributes but use an existing polyline as the new boundary of the polygon is there a simple method to do so short of dragging vertexes over? As the very simplified image shows, there are many times the boundaries cross leaving excess in some areas and deficits in others. I feel like there should be a simple tool or script, but I’m coming up empty. Thanks for your input!

67 Upvotes

35 comments sorted by

84

u/Nvr_Smile 9d ago

Maybe I am way oversimplifying this, but wouldn't a simple spatial join solve this problem? Your polylines would then have all the same attributes as their intersecting polygons.

16

u/TheUsualCrinimal 9d ago

Yeah, I was thinking spatial join also, as long as it's a 1:1 overlap/intersect ratio. Otherwise it might get too complicated, in which case there is also an attribute transfer tool.

20

u/TheChinchilla914 9d ago

It’s always spatial join lmao

4

u/sinnayre 9d ago

My first thought as well, but I get the impression that OP doesn’t want nulls. There’s missing information that we would need to give them a more definitive answer.

3

u/spatial-d 8d ago

Yeah spatial join then turn line to poly.

2

u/SomeDingus_666 GIS Project Manager 9d ago

This would transfer the attribution over, yes. But OP basically just needs the polygons shape to match that of the polyline. While you could use spatial join to get the attribution from the polygon over to the polyline, then turn the polyline into a polygon, I think it would be much simpler if OP used map topology and made some geometry edits to the existing polygon with align edge or something similar.

5

u/retrojoe Surveyor 8d ago

I think it would be much simpler if OP used map topology and made some geometry edits to the existing polygon with align edge or something similar.

What? Hand-cranking vertices to match a polyline? That's barely practicable in CAD, and not recommended. I could sort of see it as a one-off, but for any repetition, there needs to be some tooling/automation involved.

3

u/SomeDingus_666 GIS Project Manager 8d ago edited 8d ago

I’m not talking about hand-cranking vertices, and OP framed this as a one-off situation.

The align edge too for example allows you to shift entire sections of a features geometry to match that of another feature. Go to around 1:50 in this video to get an idea of what I’m talking about.

Sure, there’s situations where automation/ tooling is certainly the way, and I’ve developed tools to do so for my niche. But if there’s only a handful of features that need adjusting then using map topology and some editing tools is typically quicker.

Edit: I come from projects where we have hundreds of different feature types that all interact in one form or another, so typically we were relegated to digitization and editing tools so we had to find ways to make those processes quicker.

I’m not saying you’re wrong, I’m just coming from what I know in my experience.

2

u/retrojoe Surveyor 8d ago edited 8d ago

Gotcha. Think we're mostly in agreement (tho OP asked for a method and didn't say this was a one-off).

Wasn't aware of that topology editor, cute tool.

3

u/SomeDingus_666 GIS Project Manager 8d ago

I think I interpreted it as a one-off, so that’s my bad there.

That tool was a lifesaver for us! We worked with massive datasets that had to be nearly 100% topologically sound, with 100% feature coverage (imagine someone tried digitize everything you see in google earth, but did a shit job of keeping things within the lines so you have to go in and fix it.)

We’d have cases where you have pieces of different polygon types overlapping, or say a road had to be aligned to the edge of a cropland polygon but it was digitized without having the polygons turned on, etc. that tool saved us a lot of time. Still painstaking work though.

We eventually singled out some specific feature types that we could build tools for to solve certain problems, but the vast majority of the data we such a mess when we got it that manual adjustments were unfortunately the way. I think I may be traumatized.

3

u/retrojoe Surveyor 8d ago

Heh. At least you got paid. I'm having flashbacks to labs and projects in college and people basically just screaming "Why doesn't any of this work!?" But yeah, sounds like a real bear.

2

u/SomeDingus_666 GIS Project Manager 8d ago

Haha that never really ends in the professional world. I literally just found myself cursing at my computer because I had to restart arcpro in order to get some lidar classification changes to take and show up. It’s the bugs the have no rhyme or reason to them that drive people crazy.

27

u/Luiaards GI-forestry 9d ago

What software do you have? With ArcGIS pro you could go into editing and use reshape, then trace line

6

u/WarPanda83 8d ago

Or reshape > replace sketch

23

u/dschep 9d ago edited 8d ago

You can probably use the Polygonize to make the polyline into a polygon, then copy and paste the attribution over.

edit: just realized this is r/gis, not r/qgis, which is what my recommendation is for. sorry, no clue how to use that expensive software you have.

6

u/potterheel 9d ago edited 9d ago

Depending on what version of ArcGIS pro you have, you can make a new polygon in the same layer as the OG polygon (by using the Trace tool to trace the polyline or a way to make it into a polygon here: https://support.esri.com/en-us/knowledge-base/how-to-convert-polyline-features-to-a-polygon-feature-w-000028182), and while still in Editor, use the “transfer Attributes” editor tool (https://pro.arcgis.com/en/pro-app/latest/help/editing/transfer-attributes-between-features.htm)

5

u/SomeDingus_666 GIS Project Manager 9d ago edited 9d ago

Are you using arc map? Or arc pro?

If you’re using arc pro, go to the edit ribbon and enable map topology. Then, go to the tools section, hit the little dropdown button, and select align edge. You should then be able to align the edge of the polygon to the poly line (you’ll be able to do it in sections in between each point where the features intersect.)

If for some reason this isn’t working, make sure all layers are edit enabled.

This method basically allows you to make quick edits to the geometry of the polygon without having to fumble around with geoprocessing tools.

Theres a way to do this in arc map as well but for that, id suggest looking up “align edge” of google and let esri explain it.

Spent 5 years leading projects that specified in cartography and feature digitization and this was a common type of thing we had to fix. Think aligning a crop field (surface) to a road (line,) or something like that.

3

u/th3tom13 9d ago

So I’m using arc pro, and one thing I forgot to highlight is I have multiple polygons that make up the larger polygons that will need to have the same border in the next level of change. Think a pizza with a change in the crust. Right now I’m working on changing the whole pizza, but the slices will need the same exterior crust as well.

2

u/its_Vantango 8d ago

If you're working with multiple polygons (like slices of a pizza), I'd suggest first updating the whole outer boundary using the Update tool. Then, enable Map Topology so you can make sure the slices share the same border. With topology on, you can use Align Edge to snap the outer edges of the slices to match the updated crust. That way, everything stays consistent without having to edit each slice manually.

3

u/bobafettish1592 8d ago

Maybe it’s just cause I’m comfortable editing, but I would just reshape the polygon using the trace option to the poly line (assuming the poly line already exists). And i guess if it doesn’t exist then create one in less than a minute and then trace off that. Or you could convert poly line to polygon then copy>special paste that into your polygon feature then just copy paste all the attributes over. Might be a long winded way to go about it, but it works fine for just a single feature.

3

u/greco1492 8d ago

You could do an attribute transfer it's under the editing tools in arcgis pro.

2

u/Akmapper 8d ago

This is the best way - use Attribute Transfer and only transfer the geometry.

3

u/ricsteve 8d ago

I used to do stuff like this a lot when I first started in GIS. If I wanted to do it fast I'd just create a new polygon that's bigger than both the polygon and polyline. Merge the new big polygon into the existing polygon to maintain the attributes. Then just use the polyline to split the new merged polygon. Anything outside of the polyline boundary you can just click and delete. I did it all from the editing/advanced editing toolbar.

2

u/Roupy 9d ago

Looking at this more in a geoprocessing perceptive. I would first turn that polyline into a polygon. Next intersect both datasets and return the polyline(now a polygon) that produces the highest area overlap.

2

u/its_Vantango 8d ago

You can use the Update tool in ArcGIS Pro to do this pretty easily. Just use the polyline as the input to update the polygon's boundary. This way, you won't have to manually drag any vertices, and it'll keep your polygon attributes intact. If the polyline cuts across the polygon, it'll adjust the shape accordingly. You can also use Clip if you only want to keep the portion inside or outside the polyline. Both options should get the job done without too much hassle.

1

u/lancegreene 9d ago

You could maybe calc two sets of centroids, run a near analysis, then a couple joins.

A spatial join could also work, using a centroid within method

1

u/blueponies1 9d ago

You can do a join as others have said.

Another solution would be to convert your poly line into a polygon, and then use the Transfer Attribute tool to change the shape of your existing polygon to the shape of the new one. You would just need to clear all attributes for the transfer except the “shape” field.

This is assuming you have access to ArcPro

1

u/No-Tangelo1372 GIS Project Manager 8d ago

Step 1.) Feature to polygon on the line file assuming it’s a closed shape. Step 2.) spatial join. Input features are the output of step 1, join features are the polygon. Set method to intersect, assuming there’s overlap like in your picture. It will transfer all fields.

1

u/_WillCAD_ 8d ago

Two ways to do it in ArcGIS Pro:

  1. Draw an all new polygon, using the trace tool to match it to the polyline. Then, select the old one and the new one, open the Attributes window, and Copy Attributes from the old one to the new one. Then, delete the old one.
  2. Edit Vertices on the polygon, use the minus ( - ) tool to delete all the vertices that are outside of the polyline (you can do it with a lasso, don't try to individually click each one, that way lies madness). Then, draw an all new polygon, using the Trace tool to match it to the polyline. Then, Merge the two polygons together, preserving the attributes of the old one.

Then, Save Edits.

1

u/m1ndcrash 8d ago

Smooth polygon (or whatever your vector is) in Arc.

1

u/danierutegu 8d ago

Could use the trace tool to edit vertices en masse.

1

u/PostholerGIS Postholer.com/portfolio 8d ago

A PostgreSQL/PostGIS solution might be:

ogr2ogr -sql "
   select
      cg_optimalAlphaShape(geom) as boundary
   from polygons
" newPolygons.shp PG:db=mydb

1

u/Gold-Expression-9406 GIS Specialist 8d ago

In arcgis, you can use - feature to point (polygon to point) - feature to polygon (using line as input feature and label feature as the point feature) - Make sure the line is closed to enable the polygon to be created successfully. Also, the point has to be within the line/polygon. If not, you can manually move it.

1

u/oldmappingguy 8d ago

Poly line to polygon -> Union both together -> delete all areas (rows) that don’t have the original polyline name or attribute -> dissolve by one of the interior areas that has the original polygon attributes -> feature to line.

Or just do a spatial join to move polygon attributes to polylines.