logo-header

 
 
poly2grid

syntax

  • poly2grid(polygonset, gridunit, subPixelFactor)

definition

poly2grid(polygons, gridunit, subPixelFactor) results in a data item with:

as values unit the domain of the polygons

as domain unit the gridunit argument

The subPixelFactor argument used to define the ratio between the resolution of the gridunit argument and the grid unit used in the rasterization and is now obsolete.

description

Since 7.020 the poly2grid function is based on a similar function in GDAL. The explicit gdal_poly2grid function with the same signature is a synonym for the poly2grid function since 7.020.

Between the versions 6.025 and 7.020, the poly2grid function used a GDI function to convert data items of polygon domains to grid domains. This function is still available as gdi_poly2grid, with the same signature as poly2grid. The function is faster than the new function based on GDAL, but can result in invalid results on some graphic devices supporting a limited set of colors.   

In versions before 6.025 the point_in_polygon function was used for this purpose. This is still possible, but it is advised to use the poly2grid function instead as it is much faster.

In the function two grid domain units are relevant:

  1. the grid domain at which the rasterization is performed.
  2. the resulting gridunit for which the results are needed, aggregated from grid domain 1.

With the subPixelFactor the ratio between the resolution of grid units two and one is configured. A higher value means a more accurate result, but also more processing time. From version 7.020 on with the implementation of the GDAL function, a value of one for this subPixelfactor already results in accurate results. 

applies to

attribute polygonset with a wpoint, spoint, upoint, ipoint, fpoint or dpoint value type

unit gridunit with a wpoint, spoint upoint, ipoint, fpoint, dpoint value type

parameter subPixelFactor with uint32 value type

conditions

The composition type of the polygonset item needs to be polygon.

The domain unit of the polygonset must be of value type uint32.

The subPixelFactor must be odd and between 1 and 25 inclusive.

complexity

The complexity of the poly2grid function for one polygon is O(n* log(n) + x), with:

n: number of points of the polygon.

x: number of pixels to be drawn.

This implies the number of points per polygon is an important factor in the calculation speed of the function. Simplifying polygons can help to improve the calculation speed. At the moment, simplifying polygons is not supported by the GeoDMS, but can be performed in other GIS software.

since version

6.025

example

attribute<Source/District> DistrictGrid (gridunit/gridcel_10m) := 
poly2grid(Source/District/border, gridunit/gridcel_10m, 1);

OBJECT VISION BV
Vrije Universiteit
De Boelelaan 1085
1081 HV Amsterdam
The Netherlands

tel: +31 (0)20 598 9083
fax:+31 (0)20 598 9904