-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(custom-pu-grid): custom pu grid geometry #525
Conversation
This pull request is being automatically deployed with Vercel (learn more). marxan – ./app🔍 Inspect: https://vercel.com/vizzuality1/marxan/DahoHLajqxJDvDcD5WsMz8csogW9 marxan-storybook – ./app🔍 Inspect: https://vercel.com/vizzuality1/marxan-storybook/HW8MPLgX6VRKYVJDFPyG8ZDEhEsB |
cf7f3a4
to
eeb1c5c
Compare
865bc7d
to
960b192
Compare
960b192
to
159b8d3
Compare
159b8d3
to
18bd3bd
Compare
18bd3bd
to
7db80ea
Compare
7db80ea
to
d48fbed
Compare
d48fbed
to
5a77099
Compare
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.
In terms of validation, it is part of the characteristic of a grid that their members are adjacent geometries. in order to validate it, they should not intersect with each other, but every single geometry should be intouch (connected) with at least one. If we want to do that validation with javascript, i think turf will allow you to intersect and check if the result is a line in order to ensure that they only share borders.
FROM ( | ||
SELECT json_array_elements($1::json -> 'features') AS features | ||
) AS f | ||
ON CONFLICT ON CONSTRAINT planning_units_geom_the_geom_type_key DO UPDATE SET type = 'irregular' |
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.
type
should be inputted from the FE
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.
Well, it's a pity we haven't mentioned this in requirements.
Are we sure this makes sense? Allowing user to provide whatever shape they want and marking the as "hex" (which isn't correct, right?) may lead system to produce unexpected results.
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.
The user will upload their custom planning grid, which could be a regular (square, hexagon, triangles...) or an irregular one( whatever continuos group of geometries that can represent basins, parcels...).
For those regulars, the main difference with the ones we create is related to the grid upper left corner origin. If we want to be agnostic to the type we can make use of the same categorization in the enum planning_unit_grid_shape and mark them as from_shapefile.
But marking it as irregular is just wrong. What do you think?
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.
@aagm I think following #526 (comment) at this very moment would be fine. (in future we can make the validation/checks also instead asking for a type, we will need to verify it anyway so we can also deduce it, right?) Nevertheless, as long as it isn't that much concern for this moment, from_shapefile
sounds fair enough for current state.
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.
updated in 0503960
Can we validate this assumption with postgis? would https://postgis.net/docs/ST_IsSimple.html be fair enough (not sure about mentioned tangency) - checked, seems like not, as touching edges make it "invalid" https://postgis.net/docs/postgis_usage.html#eval_spatial_rel |
0503960
to
7b06b6a
Compare
7b06b6a
to
dc0a632
Compare
dc0a632
to
1e3dbd2
Compare
1e3dbd2
to
b8af1e2
Compare
api/apps/geoprocessing/src/modules/planning-units-grid/planning-units-grid.processor.ts
Show resolved
Hide resolved
not something I have much experience with, but I would be surprised if this wasn't the case, and it would be much more preferable than doing this at the API layer. We can deal with this in a separate validation story, if effectively needed. |
planning_unit_grid_shape
- feat(custom-pu-grid): set project grid shape once geometries were set #529