uber / h3

Hexagonal hierarchical geospatial indexing system
https://h3geo.org
Apache License 2.0
4.83k stars 459 forks source link

Hex (cell) ID validation #776

Closed Portur closed 1 year ago

Portur commented 1 year ago

Hi,

I need to define what a valid h3 index looks like before touching the library. Ideally I'm looking for a javascript function approach like isValidID('8ff....').

The purpose is simply to validate the string value within the bounds of h3. From my understanding, using the existing isValidCell function would provide valid way to test this, however this would need the library.

Is there an approach to this without the library?

something like

function isValidHexID(string){
   return string.match(\...\)
}

Thanks

Portur commented 1 year ago

Related https://github.com/uber/h3-js/issues/79

nrabinowitz commented 1 year ago

There are a couple of levels you could check here, but I don't think you want to fully validate without the library.

Portur commented 1 year ago

Thank you very much for the explanation.

I think then I'm going to rely on the library to be safe.

Have a great day.