JuliaGeo / GADM.jl

A Julia package for obtaining geographical data from the GADM dataset
https://gadm.org
MIT License
38 stars 4 forks source link

API discussion #26

Closed visr closed 4 years ago

visr commented 4 years ago

If I understand correctly, this API always returns a single geometry:

get("IND")
get("IND", "Uttar Pradesh")
get("IND", "Uttar Pradesh", "Lucknow")

For a lot of use cases this is no doubt very useful, but am I correct that this does not allow me to get all of India's admin 1 level polygons at once? I imaging it would be useful to specify the level. Although that would no longer always return a single geometry, so perhaps it would be better to put that in a separate function.

Related, what do you think about returning a table instead, using this functionality: https://yeesian.com/ArchGDAL.jl/dev/tables/ That way, the attributes, which often contain useful metadata, would be included as well.

I guess this could be two separate functions, one like get that returns a single geometry, and one that returns an entire layer as an ArchGDAL.Table?

juliohm commented 4 years ago

I like the idea of a separate function. Perhaps we could name it GADM.table(country, sugregions...) to return the table object as suggested.

juliohm commented 4 years ago

Also, notice that the GADM.get and GADM.coordinates were written in a way that they always return a MultiPolygon. Even if the original geometry is a Polygon. This is to facilitate consumption in user code.

The GADM.table proposal could return the original geometry in each line of the table without this post-processing step @zerefwayne.

zerefwayne commented 4 years ago

Implemented this in PR #27. Closing this. Thanks for the suggestion @visr. ArchGDAL.Table made the filtering easier! :smile: