Reason or Problem
from_template() already gives you an empty study-area grid from a region name or country code. The catch: of the curated regions, only nyc is a city. If you want to start an analysis over Tokyo, London, or São Paulo, you're back to looking up a bounding box, picking a sensible projection, and assembling coordinates by hand — the exact chore from_template exists to remove.
Proposal
Add a set of world cities (national capitals plus major regional metros) as templates, so from_template("tokyo") returns an empty grid over greater Tokyo in a sensible projection.
Design:
Each city follows the existing nyc pattern: a lon/lat metro bounding box, a UTM-zone CRS picked from the city's centroid (EPSG:326xx north / 327xx south), projected bounds computed once at authoring time, and a metre-based default resolution. UTM keeps every city on a known EPSG code — no synthesized PROJ4/WKT.
The city table is generated from Natural Earth populated places at authoring time and committed as static data next to the country bboxes, so there's no runtime network or geopandas dependency. Box size scales with population: bigger for megacities, tighter for regional centres. Cities slot into _resolve between the curated regions and the country codes, so preserve='area'/'shape' keeps working the same way it does for nyc.
Usage:
from xrspatial import from_template
agg = from_template("tokyo") # empty UTM-54N grid over greater Tokyo
agg.attrs["crs"] # 32654
from_template("london").attrs["crs"] # 32630
Value: Drops a common first step — find a bbox, choose a CRS, build the coordinates — for the places people most often demo and prototype on.
Stakeholders and Impacts
I'll implement it. It only extends the template data and _resolve; no change to the backend dispatch or any existing region.
Drawbacks
The registry grows by ~500 entries. City names collide (Paris, France vs Paris, Texas), so a disambiguation rule is needed. UTM is a reasonable default but isn't always the locally preferred grid.
Alternatives
Use a national or city grid per city instead of UTM. Rejected for now: it needs per-city curation and judgment, and UTM already satisfies "standard EPSG projection" everywhere.
Unresolved Questions
Final city count and the population cutoff for "regional" cities.
Reason or Problem
from_template()already gives you an empty study-area grid from a region name or country code. The catch: of the curated regions, onlynycis a city. If you want to start an analysis over Tokyo, London, or São Paulo, you're back to looking up a bounding box, picking a sensible projection, and assembling coordinates by hand — the exact chorefrom_templateexists to remove.Proposal
Add a set of world cities (national capitals plus major regional metros) as templates, so
from_template("tokyo")returns an empty grid over greater Tokyo in a sensible projection.Design:
Each city follows the existing
nycpattern: a lon/lat metro bounding box, a UTM-zone CRS picked from the city's centroid (EPSG:326xx north / 327xx south), projected bounds computed once at authoring time, and a metre-based default resolution. UTM keeps every city on a known EPSG code — no synthesized PROJ4/WKT.The city table is generated from Natural Earth populated places at authoring time and committed as static data next to the country bboxes, so there's no runtime network or geopandas dependency. Box size scales with population: bigger for megacities, tighter for regional centres. Cities slot into
_resolvebetween the curated regions and the country codes, sopreserve='area'/'shape'keeps working the same way it does fornyc.Usage:
Value: Drops a common first step — find a bbox, choose a CRS, build the coordinates — for the places people most often demo and prototype on.
Stakeholders and Impacts
I'll implement it. It only extends the template data and
_resolve; no change to the backend dispatch or any existing region.Drawbacks
The registry grows by ~500 entries. City names collide (Paris, France vs Paris, Texas), so a disambiguation rule is needed. UTM is a reasonable default but isn't always the locally preferred grid.
Alternatives
Use a national or city grid per city instead of UTM. Rejected for now: it needs per-city curation and judgment, and UTM already satisfies "standard EPSG projection" everywhere.
Unresolved Questions
Final city count and the population cutoff for "regional" cities.