Giter Site home page Giter Site logo

Comments (8)

smmaurer avatar smmaurer commented on June 19, 2024 2

Interesting, thanks for reporting this @blakerosenthal!

I'm not very familiar with the codebase, but this is happening inside a function called osmnet.load.project_gdf() -- docstring here.

Looks like the function is used internally, to project a lat-lon bounding box into the UTM zone of its centroid in order to calculate the area and potentially subdivide it into smaller units for the data download query in osmnet.load.osm_net_download(). The code we need to fix catches input that's already in a UTM projection, and returns it without doing anything.

I'm thinking we have a couple of options here:

  1. Update the code so it can detect UTM projections using either the old or new gdf.crs format.

  2. Get rid of the check entirely -- i.e., remove lines load.py#L487-L490.

Option 2 seems appealing. (a) It's simpler. (b) The computational cost is minimal: we might end up calculating the centroid of a unary union without needing to. (c) It's actually closer to the behavior described in the function's docstring -- which says the input will be projected to the UTM zone of its centroid, without mentioning that gdf's already in a UTM projection will be returned untouched.

Thoughts, @sablanchard?

And some additional info about the Geopandas change, courtesy of @PyMap: https://jorisvandenbossche.github.io/blog/2020/02/11/geopandas-pyproj-crs/

from osmnet.

snowman2 avatar snowman2 commented on June 19, 2024 2

I think that a property on the pyproj CRS class that essentially does is_utm would be useful. I will add it to the list for the 2.6 release.

from osmnet.

knaaptime avatar knaaptime commented on June 19, 2024

the version of this function in osmnx has been updated and could be used as a reference for updating this one :)

from osmnet.

knaaptime avatar knaaptime commented on June 19, 2024

in the interest of a speedy fix, I could do a PR that copies over the updated function from osmnx, if folks are ok with that?

with that said, though, this function is super handy and applicable to a lot of workflows (we also use it in both segregation and tobler, for example). Would there be benefit into putting it somewhere slightly more centralized? I'm not sure if geopandas or pyproj would be interested, but libpysal could also be an option.

Originally, we were importing it from osmnx, but that added a relatively heavy dependency for only a single function (i.e. it caused some networkx headaches elsewhere). But if folks want to use this in lots of places, it might benefit from a single shared implementation

@gboeing @jorisvandenbossche @ljwolf @snowman2

from osmnet.

snowman2 avatar snowman2 commented on June 19, 2024

pyproj4/pyproj#562

from osmnet.

smmaurer avatar smmaurer commented on June 19, 2024

This all sounds great!

Yes, @knaaptime, if you'd be interested in implementing a quick fix to OSMNet, I'll get it merged and released. I just set up a clean dev branch, which you can use as the target for the PR.

I was talking about this offline with @sablanchard, and his inclination is to retain the same behavior as OSMNx and return the GeoDataFrame untouched if it's already in a UTM projection. Let's mention this in the docstring, though. And I gather from OSMNx that one of the rationales for this is that the zone calculation isn't appropriate for polar latitudes.

Thanks all!

from osmnet.

smmaurer avatar smmaurer commented on June 19, 2024

Fixed in PR #21 and released in PR #22/#23 v0.1.6.

from osmnet.

snowman2 avatar snowman2 commented on June 19, 2024

This is likely helpful as well: https://geopandas.org/docs/reference/api/geopandas.GeoSeries.estimate_utm_crs.html

from osmnet.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.