0

I'd like to be able to query a PostGIS table with a lnglat and have it return a four letter.

The point [180, 90] should return AAAA, and the point [-180, -90] should return ZZZZ.

Kind of like this: https://map.what3words.com/soon.escalator.minimalists

Maybe this is just a simple fishnet grid? Is that the right way to make this?

I would like the grid to be accurate to the tenths or hundredths column of latitude. It doesn't have to be a square grid.

Cities can have multiple codes but each city should have a unique code.

edit: I realize that 26^4 might not be enough to cover the whole earth with the accuracy that I desire. So I'm thinking since most of the earth is water we could do something like this:

http://blog.cleverelephant.ca/2018/06/polygon-splitting.html

maybe this isn't possible with four letters, but six letters it should be doable if we ignore ocean (361800000 sqkm / 26 / 26 / 26 / 26 / 26 / 26) right?

6
  • 1
    Why not use the IATA Codes? nationsonline.org/oneworld/IATA_Codes/airport_code_list.htm
    – Mapperz
    Jan 28, 2019 at 4:36
  • not every city has an airport. that's the main reason. I'm actually using IATA as a key for airport cities, my use case of this four letter identifier is specifically for rural cities.
    – jaksco
    Jan 28, 2019 at 5:14
  • Have you considered plus codes?
    – user2856
    Jan 28, 2019 at 7:25
  • ah. I've seen plus codes before but I didn't like how long they were. I didn't realize you can shorten them to just 6 or 8 characters so this is acceptable. I think I'll just use plus codes then :)
    – jaksco
    Jan 28, 2019 at 7:44
  • 1
    How about geohashing, just to add my $0.02, postgis.net/docs/ST_GeoHash.html. Then, there is what3words.com. So, there probably is no correct way of doing this, but, the the techniques of spatial partioning, with longer and longer strings for greater degrees of accuracy, are well understood. Jan 28, 2019 at 11:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.