Polygon to grid

configuration-examples Polygon to grid

This example is used to read an attribute from a polygon shapefile, make a relation from the polygons to a grid and calculate the attribute for the grid-domain.

example

unit<uint16> earthquake
:  StorageName      = "%SourceDataDir%/physics/earthquakes.shp"
,  StorageType      = "gdal.vect"
,  StorageReadOnly  = "True"
{
   attribute<LatLong> geometry (polygon); // LatLong must be the coordinate system unit
   attribute<int32>   zone;               
   // HeatOption must be an attribute in the dbf file accompanying the shp file 
}

attribute<earthquake> earthquake_rel (gtopo) := poly2grid(earthquake/geometry, gtopo); 
  // gtopo must be the grid domain unit referring to the LatLong coordinate system unit 
attribute<int32>      zone           (gtopo) := earthquake/zone[earthquake_rel];