Skip to content

Expose a public way to list available from_template names (regions + cities) #3535

Description

@brendancol

Reason or Problem

from_template now resolves 7 curated regions, 519 world cities, and 240 country codes (#3533). The city and region names live in private dicts (_REGIONS, _CITIES), so there's no public way to discover what's available. When a name misses, the error points to "the templates reference," but the reference doesn't enumerate the cities either. Country codes are at least an external standard (ISO-3166); the city list isn't, so it's the hardest to discover.

Proposal

Add a small public helper that returns the available template names, e.g. from xrspatial.templates import list_templates, returning regions, cities, and country codes (probably grouped, or filterable by kind). Then point the unknown-name error and the reference doc at it.

Open design questions: name (list_templates vs available_templates), return shape (flat list vs grouped dict), whether to include the ~240 country codes or just say "ISO-3166 alpha-3."

Stakeholders and Impacts

Follow-up to #3533. Pure addition; no change to existing behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiAPI design and consistencyenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions