voxcity.downloader.gsiΒΆ
Module for downloading bare-earth DEM (Digital Terrain Model) tiles from the Geospatial Information Authority of Japan (GSI / ε½εε°ηι’) and converting them into a VoxCity-compatible georeferenced GeoTIFF.
GSI publishes elevation tiles on the standard XYZ Web-Mercator tile grid at
https://cyberjapandata.gsi.go.jp/xyz/{type}/{z}/{x}/{y}.txt. Each tile is a
256x256 grid of elevation values (meters) as CSV text, with e marking
no-data. Resolutions, finest first: dem5a (5 m laser, z15), dem5b (5 m photo,
z15), dem10b (10 m nationwide, z14).
The mosaic is written natively in EPSG:3857 (no resampling); the downstream
create_dem_grid_from_geotiff_polygon reprojects from the fileβs own CRS.
Example
>>> verts = [(140.09, 36.21), (140.12, 36.21), (140.12, 36.24), (140.09, 36.24)]
>>> save_gsi_dem_as_geotiff(verts, "dem.tif")
FunctionsΒΆ
|
Download GSI bare-earth DEM for an ROI and save an EPSG:3857 GeoTIFF. |
Module ContentsΒΆ
- voxcity.downloader.gsi.save_gsi_dem_as_geotiff(rectangle_vertices, filepath, dem_type=None, nodata=GSI_NODATA, sleep=0.4, timeout_s=10, include_dem10b_fallback=True)ΒΆ
Download GSI bare-earth DEM for an ROI and save an EPSG:3857 GeoTIFF.
- Parameters:
rectangle_vertices β list of (lon, lat) tuples defining the ROI.
filepath β output GeoTIFF path.
dem_type β None (default) to build a seamless mosaic by overlaying the finest products available per pixel (see below), or one of βdem5aβ / βdem5bβ / βdem10bβ to force a single product with no merging.
nodata β no-data fill value.
sleep β seconds between requests (politeness; set 0 in tests).
timeout_s β per-request timeout.
include_dem10b_fallback β when auto-merging, backfill pixels covered by neither 5 m product with dem10b (10 m). Set False to leave such pixels as no-data.
- Returns:
The written filepath.
Note
With
dem_type=Nonethe ROI is composed at z15 from dem5a, with dem5b filling any dem5a no-data pixels, and (optionally) dem10b filling whatever remains. This produces a seamless terrain even when the ROI straddles a dem5a coverage boundary, instead of leaving no-data holes. dem5b is fetched only for tiles where dem5a is incomplete, and dem10b only when 5 m no-data pixels remain, so fully dem5a-covered ROIs incur no extra requests. dem10b (z14) is half the resolution of the 5 m products; because both grids share the global mercator origin and differ by an exact power of two, its pixels are mapped without resampling artifacts.- Raises:
ValueError β if rectangle_vertices is empty, dem_type is invalid, or no tiles cover the area.