Git Product home page Git Product logo

Comments (4)

ajfriend avatar ajfriend commented on June 12, 2024 1

Thanks for the issue! Feedback like this is super helpful for me to think through pain points in the API and how we can smooth it out.

Honestly, I was hoping for more of these before releasing the final v4.0. So if you have any more, please do keep them coming!

I'll take a look at this and #365

from h3-py.

ajfriend avatar ajfriend commented on June 12, 2024 1

This should be fixed with https://github.com/uber/h3-py/releases/tag/v4.0.0b5, so I'll close this. Please let me know if you have any issues!

from h3-py.

ajfriend avatar ajfriend commented on June 12, 2024

I think the main issue here is that we don't handle the z-coordinate if it is present: #368

Also, you're having to reverse the coordinates because GeoPandas and GeoJSON use lng/lat coordinate order, while H3 is expecting lat/lng coordinate order. But ideally, we should just handle that translation automatically for you with functions like h3.geo_to_h3shape().

Once we implement #368, your code should be just:

usa = gpd.read_file('https://raw.githubusercontent.com/scdoshi/us-geojson/master/geojson/nation/US.geojson')
usa = usa.geometry[0]
shape = h3.geo_to_h3shape(usa)

However, in the meantime until #368, you can remove the z coordinate manually:

usa = gpd.read_file('https://raw.githubusercontent.com/scdoshi/us-geojson/master/geojson/nation/US.geojson')
usa = usa.geometry[0]

from shapely.ops import transform
def to_2d(x,y,z):
    return x,y
usa = transform(to_2d, usa)

shape = h3.geo_to_h3shape(usa)

from h3-py.

ajfriend avatar ajfriend commented on June 12, 2024

Also, see the comments in https://gist.github.com/rmania/8c88377a5c902dfbc134795a7af538d8 for some potentially faster methods using WKT.

from h3-py.

Related Issues (20)

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.