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

Closed
m-mohr opened this issue Apr 11, 2024 · 4 comments · Fixed by #114
Closed

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

m-mohr opened this issue Apr 11, 2024 · 4 comments · Fixed by #114
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 m-mohr moved this from Backlog to Todo in fiboa Jun 12, 2024
@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
@m-mohr m-mohr moved this from Todo to Backlog in fiboa Aug 24, 2024
m-mohr added a commit that referenced this issue Nov 13, 2024
@m-mohr m-mohr moved this from Backlog to Review in fiboa Nov 13, 2024
m-mohr added a commit that referenced this issue Nov 13, 2024
@m-mohr
Copy link
Contributor Author

m-mohr commented Nov 13, 2024

PR: #114

@m-mohr m-mohr linked a pull request Nov 13, 2024 that will close this issue
m-mohr added a commit that referenced this issue Nov 15, 2024
* Add fiboa improve command #79 #21

* Write custom schemas to fiboa metadata for use in improve/merge/etc. #113 and minor fixes

* Make geometries valid and explode to Polygons by default #119

* Explode polygons option for improve command

* Add minimal test

* Fix pick_schemas
@github-project-automation github-project-automation bot moved this from Review to Done in fiboa Nov 15, 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: Done
Development

Successfully merging a pull request may close this issue.

2 participants