-
Notifications
You must be signed in to change notification settings - Fork 150
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
v.rast.move: Move points by values from raster map #877
Conversation
WIP code for move of vector features positions by X and Y values given in two raster maps. This can move linear features without breaking the visual connection as points falling into the same raster cell are shifted by the same value. Alternative name would be v.rast.move because the big deal is that it is using raster to do the moving. The one example included now shows the principle, moves in X direction both ways depending on the raster values. My use case is randomizing a set of lines (connected and not connected). Feedback welcome.
…rtant role and it now moves vertices (points) of lines, not points.
…nt null check is needed).
I renamed the module from v.move.points to v.rast.move because it moves vector using raster values (operates on vectors but the big deal is that it is using raster to do the moving). Tests are included, use pytest, and run locally. Example in the documentation is included, image is generated by a notebook. Pylint mostly passes locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it works on lines only? What happens with areas or points? Consider documenting and adding a check.
Right, it works only for lines. Other types would be a reasonable extension. Points are easy to do without this tool. I added a check which ignore other types and explained the behavior in the documentation. I also added a test which tests for this behavior. |
Move of vector features positions by X and Y values given in two raster maps. This can move linear features without breaking the visual connection as points falling into the same raster cell are shifted by the same value. The name is v.rast.move because it moves vector using raster values (operates on vectors but the big deal is that it is using raster to do the moving). Alternative name would be v.rast.displacement. Original name was v.move.points. The one example included now shows the principle, moves in X direction both ways depending on the raster values. My use case is randomizing a set of lines (connected and not connected). Unlike v.perturb which moves points randomly, this works on lines and keeps the values at a given cell. Unlike v.transform combined with raster values in attribute columns, this operates on individual points in the line, not on the whole line. Copies first category, assumes layer 1. Drops attributes. Handles null values and extent mismatch. Warns about the nulls by default. Warns when integers are used (different null check is needed but not implemented).
Move of vector features positions by X and Y values given in two raster maps. This can move linear features without breaking the visual connection as points falling into the same raster cell are shifted by the same value.
The name is v.rast.move because it moves vector using raster values (operates on vectors but the big deal is that it is using raster to do the moving). Alternative name would be v.rast.displacement. Original name was v.move.points.
The one example included now shows the principle, moves in X direction both ways depending on the raster values. My use case is randomizing a set of lines (connected and not connected).
Unlike v.perturb which moves points randomly, this works on lines and keeps the values at a given cell. Unlike v.transform combined with raster values in attribute columns, this operates on individual points in the line, not on the whole line.
Copies first category, assumes layer 1. Drops attributes.
Handles null values and extent mismatch. Warns about the nulls by default. Warns when integers are used (different null check is needed but not implemented).