Skip to content

Add support for querying by ISO3 code #62

@dfguerrerom

Description

@dfguerrerom

Add support for querying by ISO3 code

Is your feature request related to a problem?.

GAUL administrative codes are not stable across dataset versions. For example, Holy See (Vatican City) changed from code 110 in GAUL 2015 to code 307 in GAUL 2024. This causes breaking changes for applications that store or reference areas by their GAUL codes.

When we upgraded from pygaul 0.3.x (GAUL 2015) to pygaul 0.4.x (GAUL 2024), all our stored admin codes became invalid, requiring manual migration of user data and test fixtures.

Describe the solution you'd like

Add an iso3 parameter to pygaul.Items and pygaul.Names to allow querying by ISO 3166-1 alpha-3 codes for country-level (level 0) boundaries:

# Current - uses unstable GAUL code
pygaul.Items(admin="307")  # Holy See

# Proposed - use stable ISO3 code  
pygaul.Items(iso3="VAT")  # Holy See

The underlying database already includes the iso3_code column, so this should be straightforward to implement.

Proposed API change:

class Items(ee.FeatureCollection):
    def __init__(
        self,
        name: Union[str, List[str]] = "",
        admin: Union[str, List[str]] = "",
        iso3: Union[str, List[str]] = "",  # NEW: ISO 3166-1 alpha-3 code
        content_level: int = -1,
    ):
        ...

Describe alternatives you've considered

Using country names instead of codes: This works but names can have slight variations or spelling differences across systems.

Additional context

  • ISO 3166-1 alpha-3 codes are internationally standardized and don't change between FAO dataset versions
  • Most geospatial applications already use ISO3 codes for country identification
  • This would only apply to level 0 (country) boundaries, since sub-national regions don't have standardized ISO codes
  • The admin parameter would still be needed for querying administrative levels 1 and 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions