6 · grid_points¶
Map.grid_points plots each raster cell centre as a point coloured by value (cleopatra ScatterGlyph); coordinates/values come from pyramids' to_xyz. point_cloud is an alias.
Setup — inline plots and the path to the bundled Lisbon DEM.
In [1]:
Copied!
%matplotlib inline
from pathlib import Path
# Locate the bundled Lisbon DEM from the repo root (works from docs/ or the repo root).
ROOT = Path.cwd()
while not (ROOT / "examples" / "data" / "LisbonElevation.tif").exists() and ROOT != ROOT.parent:
ROOT = ROOT.parent
DEM = str(ROOT / "examples" / "data" / "LisbonElevation.tif")
from pyramids.dataset import Dataset
from digitalearth.static import Map
ds = Dataset.read_file(DEM)
coarse = ds.resample(ds.cell_size * 10) # downsample for legible markers/cells
%matplotlib inline
from pathlib import Path
# Locate the bundled Lisbon DEM from the repo root (works from docs/ or the repo root).
ROOT = Path.cwd()
while not (ROOT / "examples" / "data" / "LisbonElevation.tif").exists() and ROOT != ROOT.parent:
ROOT = ROOT.parent
DEM = str(ROOT / "examples" / "data" / "LisbonElevation.tif")
from pyramids.dataset import Dataset
from digitalearth.static import Map
ds = Dataset.read_file(DEM)
coarse = ds.resample(ds.cell_size * 10) # downsample for legible markers/cells
Scatter the coarse DEM cell centres, coloured by elevation.
In [2]:
Copied!
m = Map(crs=coarse.epsg, figsize=(9, 7))
m.grid_points(coarse, cmap='terrain')
m.colorbar(label='elevation (m)')
m.set_title('grid_points')
m.fig;
m = Map(crs=coarse.epsg, figsize=(9, 7))
m.grid_points(coarse, cmap='terrain')
m.colorbar(label='elevation (m)')
m.set_title('grid_points')
m.fig;
0...10...20...30...40...50...60...70...80...90...
point_cloud is the same renderer under a different name.
In [3]:
Copied!
m = Map(crs=coarse.epsg, figsize=(9, 7))
m.point_cloud(coarse, cmap='terrain')
m.set_title('point_cloud (alias)')
m.fig;
m = Map(crs=coarse.epsg, figsize=(9, 7))
m.point_cloud(coarse, cmap='terrain')
m.set_title('point_cloud (alias)')
m.fig;
100 - done. 0...10...20...30...40...50...60...70...80...90...