-
Notifications
You must be signed in to change notification settings - Fork 4
GADM Mapping
This page provides an overview of the GADM (Global Administrative Areas) file and outlines how we can map its data to our domain model for the Region and Experience Tracking Service.
GADM is a spatial database of the world's administrative areas, such as countries, regions, and sub-regions. It contains boundary coordinates and other metadata for these areas.
The GADM data is available for download here: https://gadm.org/download_world.html
The World GADM data is available as either a geopackage or a geodatabase.
Useful links:
The GADM GeoPackage is a specialized SQLite database file that serves as a comprehensive source for geospatial data. It is an essential part of the Region Exploration Service, providing raw geographical data that is read-only and serves as a source of authoritative geographical knowledge.
The primary table, gadm_410
, contains multiple columns that capture different attributes of geographical entities.
- fid: Auto-incremented integer, serves as the primary key.
- geom: Geometry in the form of MULTIPOLYGON, captures the spatial characteristics.
- UID: Integer, a unique identifier.
- GID_0, GID_1, ..., GID_5: Text fields serving as geographical identifiers at different hierarchical levels.
- NAME_0, NAME_1, ..., NAME_5: Names of geographical entities at different levels.
- VARNAME_0, VARNAME_1, ..., VARNAME_4: Alternative names or variations.
- NL_NAME_1, NL_NAME_2, NL_NAME_3: Local names in native languages.
- ISO_1, HASC_1, ..., HASC_3, CC_1, ..., CC_5: Codes for regions at various levels.
- TYPE_1, ..., TYPE_5, ENGTYPE_1, ..., ENGTYPE_5: Descriptive types in native and English languages.
- VALIDFR_1, ..., VALIDFR_4: Validity periods for the different geographical levels.
- GOVERNEDBY, SOVEREIGN, DISPUTEDBY: Governing details and dispute information.
- REGION, VARREGION, COUNTRY, CONTINENT, SUBCONT: Geographical categorizations.
The table comes with a set of triggers for maintaining spatial indices and feature counts, which are essential for performance optimization during geospatial queries.
The hierarchy in the GADM GeoPackage is implicitly represented through the columns with different GID
and NAME
levels (GID_0, GID_1, ..., GID_5 and NAME_0, NAME_1, ..., NAME_5). Each row in the table can have identifiers at multiple levels, representing its position in the geographical hierarchy.
For example, a row with:
-
GID_0
as the country ID -
GID_1
as the state ID -
GID_2
as the county ID
indicates a hierarchical relationship where the county is part of the state, which is in turn part of the country.
The hierarchy in the GADM GeoPackage is implicitly represented through columns like GID_0
, GID_1
, ..., GID_5
and NAME_0
, NAME_1
, ..., NAME_5
. To illustrate this, consider the following example featuring regions within Albania:
-
GID_0: ALB, NAME_0: Albania
-
GID_1: ALB.1_1, NAME_1: Berat
- GID_2: ALB.1_1.1_1, NAME_2: Berat
- GID_2: ALB.1_1.2_1, NAME_2: Kuçovë
- GID_2: ALB.1_1.3_1, NAME_2: Skrapar
-
GID_1: ALB.2_1, NAME_1: Dibër
- GID_2: ALB.2_1.1_1, NAME_2: Bulqizë
- GID_2: ALB.2_1.2_1, NAME_2: Dibër
- GID_2: ALB.2_1.3_1, NAME_2: Mat
-
GID_1: ALB.1_1, NAME_1: Berat
Each row in the table can have identifiers at multiple levels, reflecting its position in the geographical hierarchy. For instance, a row with GID_2
as ALB.1_1.1_1 indicates that it represents the Berat region at the GID_2
level, which is part of the Berat region at the GID_1
level, and all are in turn part of Albania at the GID_0
level.
This hierarchical information can be invaluable for understanding the geographical context in various parts of the Region Exploration Service.
- Initialization: Used for initial populating of the Main Database with hierarchical and geographical information.
- Query Enrichment: For advanced queries requiring extra geographical context, the service can refer back to the GADM GeoPackage.
- Data Integrity: Serves as the reference point for any geographical data, ensuring consistency and reliability.
The GADM GeoPackage is read-only within the service and is only used as a source of data.
The Region Exploration Service utilizes two primary data sources:
- GADM GeoPackage: A read-only SQLite database containing comprehensive geospatial data, including geometries, different names for regions, and disrupted areas.
- Main Database: The operational database used for managing the service, explicitly hierarchical and designed for read-write operations.
These databases coexist in a complementary fashion, with the Main Database serving operational needs and the GADM GeoPackage acting as an authoritative source of geographical knowledge.
- Initialization: The Main Database is initialized using data from the GADM GeoPackage. This includes creating hierarchical relationships between regions, in contrast to the non-hierarchical nature of GADM.
- References: Each entry in the Main Database contains a reference to its corresponding original region in the GADM GeoPackage. This enables traceability and ensures that the source of each piece of information is clear.
-
GADM GeoPackage:
- Read-Only: Never modified during the service operation.
- Source of Knowledge: Provides extra information like alternative names for regions, disrupted areas, and precise geometries.
-
Main Database:
- Read-Write: Actively used for all CRUD operations in the service.
- Hierarchical: Designed to represent regions in a hierarchical fashion, useful for features like nested queries and aggregations.
- Querying: For most operational queries, the Main Database is used. However, for advanced queries requiring additional geographic context, the service can refer back to the GADM GeoPackage.
The content of this wiki is licensed under a Creative Commons Attribution-NonCommercial (CC BY-NC) License.