Skip to content

Arc to grid

mtbeek32 edited this page Dec 5, 2023 · 6 revisions

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.

    1. 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.

    1. example <pre> 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]; } </pre>

Clone this wiki locally