DENSITY

Convert point layer to density raster channel


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example

Back to top

Description


Converts a point layer to a raster representative of either the density per square unit of the points or the density of an attribute (z-value) of the points.
Back to top

Parameters


density(fili, filo, dbvs, dbib, dboc, units, samprad, maxneigh, nodatval, pixres, denstype, fldnme)

Name Type Caption Length Value range
FILI * str Input file name 1 -    
FILO str Output file name 0 -    
DBVS * List[int] Input vector segment 1 - 1  
DBIB List[int] Input bitmap segment 0 - 1  
DBOC List[int] Output raster channel 0 - 1  
UNITS str Density units 0 - 17 See Details
Default: Square Kilometers
SAMPRAD * List[float] Sampling radius 1 - 1 0.0 -
MAXNEIGH List[int] Maximum number of neighbors 0 - 1 1 -
Default: 10
NODATVAL List[float] No Data value 0 - 1 Default: -1e+008
PIXRES List[float] Output pixel resolution (m) 0 - 2  
DENSTYPE str Density type 0 - 9 POINT | ATTRIBUTE
Default: POINT
FLDNME str Attribute field name 0 - 64  

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the PCIDSK file that contains the input point layer.

FILO

Specifies the name of the PCIDSK image file to receive the output raster channel. If the output file is not specified, it will be assumed to be the same as FILI. If the specified output file exists, its projection must be the same as FILI.

If FILO does not exist, a new PCIDSK file will be created. By default, the georeferencing information from FILI will be copied to the new FILO. If an output pixel resolution is specified and is different from that of the input file, the extents of the output file will be different.

Output channels should be of type 32R.

DBVS

Specifies the vector segment that contains the input point layer.

DBIB

Specifies the bitmap segment to restrict the region when generating the weighted average. The results will be generated inside the bitmap segment (value 1) and pixels falling outside the bitmap (value 0) will be given a "No Data" value.

The Bitmap layer also defines the geoereferencing of the output raster, if it is used.

DBOC

Specifies the output raster channel to receive converted point layer.

If the output file already exists, the output channel must be specified and must already exist.

If the output file does not exist, this parameter is ignored.

The output channel must be 32-bit real (CHN_32R).

UNITS

Specifies the units for the calculated density.

Available options are:

SAMPRAD

Specifies the sampling radius, in meters, centered on each point in the raster channel to determine which points are used in the density calculation.

MAXNEIGH

Specifies the maximum number of points closest to the center of the pixel and whose radii overlap the center of the pixel to be considered in calculating an output value.

NODATVAL

Specifies a "No Data" (background) value for all channels.

If this parameter is not specified, the No Data value for each channel defaults to "-1e+008".

Areas with the "No Data" value are excluded from processing.

PIXRES

Specifies the pixel resolution (X,Y) for the output raster channel.

If this parameter is not specified, the projection information is taken from the georeferencing segment of the input file. The pixel resolution (size) is used to determine the number of pixels and lines in the output file. Decreasing the pixel size results in a larger output file and increased computation time.

This parameter applies only when a new output file (FILO) is being created.

DENSTYPE

Specifies whether to calculate the density for points or for an attribute.

Available options are:

If POINT is specified, the FLDNME (Attribute) value is ignored.

FLDNME

Specifies the name of the attribute whose value is to be used to grid the polygons. If this parameter is specified as (Z-COORD), the z-coordinate of the first vertex of each vector shape is used. If the specified attribute does not exist and it is not Z-COORD, the ShapeID of the vector shapes are used for gridding.

This parameter is not used if the density type (DENSTYPE) is set to POINT.

Back to top

Details

DENSITY generates a surface by applying a sampling radius to each point in the input point layer. No output values are calculated for areas lying outside the sampling radius.

The value for each pixel in the output raster is calculated based on the value of each point whose sampling radius overlaps the center of that pixel. You can specify the size of the sampling radius (SAMPRAD).

The density function is able to generate a surface representative of the density per square unit of the points or of the density of an attribute; for example, population.

If the number of points influencing the pixel is 1, then:

density is Z/PI*d^2

If the number of points influencing a pixel is greater than 1, then:

density is Z(i)/PI*d(i)^2
where:
Back to top

Example

A point layer is stored in segment 32 of the file 'irvine.pix'. Density is calculated in 'Square Meters,' along with the default sample radius and maximum neighbors. The output raster is saved in channel 1 of type 32R.

from pci.density import density

fili	=	"IRVINE.PIX"
filo	=	"OIRVINE.PIX"	# output file will be created
dbvs	=	[32]	# vector segment containing point layer
dbib	=	[]	# no bitmap mask
dboc	=	[1]	# output raster channel
units	=	"Square Meters"	# density units
samprad	=	[100]	# sampling radius
maxneigh	=	[]	# default, 10
nodatval	=	[]	# default, -1e+008
pixres	=	[30,30]	# pixel resolution 30x30m
denstype	=	""	# default, POINT
fldnme	=	""	# ignored if DENSTYPE is POINT

density( fili, filo, dbvs, dbib, dboc, units, samprad, maxneigh, nodatval, pixres, denstype, fldnme )

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.