Opened 5 years ago

Last modified 4 months ago

#2327 new enhancement

[raster] ST_Drape

Reported by: dustymugs Owned by: dustymugs
Priority: medium Milestone: PostGIS Fund Me
Component: raster Version: trunk
Keywords: Cc: dmcclean

Description

Taking a geometry and a raster, return a new XYM geometry resulting from overlaying the geometry on the raster and populating M with values from the raster.

Reference:

http://vterrain.org/Misc/draping.html

geometry ST_Drape(
  rast raster, nband int,
  geom geometry,
  computed_vertices boolean DEFAULT TRUE
)

Some things to think about before implementing...

  1. XYM or XYZ output geometry: Assuming the raster is DEM, units are typically meter or foot. If X/Y are degrees, populating Z in the DEM's units don't make sense. Maybe a function parameter flag indicating output should be XYZ or XYM?
  1. 3D geometry with rasters: The geometry is treated as 2D. Should pixel values be put into Z or M?
  1. computed_vertices: The returning geometry should be as detailed as the input raster. So, returning geometry will have the same vertices of the input geometry and possibly.
  1. Polygons: How to handle the interior of the polygon? Boundary is easy. Multipolygon? TIN?

Change History (5)

comment:1 Changed 5 years ago by dustymugs

For polygons, use Delaunay Triangles capability from GEOS. Should have something similar to how ST_DelaunayTriangles() allows the user to control output between a TIN, MULTILINESTRING or COLLECTION of polygons.

comment:2 Changed 4 years ago by smathermather

Also relevant: http://blog.mathieu-leplatre.info/drape-lines-on-a-dem-with-postgis.html

Re: 2) I'd say keep 3D, add M, and if the user wants to make it Z, then they should convert to 2D before draping.

comment:3 Changed 3 years ago by dmcclean

Amen. It would be nice to have a tolerance parameter like the one to ST_Simplify that adaptively downsamples from the full DEM-resolution/input-resolution result.

comment:4 Changed 3 years ago by dmcclean

Cc: dmcclean added

comment:5 Changed 4 months ago by robe

Milestone: PostGIS FuturePostGIS Fund Me

Milestone renamed

Note: See TracTickets for help on using tickets.