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

create a 'divide' operation #9020

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

k-yle
Copy link
Collaborator

@k-yle k-yle commented Mar 8, 2022

This PR creates a "divide" operation, similar to the JOSM gridify plugin. It lets you divide an area into a grid of smaller areas. This is useful for mapping parking spaces, terraced houses, and camp pitches.

You can try it out here. Select an area and press K.

Closes #6988

divide2.mov
More Examples image
house1 house2
camp1 camp2

@1ec5
Copy link
Collaborator

1ec5 commented Mar 8, 2022

Nifty, this will tempt me to start nanomapping the individual modules of solar panels. 😉

I wonder if it would be possible to replace the two prompts with something more interactive. Perhaps you hit the shortcut key, then move the mouse along the long and short axes to control the number of divisions. It’d be similar to how you can scrub the mouse cursor while rotating a feature, except that this gesture would snap to widths that evenly divide the area. For things like parking spaces, it’d be more convenient to eyeball the right width than to count the divisions manually.

Since this operation is only useful for a small number of features it should possibly be hidden by default?

If we expect this operation to be used somewhat less frequently than, say, the merge operation, how about keeping it available in the context menu for all areas but avoid assigning a keyboard shortcut? It’s becoming ever more difficult to assign memorable single-key shortcuts without modifiers, especially in locales that translate them. Currently, operations’ availability depends on the selected geometry type, but it would be more difficult to communicate to the user that this operation depends on certain tags.

@k-yle
Copy link
Collaborator Author

k-yle commented Mar 8, 2022

If we expect this operation to be used somewhat less frequently than, say, the merge operation, how about keeping it available in the context menu for all areas but avoid assigning a keyboard shortcut?

That's a good idea - my concern was also that it will clutter the context menu, which already has 8 items, but maybe that's not a problem...

I wonder if it would be possible to replace the two prompts with something more interactive.
Perhaps you hit the shortcut key, then move the mouse along the long and short axes to control the number of divisions.

👍 I'll give this some thought, another option could be to replace the two prompts with a modal. That modal could have a preview similar to the turn-restriction editor. Both options will be quite complicated.

@kymckay
Copy link
Collaborator

kymckay commented Mar 8, 2022

Probably out of scope for this PR, but may be worth considering as a follow up: Would be nice if this supported use of custom dividing line (something like: draw way across area, select both, perform divide operation). Useful for things like drawing a footprint and splitting into non-uniform buildings or building parts, or splitting land use to re-tag a section.

@1ec5
Copy link
Collaborator

1ec5 commented Mar 8, 2022

Would be nice if this supported use of custom dividing line (something like: draw way across area, select both, perform divide operation). Useful for things like drawing a footprint and splitting into non-uniform buildings or building parts, or splitting land use to re-tag a section.

Vector drawing tools have a similar operation. It isn’t the most discoverable, but it makes a lot of sense once you’re made aware of it, similar to how iD supports punching holes in polygons using the merge operation. In that case, you could even hook it up to the split operation, so you can select an area and a line that cuts across it, but don’t select a vertex, then split the area along the line. It would be quite outside the scope of this PR, but it might be worth considering how to make the UX for this feature consistent with what might be possible for that other feature.

@RedAuburn
Copy link

This is looking superb! It'd be nice if it could split based on the bbox instead of the actual nodes, but that can be implemented after this :)

A case where splitting with bbox would be useful:
Screenshot 2022-04-01 at 21 26 57

Copy link
Member

@tyrasd tyrasd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the following issues / corner cases while playing around with it:

  1. if the input geometry is concave, the result will have intersecting and/or self-intersecting geometries:
  2. when applied to an area which shares an edge with a neighboring area (or touching line), the neighboring (or touching) feature does not receive a vertex at the newly introduced split position (which potentially also results in a validator warning messages about intersecting geometries)
    image

In general, I would be slightly more inclined to add support "divide operation" which is more flexible, as outlined in #9020 (comment), rather than specialized operation which only properly works in a narrow set of use cases.

@tyrasd tyrasd marked this pull request as draft July 21, 2022 10:41
@tyrasd tyrasd added operation An editing operation / edit menu item enhancement An enhancement to make an existing feature even better labels Jul 21, 2022
@danieldegroot2
Copy link
Contributor

It would be nice if we could also do this with ways, for if we know there's windows/doors or extensions along a building wall.

@1ec5 1ec5 mentioned this pull request Aug 24, 2022
@xnousnow
Copy link

xnousnow commented Feb 6, 2024

It's been 2 years... anything going on?

@tordans
Copy link
Collaborator

tordans commented Feb 22, 2025

Looking at the initial video, I wonder...

  • could the map be displayed in the modal for reference
  • would it be helpful to see the area size and or length of the rectangle somewhere for reference? Like with the parking spaces, any of the last two divisions look OK, but which one is right...
  • does the modal create one entry in the history or one per rectangle? Ideally it where possible to revert the division with just one cmd-z to try again with different settings.

@k-yle k-yle marked this pull request as ready for review February 25, 2025 08:46
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

Successfully merging this pull request may close these issues.

Split building into 2 identical connected buildings
8 participants