GithubHelp home page GithubHelp logo

geodataframe_to_cells issue about h3ronpy HOT 7 CLOSED

diehl avatar diehl commented on July 28, 2024
geodataframe_to_cells issue

from h3ronpy.

Comments (7)

diehl avatar diehl commented on July 28, 2024 1

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.

nmandery avatar nmandery commented on July 28, 2024 1

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.

nmandery avatar nmandery commented on July 28, 2024 1

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.

nmandery avatar nmandery commented on July 28, 2024

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.

diehl avatar diehl commented on July 28, 2024

@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.

diehl avatar diehl commented on July 28, 2024

@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.

diehl avatar diehl commented on July 28, 2024

No worries @nmandery - I'm investigating other options in the meantime.

from h3ronpy.

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.