Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fmendezh opened this issue Aug 17, 2020 · 4 comments
Open

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

fmendezh opened this issue Aug 17, 2020 · 4 comments
Assignees

Comments

@fmendezh
Copy link
Contributor

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:
  • {[gadmLevelName/gadmLevelGid]}?q=&limit= list all sub-regions in that level
  • {[gadmLevelName/gadmLevelGid]}/{[gadmSubLevelName/gadmSubLevelGid]}/...?q=&limit= list all sub-regions in a subLevel
  • Both services above need a way to search elements may use an optional and case insensitive param q and result size can be limited using a limit parameter

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
Copy link
Member

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
Copy link
Contributor Author

fmendezh commented Aug 27, 2020

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
Copy link
Member

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

@fmendezh
Copy link
Contributor Author

fmendezh commented Sep 4, 2020

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

@fmendezh fmendezh mentioned this issue Sep 7, 2020
@fmendezh fmendezh self-assigned this Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants