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

Support specifying coordinate reference system (CRS) of geometries #1339

Merged
merged 11 commits into from
Apr 4, 2024
Merged

Conversation

Hofer-Julian
Copy link
Contributor

@Hofer-Julian Hofer-Julian commented Mar 29, 2024

Fixes #1254

Breaking changes:

  • Adds new required TOML key "crs"
  • Adds new required Model parameter "crs" in Ribasim-Python.

Note: we could avoid adding the TOML key by requiring Model.read to take crs as parameter. Not sure if that's an improvement though.

Upgrade instructions

Specify the CRS. For instance for WGS 84 latitude longitude, use crs = "EPSG:4326", for the Netherlands use crs = "EPSG:28992".

Fixes #1254

Breaking changes:
- Adds new required TOML key "crs"
- Adds new required `Model` parameter "crs"
@Hofer-Julian Hofer-Julian changed the title Crs Support specifying coordinate reference system (CRS) of geometries Mar 29, 2024
Copy link
Member

@visr visr left a comment

Choose a reason for hiding this comment

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

Yes I think adding the TOML key is fine. I added some commits. Notably a test that "Basin / area" also gets the CRS, but that fails, so I think that still needs to be fixed.

If it is hard to fix it is fine as-is, but currently the Node tables only gets a CRS when it is assembled by node_table(). That means if you just want the GeoDataframe of the Basin nodes with model.basin.node you get a GeoDataframe with no CRS set.

@Hofer-Julian
Copy link
Contributor Author

If it is hard to fix it is fine as-is, but currently the Node tables only gets a CRS when it is assembled by node_table(). That means if you just want the GeoDataframe of the Basin nodes with model.basin.node you get a GeoDataframe with no CRS set.

Yeah, I don't know how that would be done. When we run model.basin.add, we don't have access to the model state and therefore no access to the crs.

@visr
Copy link
Member

visr commented Mar 31, 2024

Would it make sense to define model.set_crs() that sets the CRS of all spatial tables? Then we can call that on save, but also earlier if needed.

@Huite
Copy link
Contributor

Huite commented Mar 31, 2024

Indeed. As I mentioned in #1254, I would probably implement both set_crs (to just assign a crs) and to_crs (to reproject).

@Hofer-Julian
Copy link
Contributor Author

Would it make sense to define model.set_crs() that sets the CRS of all spatial tables? Then we can call that on save, but also earlier if needed.

Sounds good to me.

@Hofer-Julian Hofer-Julian requested a review from evetion April 4, 2024 11:46
python/ribasim/ribasim/model.py Outdated Show resolved Hide resolved
python/ribasim/ribasim/model.py Show resolved Hide resolved
python/ribasim/ribasim/model.py Show resolved Hide resolved
core/src/config.jl Show resolved Hide resolved
core/test/docs.toml Show resolved Hide resolved
python/ribasim/ribasim/model.py Show resolved Hide resolved
@evetion evetion merged commit 92b2706 into main Apr 4, 2024
26 of 44 checks passed
@evetion evetion deleted the crs branch April 4, 2024 14:55
@visr visr added the breaking A change that breaks existing models label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A change that breaks existing models
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support specifying coordinate reference system (CRS) of geometries
4 participants