Skip to content

Arc to grid

mtbeek32 edited this page Dec 6, 2023 · 19 revisions

Configuration examples Arc to grid

This example is used to make a grid representation of an arc, see the figure:

In this figure the red arc is presented in the grid domain, the dark cells are the cells through which the arc passes.

description

A dyna_point function is used to split up the lines in a set of points. Use as distance argument of the dyna_point function half the grid size of the grid domain(or less) if you want all cells passed through by the arc in the grid representation.

example

container line2grid
{
   unit<uint32> arc: StorageName = "%SourceDataDir/OSM/roads.shp", StorageType = "gdal.vect"
   {
      attribute<geometries/rdc> geometry (arc) ;
      attribute             wegtype        ; 
   }

   unit<uint32> segments   := arc2segm(arc/geometry)
   {
      attribute wegtype := arc/wegtype[sequence_rel];
   }

   unit<uint32> dyna_point := dyna_point_with_ends(segments/point, segments/nextpoint, 50f)
   {
      attribute<poly2grid/griddomain_100> griddomain_100_rel := point[poly2grid/griddomain_100];
      attribute                          wegtype            := segments/wegtype[sequence_rel];
   }

   attribute<dyna_point> dyna_point_rel (griddomain_100) := invert(dyna_point/griddomain_100_rel);
   attribute<uint8>      wegtype        (griddomain_100) 
      := modus(dyna_point/wegtype, dyna_point/griddomain_100_rel);
}
Clone this wiki locally