ops Package#

sample Module#

drapery.ops.sample.drape(raster, feature)#

Convert a 2D feature to a 3D feature by sampling a raster

Parameters:
  • raster (DatasetReader) – raster to provide the z coordinate

  • feature (Point | LineString) – fiona feature record to convert

Returns:

shapely Point or LineString

Return type:

Point | LineString

drapery.ops.sample.sample(raster, coords)#

Sample a raster at given coordinates

Given a list of coordinates, return a list of x,y,z triples with z coordinates sampled from an input raster

Parameters:
  • raster (DatasetReader) – raster dataset to sample

  • coords (list[tuple[float, ...]]) – array of tuples containing coordinate pairs (x,y) or triples (x,y,z)

Returns:

array of tuples containing coordinate triples (x,y,z)

Return type:

list[tuple[float, float, float]]