Giter VIP home page Giter VIP logo

Comments (9)

sahrk avatar sahrk commented on May 22, 2024

285.9940373051 is the same longitude as -74.0060. h3ToGeo gives longitude values in the range 0-360 degrees.

from h3.

travisbrady avatar travisbrady commented on May 22, 2024

Ahh, I see. Still somewhat confusing to me as I'd typically expect ThingToInt(IntToThing(blah)) == blah.

Does H3 provide any docs or functions for these sorts of conversions? I think many people often use latitudes in the range -180 to 180, so this kind of thing would tend (I'd think) to confuse other users too. But I'll close for now.

from h3.

dfellis avatar dfellis commented on May 22, 2024

I will note that the bindings (that haven't been released, yet, hi again @isaacbrodsky :) ) do convert back to -180 -> 180 (and -90 -> 90 for latitude) because that's what people tend to expect. I don't recall why we haven't pushed this down to the C code, but I do know it will cause some churn with the test suite.

from h3.

travisbrady avatar travisbrady commented on May 22, 2024

@dfellis good to know as I'm currently writing some bindings of my own (in OCaml). I expect to have them on github in the next week or so.

from h3.

isaacbrodsky avatar isaacbrodsky commented on May 22, 2024

I'm OK with changing the C library/applications/examples to return negative angles, since that's what the bindings do anyways. (hi @dfellis :) ) Or, we should add this to the bindings documentation.

@travisbrady Please feel free to open a PR to add your bindings to the bindings list when you feel they're ready.

from h3.

nrabinowitz avatar nrabinowitz commented on May 22, 2024

I'd support updating the C lib here. I think it subverts user expectations, and agree with @travisbrady's point that it breaks assumptions about round-trip stability.

from h3.

sahrk avatar sahrk commented on May 22, 2024

I should point-out that, unless you limit geoToH3 to only accept longitudes in the range +/-180 (which I don't recommend), then geoToH3/h3ToGeo can't be completely round-trip stable, in the sense that the user will necessarily get back their input longitude value in the original input range.

from h3.

nrabinowitz avatar nrabinowitz commented on May 22, 2024

from h3.

gacafe avatar gacafe commented on May 22, 2024

Resolved this generally... the input was incorrect (130 is not a lat), but bit concerning that the two libraries give different results for the same input.
There is a problem still.
Using the example, I expect h3_to_geo(geo_to_h3(lat,lon), resolution) to return the original lat,lon input, or something quite nearby... If I use the example, this is true, but if I do it in Australia, its not true -- the [-180,180] bounds are respected but the answer is shifted by 180:

11:37 AM gacafe ∈ h3 (master) ./bin/geoToH3 -r 15
130.90938479800002 -12.365644588
8f16c6d624a25a8
11:38 AM gacafe ∈ h3 (master) ./bin/h3ToGeo      
8f16c6d624a25a8
49.0906178199 167.6343623402

Using the Python library --

>>> h3_address = h3.geo_to_h3(37.3615593, -122.0553238, 15)
>>> hex_center_coordinates = h3.h3_to_geo(h3_address)
>>> hex_center_coordinates
[37.36156313952111, -122.05532505846305]
>>> h3_address = h3.geo_to_h3(130.90938479800002, -12.365644588,15)
>>> hex_center_coordinates = h3.h3_to_geo(h3_address)
>>> hex_center_coordinates
[-49.09061440581596, -12.36565153299568]

from h3.

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.