gbif / geocode

Geocode webservice and client
Apache License 2.0
4 stars 4 forks source link

Expose GADM level names and identifiers as part of the REST API #8

Open fmendezh opened 3 years ago

fmendezh commented 3 years ago

The GBIF Portal, and probably external services, need to query the catalog of GADM names and identifiers.

Initially, the following needs have been identified:

  1. Search a GADM name or identifier by a keyword, a prefix case insensitive match seems sufficient.
  2. List subsequent GADM levels of a level using a GADM name or identifier, examples:

The structure of the services listed above are only suggestions, this shouldn't be used as a design specification.

@MattBlissett can help with the SQL queries needed to support those services.

MattBlissett commented 3 years ago
SELECT gid_0, gid_1, gid_2, gid_3, name_0, name_1, name_2, name_3 FROM gadm3 ORDER BY gid_0, gid_1, gid_2, gid_3;

That is all the data, including places without subdivisions as far as level 3 (e.g. Antarctica has no divisions).

For the GIDs, a prefix search is correct. For names, I think a tokenized search is better, so "London" matches "Greater London" and "Congo" matches "Democratic Republic of the Congo" as well as "Republic of Congo".

We can add any indexes or special index columns that are required to PostgreSQL, I don't think we need ES or SOLR for this. Or, the webservice could just read in the values when it starts up.

fmendezh commented 3 years ago

We can add any indexes or special index columns that are required to PostgreSQL, I don't think we need ES or SOLR for this. Or, the webservice could just read in the values when it starts up.

I agree, this will be a backed by PostgresQL only

MattBlissett commented 3 years ago

We should also design the API bearing in mind other requested endpoints, like GeoJSON polygons, MVTs of layer polygons etc.

fmendezh commented 3 years ago

This branch contains an initial proposal for the functionalities described in this issue https://github.com/gbif/geocode/tree/gadm-search-8