ops Package

sample Module

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

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

Parameters:
  • raster (rasterio) – raster to provide the z coordinate
  • feature (dict) – fiona feature record to convert
Returns:

shapely Point or LineString of xyz coordinate triples

Return type:

result (Point or 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 (rasterio) – raster dataset to sample
  • coords – 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:

result