uber / uber/h3

Coordinates input validation

Open
#388 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
6.5k
Forks
627
Avg merge
3d 21h
Merged PRs (30d)
6

Description

Hello,

We're using the h3_pg postgres bindings and together with @trylinka found that we're spending quite a bit of time debugging the same kind of issue: we've got a point table in spherical mercator coordinates in metres, we want to bin it using H3, we do it and get some garbage as an output. Fix is to convert the input into longitude-latitude degrees, but finding the spot takes some time, together with time for understanding that the output is garbage.

A simple way to avoid this will be to check the ranges for latitude and longitude on the input. @trylinka provided a PR with the check for h3_pg (https://github.com/bytesandbrains/h3-pg/pull/41), but as I see @zachasme does not want to diverge from the core H3 library too much in the behavior, which leads to this ticket.

It seems it will be beneficial to others to have a kind of input validation. As I see in #287 there was some effort to make all the values work somehow. I will say that I have not seen the real long-lat dataset that has values outside [-180,-90,180,90] box. On a safe side, even a check on latitude being in -90..90 will save some hours debugging.

Will such a PR be welcome (-90..90 latitude validation, or a stricter check), or is there a higher ideological reason to keep things as they are?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the validation proposal in h3-pg PR #41 and the prior discussion in issue #287, then compare them with the core H3 coordinate-handling behavior. Done means the project has an agreed latitude/longitude validation policy that addresses invalid spherical Mercator inputs without an unresolved divergence from the core library.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.