Skip to content

Arc to grid

mtbeek32 edited this page Dec 5, 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

The dyna_point function is used to split up the lines in a set of points. Use a distance argument of the dyna_point function of half the grid size 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) ;
   }

   unit<uint32> segments   := arc2segm(arc/geometry);
   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<dyna_point> dyna_point_rel (griddomain_100) := invert(dyna_point/griddomain_100_rel);
   attribute<segments>   segments_rel   (griddomain_100) := dyna_point/sequence_rel[dyna_point_rel];
   attribute<arc>        arc_rel        (griddomain_100) := segments/sequence_rel[segments_rel];
}
Clone this wiki locally