Dissolve (merge geometries)

From ObjectVision

Jump to: navigation, search

Configuration examples Dissolve

Introduction

Dissolving is the process of merging detailed polygon geometries in larger polygon geometries by removing interior segments.

In the GeoDMS this can also be done based on a relational attribute, to make polygons for each entry of the domain of this relational attribute.

Example

container dissolve
{
   unit<float32> meter := baseunit('meter', float32);
   unit<fpoint>   point_rd_base;
   unit<fpoint>   point_rd := range(point_rd_base, point(300000[meter],0[meter]), point(625000[meter],280000[meter]));

   unit<uint32> municipality
   : StorageName       = "%SourceDataDir%/CBS/2017/gem_2017.shp"
   , StorageType         = "gdal.vect"
   , StorageReadOnly = "True"
  {
      attribute<point_rd>  geometry (polygon);
      attribute<string>      name;
      attribute<string>      regionname; 
      attribute<region >    region_rel := rlookup(regionname, region /values);
   }
   unit<uint32> region := unique(municipality/regionname)
   {
      attribute<point_rd> geometry (polygon) : = partitioned_union_polygon(ipolygon(municipality/geometry),municipality/region_rel)[point_rd];
   }
}

Explanation

The example presents two domains municipality and region. A relation is configured (region_rel) relating the municipality domain to the region domain.

The actual dissolving is done in the bold line. The partitioned_union_polygon is used to dissolve the geometries of a municipality for a region. The ipolygon conversion function is used as these vector functions only work on integer coordinates. The casting back to [point_rd] at the end of the expression is used to convert the integer coordinates back to the point_rd values unit.

Personal tools