Comments (7)
Hi @nmandery - let me work on getting you a specific example. Just wanted to check in first to see if you found this similarly perplexing given the intent of the code.
from h3ronpy.
Thank you. I just converted this geometry to H3 using only h3o
using
use geo_types::GeometryCollection;
use geojson::{quick_collection, GeoJson};
use h3o::geom::{ContainmentMode, PolyfillConfig, ToCells};
use h3o::Resolution;
fn main() {
let gj = include_str!("../example_df.geojson");
let geojson: GeoJson = gj.parse::<GeoJson>().unwrap();
let collection: GeometryCollection<f64> = quick_collection(&geojson).unwrap();
let h3o_geom = h3o::geom::Geometry::from_degrees(collection.0[0].clone()).unwrap();
for res in Resolution::range(Resolution::Four, Resolution::Twelve) {
let cells: Vec<_> = h3o_geom
.to_cells(
PolyfillConfig::new(res).containment_mode(ContainmentMode::IntersectsBoundary),
)
.collect();
println!("r={} -> num cells={}", res, cells.len());
}
}
This resulted in
r=4 -> num cells=0
r=5 -> num cells=0
r=6 -> num cells=0
r=7 -> num cells=0
r=8 -> num cells=2
r=9 -> num cells=3
r=10 -> num cells=4
r=11 -> num cells=13
r=12 -> num cells=54
So this is the same behavior as h3ronpy.
Without inspecting the geometries, I suppose the variant that the geometry is completely within the cell is not covered by IntersectsBoundary
. Now that I look at this again, this is also how I read the modes description at https://docs.rs/h3o/latest/h3o/geom/enum.ContainmentMode.html .
Seems I need to bring back some parts of nmandery/h3arrow@f5c46c0 as some kind of fourth polyfill mode.
from h3ronpy.
Just to keep this issue updated: I am currently really low on spare time to further look into this, I will try to come back to this as soon as possible.
from h3ronpy.
Hi. That sounds suspicious - there should indeed be always at least one cell.
What would be this threshold? It is reproducible with a single geometry, or only with large dataframes?
from h3ronpy.
@nmandery Here's an example dataframe I'm having an issue with, represented in geojson.
When I execute
geodataframe_to_cells(df, 4, containment_mode=ContainmentMode.IntersectsBoundary)
I'm getting back an empty dataframe. When I increase the resolution from 4 to 11, I see results.
from h3ronpy.
@nmandery Strange. Glad we caught this. Since h3-py
does not offer the capability to compute a complete H3 cover, getting this right will be a significant contribution.
from h3ronpy.
No worries @nmandery - I'm investigating other options in the meantime.
from h3ronpy.
Related Issues (20)
- h3ronpy : python 3.7 build issue HOT 2
- Raster_to_geodataframe Plotting inconsistent Hex Resolution HOT 3
- Build docs on readthedocs
- Conversion from ndarray to h3 DataFrame throws unspecified error in h3ron.h3ron HOT 3
- Build wheels for more architectures
- cells_parse fails due to unexpected array type when using polars
- Points aren't properly parsed into H3 cells HOT 4
- Import failure on M1 MacBook Pro HOT 6
- Question: Best way to convert Polars series of Lat/Lng to H3 cells HOT 5
- integration with the `polars` api HOT 6
- implement `vertexes_parse` and `directededges_parse`
- Create `change_resolution_list` function
- Illegal instruction (core dumped) on Ubuntu HOT 2
- ArrowIndexError: Negative buffer slice length HOT 10
- Question: Lazy coordinates_to_cells HOT 3
- Move to official arrow bindings
- h3 library version 3.7, is there a plan to update for version 4.0? HOT 1
- Bounds check fail for global raster HOT 3
- local ij - methods request HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h3ronpy.