Class GridUtil
- java.lang.Object
-
- eu.europa.ec.eurostat.jgiscotools.grid.GridUtil
-
public class GridUtil extends Object
A number of functions on grids.- Author:
- julien Gaffuri
-
-
Constructor Summary
Constructors Constructor Description GridUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassignDistanceToLines(Collection<Feature> cells, String distanceAttribute, org.locationtech.jts.index.strtree.STRtree linesInd, int decimalNB)For eache cell, computestatic voidassignLandProportion(Collection<Feature> cells, String cellLandPropAttribute, org.locationtech.jts.index.SpatialIndex landGeometries, org.locationtech.jts.index.SpatialIndex inlandWaterGeometriesIndex, int decimalNB)Compute for each cell the proportion of its area which is land area.static voidassignRegionCode(Collection<Feature> cells, String cellRegionAttribute, Collection<Feature> regions, double toleranceDistance, String regionCodeAttribute)Assign region codes to grid cells.static voidfilterCellsWithoutRegion(Collection<Feature> cells, String cellRegionAttribute)Remove cells which are not assigned to any region, that is the ones with attribute 'cellRegionAttribute' null or set to "".static org.locationtech.jts.geom.GeometrygetLandCellGeometry(Feature cell, org.locationtech.jts.index.SpatialIndex landGeometries, org.locationtech.jts.index.SpatialIndex inlandWaterGeometriesIndex)Compute land geometry of a grid cell
-
-
-
Method Detail
-
assignRegionCode
public static void assignRegionCode(Collection<Feature> cells, String cellRegionAttribute, Collection<Feature> regions, double toleranceDistance, String regionCodeAttribute)
Assign region codes to grid cells. These regions could be countries or NUTS regions. If a grid cell intersects or is nearby the geometry of a region, then an attribute of the cell is assigned with this region code. For cells that are to be assigned to several regions, several region codes are assigned.- Parameters:
cells-cellRegionAttribute-regions-toleranceDistance-regionCodeAttribute-
-
filterCellsWithoutRegion
public static void filterCellsWithoutRegion(Collection<Feature> cells, String cellRegionAttribute)
Remove cells which are not assigned to any region, that is the ones with attribute 'cellRegionAttribute' null or set to "".- Parameters:
cells-cellRegionAttribute-
-
assignLandProportion
public static void assignLandProportion(Collection<Feature> cells, String cellLandPropAttribute, org.locationtech.jts.index.SpatialIndex landGeometries, org.locationtech.jts.index.SpatialIndex inlandWaterGeometriesIndex, int decimalNB)
Compute for each cell the proportion of its area which is land area. The value is stored as a new attribute for each cell. This value is a percentage.- Parameters:
cells-cellLandPropAttribute-landGeometries-inlandWaterGeometriesIndex-decimalNB- The number of decimal places to keep for the percentage
-
getLandCellGeometry
public static org.locationtech.jts.geom.Geometry getLandCellGeometry(Feature cell, org.locationtech.jts.index.SpatialIndex landGeometries, org.locationtech.jts.index.SpatialIndex inlandWaterGeometriesIndex)
Compute land geometry of a grid cell- Parameters:
cell-landGeometries-- Returns:
-
assignDistanceToLines
public static void assignDistanceToLines(Collection<Feature> cells, String distanceAttribute, org.locationtech.jts.index.strtree.STRtree linesInd, int decimalNB)
For eache cell, compute- Parameters:
cells-distanceAttribute-linesInd-decimalNB-
-
-