-
Notifications
You must be signed in to change notification settings - Fork 127
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
h3shape_to_cells | reversed coordinates return empty list #366
Comments
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 |
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 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) |
Also, see the comments in https://gist.github.com/rmania/8c88377a5c902dfbc134795a7af538d8 for some potentially faster methods using WKT. |
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! |
When reading data with Geopandas the coords are flipped.
This does not give any errors and just gives back empty results.
Repro
This works when you reverse the coords
The text was updated successfully, but these errors were encountered: