Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: split polygon on blade #9334

Open
EvanCarroll opened this issue Oct 11, 2022 · 7 comments
Open

Feature Request: split polygon on blade #9334

EvanCarroll opened this issue Oct 11, 2022 · 7 comments
Labels
enhancement An enhancement to make an existing feature even better operation An editing operation / edit menu item

Comments

@EvanCarroll
Copy link

EvanCarroll commented Oct 11, 2022

Description

It would be nice if we had a way to split a polygon with a blade. This is a pretty common practice for mapping. I can think of two use value propsitions here,

  1. It makes it easier to incrementally upgrade things: for example, let's say you map a parking lot. At first you may map the whole parking lot with a single polygon which is explicitly mentioned as a good start. However, the ideal is to have every parking lot aisle not overlap anything including parking aisles. This requires a lot of polygons for the parking lot. As a transition you may want to to cut the parking lot in half, and convert just half of it to smaller polygons for each aisle.

  2. It makes it easier to reform and fix things, take for example this screen shot
    aisle
    In this case an aisle overlaps a "planter". I would like to be able to

    1. split the the aisle on a blade creating two aisles of the same tags
    2. shrink one aisle.
    3. create the planter.
      While easier is an operative term, it's an understatement. For example, let's assume you have a long parking aisle and inside the parking aisle on opposite ends there are self-contained "Accessible Parking Space" polygons. This makes this task substantially harder with the blade-splitting the polygon. Because one of these must be deleted making the transition a bit more dangerous. For example, from the above, if I zoom out a bit you can see this,
      Screenshot_2022-10-11_12-16-05
      If I wanted to add a "Planter" as described above, I would have to delete the "Accessible Parking Space" first. A solution here would save me that work, and it would make it harder to do the wrong thing.

I know on the backend we typically use ST_Split for this

@EvanCarroll EvanCarroll changed the title Feature Request: Split polygon Feature Request: split polygon on blade Oct 11, 2022
@RudyTheDev
Copy link
Contributor

I would like to strongly endorse this proposal (which I know has been proposed before over the years in various forms). But, as a user commonly doing this, I would like to explain the steps I have to take to perform this relatively simple-to-explain operation.

This is where we start:

1 - start

This is where we are going:

23 - done

Now, these are the steps I currently take in iD editor to do this:

  1. 2 - copy and remove tags - remove (and copy) the tags from the way (otherwise, it will get converted into a multipolygon)
  2. 3 - split 1 - split the way at the first corner
  3. 4 - disconnect 1 - disconnect the two new nodes
  4. 5 - split 2 - split on second
  5. 6 - disconnect 2 - disconnect on second
  6. 7 - add 3 - add a third corner/node
  7. 8 - split 3 - split on third
  8. 9 - disconnect 3 - disconnect on third
  9. 10 - add 4 - add the fourth corner
  10. 11 - split 4 - split on fourth
  11. 12 - disconnect 4 - disconnect on fourth
  12. 13 - select vestiges - select the two "vestigial" lines between the future geometries
  13. 14 - delete vestiges - delete them
  14. 15 - continue 1 - continue drawing from a corner on one of the new ways
  15. 16 - complete 1 - close it up
  16. 17 - continue 2 - continue the other
  17. 18 - complete 2 - close the other
  18. 19 - select cut ways - select whichever way got cut into 2 (because we are never lucky enough to pick a corner that is the start/end of the way)
  19. 20 - merge ways - merge the cut-up way into a single way
  20. 21 - select new ways - select the new ways
  21. 22 - paste tags - and reapply/paste the tags back on them

Ta-daa! Barely past 20 operations.

Now, this is one way I imagine I would do this with a dedicated operation:

  1. 2 - draw area - draw an area I wish to "remove" from my ways
  2. 3 - multiselect - select the area and the parent way (which would be optional for a smarter operation if there's just one "parent" way)
  3. 4 - cutout - perform a cutout operation, leaving two areas with the original tags (if the the drawn area also had tags, then it is also kept and connected)

This is from a user's perspective. I want a simple split/cutout operation. There are already tools to draw lines and areas. So, to me, it's only logical that I could produce a "negative" line or area somehow. I am sad every time I don't bother fixing areas because it takes too much effort for what should be as simple as cutting out/off an area/line. I don't expect JOSM-level of freedom, nor do I really want to - I'm okay to be told my area is not cut-off-able because I didn't draw it right or just undo a bad cut and try again.

I am not adding a lot of details here and leaving out a lot of things I would want to say and add. I think the most important point is to present the current use case and compare it to the user's proposed use case.

@tyrasd tyrasd added operation An editing operation / edit menu item enhancement An enhancement to make an existing feature even better labels Oct 13, 2022
@RudyTheDev
Copy link
Contributor

I went ahead and did some coding and here is the first result of my prototype:

Splice first try

Basically, if you draw a line between edges of an area (and select both for now), you can use a "splice" operation which will then split that area into two along the line.

@EvanCarroll
Copy link
Author

EvanCarroll commented Oct 13, 2022

That implementation looks great to me, and would totally work for my purposes, and save me lots of time. Thanks! Look forward to it landing.

@EvanCarroll
Copy link
Author

@RudyTheDev is there a chance this lands? Did submit your patch?

@RudyTheDev
Copy link
Contributor

@EvanCarroll Sorry, I've been super busy with work and such. My progress is at RudyTheDev/iD/splice_operation. There are a lot of small details to consider. I implemented it for single-way areas. I wanted to do polygons too, but it got complicated fast, so I haven't done that. I will probably submit the current version PR at some point.

@EvanCarroll
Copy link
Author

Awesome. No rush! Just please drop a message here if you can't get it done or decide to drop it. With that link, hopefully someone else can pick it up. I may take a look it at it myself, but it's really low on my pecking order now. Look forward to seeing it land.

@jnicho02
Copy link

jnicho02 commented Jan 3, 2023

+1 would love to see this feature added. It would make it a lot easier to make 2 * semi-detached houses from a single outline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement to make an existing feature even better operation An editing operation / edit menu item
Projects
None yet
Development

No branches or pull requests

4 participants