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

converter: Add option to calculate area and perimeter if missing #21

Open
m-mohr opened this issue Apr 11, 2024 · 3 comments
Open

converter: Add option to calculate area and perimeter if missing #21

m-mohr opened this issue Apr 11, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@m-mohr
Copy link
Contributor

m-mohr commented Apr 11, 2024

No description provided.

@m-mohr
Copy link
Contributor Author

m-mohr commented May 6, 2024

@cholmes wrote in #38:

When working with the converter I was thinking that area and perimeter should be pretty easy to calculate from the geometry.

It seems like you could potentially do them with geopandas, maybe fitting into the template? But it could also be nice to just have them be top-level 'convert' options, to just automatically add them based on the geometry.

See also - fiboa/specification#28 (comment) could be nice to have the validator check this as well.

Validator check issue: #10

@m-mohr
Copy link
Contributor Author

m-mohr commented Jun 12, 2024

At first I also thought this is easy and shapely already has the length and area properties, but they are unitless. Here it depends on the projection though, e.g. the area might also be given in square degrees insteasd of square meters, you need to consider holes, and sometime you even get negative areas. So we may convert to WGS84 for the area, but is that always good? It will be somewhat inaccurate compared to the native CRS (and pyproj is quite a heavy dependency).

See also https://stackoverflow.com/questions/23697374/calculate-polygon-area-in-planar-units-e-g-square-meters-in-shapely

@cholmes
Copy link
Contributor

cholmes commented Jun 20, 2024

Oh yeah, I remember hitting on some of the inaccuracies of area calculations with different projections when I was working with google buildings. Ended up with this code - you need to project to something better to calculate the area.

Just came across: https://gis.stackexchange.com/questions/337035/epsg-codes-for-projections-to-use-when-computing-the-area-of-global-polygon-sets which I appreciate and don't remember at the time.

I do think it'd be nice to give some option that's opt-in, that may have some caveats. But first key step seems to be to have the validator be good at checking this - since having the area calculated wrong may be a problem with other data.

@m-mohr m-mohr removed their assignment Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants