LogBook


2025/07/21 [GADM-api]

Today I was working on the train without access to fast internet so I could not proceed with the linode setup. Instead I started sketching out ideas for next endpoint – reverse geocoding. I need to considered few options:

  1. User requests reverse geocoding for specific GADM level. This options will be easy to implement and will put less strain on the database since the endpoint doesn’t have to figure out what GADM level should be queried and returned
  2. Return value consist of all available GAMD levels for requested point or shape. This should be also relatively easy to implement but the database will need to perform 6 queries for every call.
  3. Return smallest available GADM level. For this option we don’t know ahead of the time what is the smallest available level. However we know that country level is available world wide. We also know that every level contains information about all parent level. This means that I could either start querying database sequentially from lowest (village) to highes (country) level and stop once I get the first result … or I could extends country table with information about smallest available level and then perform two queries – one to get the country and second query again lowest available level for this country.

I will consider pros and cons of these options in the following days.

Additionally I found interesting go libraries for future endeavors:
https://github.com/lukeroth/gdal – wrapper around GDAL
https://github.com/airbusgeo/godal – another wrapper around GDAL.
https://github.com/paulmach/orb/tree/master/geojson – GeoJson encoder/decoder for go. It will come usefull for validating GeoJson provided by users.