SpatialTools
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
cpc.sau.lulctools
Class SpatialTools
java.lang.Objectcpc.sau.lulctools.SpatialTools
public class SpatialTools
- extends java.lang.Object
This class contains various tools that can operate on individual cells, parcels or the landscape. For cells, there are methods that create LulcCell objects using raster files, identify edges of cells across the landscape, locate individual cells given a coordinate position, and indentify neighbors of individual cells.
For parcels, there are tools that create Parcel objects from either the LULC type or the parcel ID, locate a parcel using its parcel ID, and calculate the Euclidean Nearest-neighbor distance between two parcels of the same LULC type.
Other methods include the ability to split parcels or properties up to a user-specified maximum size and a method to determine the number of parcels on a property.
These methods can be called using the syntax: SpatialTools.theMethodName(parameter list).
| Constructor Summary | |
|---|---|
SpatialTools()
|
|
| Method Summary | |
|---|---|
static java.util.ArrayList |
createRasterSpace(java.lang.String propertyFile,
java.lang.String lulcFile,
java.lang.String parcelFile)
Creates a new RasterSpace object that represents the modeling landscape through three approaches: property IDs, LULC values, or parcel IDs. |
static int |
edge(LulcCell lc,
LulcCell lc2)
Checks whether there is an edge between two adjacent cells. |
static LulcCell |
getCellAt(java.util.ArrayList coverList,
int x,
int y)
Returns an LulcCell object at the position(x,y). |
static double |
getEnn(Parcel parcel,
java.util.ArrayList<LulcCell> coverList)
Return the Euclidean Nearest-Neighbor distance(ENN). |
static java.util.ArrayList<LulcCell> |
getNeighborLulc(LulcCell lc,
java.util.ArrayList<LulcCell> coverList)
Returns neighboring land use around an LulcCell object, using the 4-neighbor relationship. |
static int |
getNumParcelsOnProperty(java.util.ArrayList<Parcel> pList,
java.lang.String propertyid)
Returns the largest parcel id on a property with the given property ID. |
static Parcel |
getParcel(java.util.ArrayList<Parcel> pList,
java.lang.String pid)
Locate a parcel by its parcel ID. |
static java.util.ArrayList<Parcel> |
parceListByType(java.util.ArrayList<Parcel> pList)
Converts a list of LulcCell objects to a list of Parcel objects using the LULC type. |
static java.util.ArrayList<Parcel> |
parcelListByID(java.util.ArrayList<LulcCell> coverList)
Converts a list of LulcCell objects to a list of Parcel objects using the parcel IDs. |
static void |
setCellEdge(java.util.ArrayList<LulcCell> coverList)
This method calculates the cell edges across the landscape and initializes the edges and isEdgeCell attributes of all cells. |
static double |
shortDist(Parcel p,
Parcel p2)
Calculates the shortest distance between two parcels. |
static java.util.Set<LulcCell> |
splitByScore(java.util.ArrayList<LulcCell> covers,
int max)
Splits a property or parcel based on the suitability scores of its cells. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
SpatialTools
public SpatialTools()
| Method Detail |
|---|
createRasterSpace
public static java.util.ArrayList createRasterSpace(java.lang.String propertyFile,
java.lang.String lulcFile,
java.lang.String parcelFile)
- Creates a new RasterSpace object that represents the modeling landscape through
three approaches: property IDs, LULC values, or parcel IDs.
- Parameters:
propertyFile- an ESRI ASCII Raster file containing property IDs for all cellslulcFile- an ESRI ASCII Raster file containing LULC values for all cellsparcelFile- an ESRI ASCII Raster file containing parcel IDs for all cells- Returns:
- List containing LulcCell objects on the landscape
setCellEdge
public static void setCellEdge(java.util.ArrayList<LulcCell> coverList)
- This method calculates the cell edges across the landscape and initializes
the edges and isEdgeCell attributes of all cells.
For each LulcCell object, it identifies its 4-neighbor cells. If there
is a neighboring cell with a different parcel ID, the edges attribute of the cell
increases by one.
- Parameters:
coverList- the list containing all LulcCell objects on the landscape
edge
public static int edge(LulcCell lc, LulcCell lc2)
- Checks whether there is an edge between two adjacent cells.
If the parcel IDs of these two cells are different,
an edge exists.
- Parameters:
lc- an LulcCell objectlc2- an LulcCell object- Returns:
- A 0 if no edge exists, and 1 if an edge does exist.
getCellAt
public static LulcCell getCellAt(java.util.ArrayList coverList, int x, int y)
- Returns an LulcCell object at the position(x,y).
- Parameters:
coverList- the list containing all LulcCell objects on the landscapex- the x coordinate of the LulcCell objecty- the y coordinate of the LulcCell object- Returns:
- the LulcCell at the position(x,y)
getNeighborLulc
public static java.util.ArrayList<LulcCell> getNeighborLulc(LulcCell lc, java.util.ArrayList<LulcCell> coverList)
- Returns neighboring land use around an LulcCell object, using the 4-neighbor relationship.
The order of the neighborhood list is west, north, east, south.
- Parameters:
lc- LulcCell objectcoverList- list containing all LulcCell objects on the landscape- Returns:
- a list containing all neighborhood LulcCell objects around a cell
parcelListByID
public static java.util.ArrayList<Parcel> parcelListByID(java.util.ArrayList<LulcCell> coverList)
- Converts a list of LulcCell objects to a list of Parcel objects using the parcel IDs.
This method uses the unique parcel ID of cells to classify the parcels.
- Parameters:
coverList- the list containing all LulcCell objects on the landscape- Returns:
- list containing all parcels on the landscape
parceListByType
public static java.util.ArrayList<Parcel> parceListByType(java.util.ArrayList<Parcel> pList)
- Converts a list of LulcCell objects to a list of Parcel objects using the LULC type.
All contiguous cells on the landscape with the same land use type are grouped into
parcels and the cells in each parcel are given the ID of the parcel.
- Parameters:
pList- the list containing all parcels based on their unique parcel IDs. This list can created with the parceListByID method.- Returns:
- list containing parcels based on land use type
getParcel
public static Parcel getParcel(java.util.ArrayList<Parcel> pList, java.lang.String pid)
- Locate a parcel by its parcel ID.
- Parameters:
pList- the list containing all parcels on the landscapepid- the parcel id- Returns:
- a parcel with parcel ID as the parameter
getEnn
public static double getEnn(Parcel parcel, java.util.ArrayList<LulcCell> coverList)
- Return the Euclidean Nearest-Neighbor distance(ENN). It equals
the distance, in meters, to the nearest neighboring patch of the same
type(class), based on shortest edge-to-edge distance when
computed from cell center to cell center. ENN is undefined and
reported as -1 if the patch has no neighbors(i.e. no other
patches of the same class).
ENN approaches 0 as the distance to the nearest neighbor
decreases. The minimum ENN is constrained by the cell size.
Here we use the 4-neighbor rule, so the minimum ENN is the distance
between diagonal neighbors.
- Parameters:
parcel- the parcel of interestcoverList- the LulcCell list for the landscape- Returns:
- the distance from the parcel to the nearest neighboring patch of the same LULC type(class).
shortDist
public static double shortDist(Parcel p, Parcel p2)
- Calculates the shortest distance between two parcels. It is based
on edge-to-edge distance. The calculation is between edge cells.
It calculates the distance from every edge
cell in one parcel to every edge cell in a second parcel
and returns the shortest distance.
NOTE: This alorithm may not operate very efficiently on large landscapes. A more efficient version will be made available in the future.
- Parameters:
p- parcel of interestp2- second parcel with the same LULC as parcel p- Returns:
- the shortest distance between the two parcels.
getNumParcelsOnProperty
public static int getNumParcelsOnProperty(java.util.ArrayList<Parcel> pList, java.lang.String propertyid)
- Returns the largest parcel id on a property with the given property ID.
The parcel ID on a farm is a sequence integer.
This method identifies the largest parcel ID on the property. It is useful for creating
a new parcel ID for a newly divided parcel.
- Parameters:
pList- the list containing all parcels on the landscapepropertyid- the property ID- Returns:
- the maximum parcel ID on a property
splitByScore
public static java.util.Set<LulcCell> splitByScore(java.util.ArrayList<LulcCell> covers, int max)
- Splits a property or parcel based on the suitability scores of its cells.
It chooses a cell with best score as the seed cell and begins a growth algorithm.
From the seed cell, it searches its neighboring cells and finds the cell with best
suitability score.
This cell is added to the first. It then searches all cells neighboring the two selected cells and chooses the one with the best score and selects it. This process continues until the maximum number of cells desired is reached. These cells are then taken from the original parcel and converted to a new parcel
- Parameters:
covers- list containing all LulcCell objects on the landscapemax- the maximum size of the subdivision- Returns:
- a new list containing the subdivided cells
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

cpc.sau.lulctools.SpatialTools

