Package org.geotools.gce.grassraster
Class JGrassMapEnvironment
Object
JGrassMapEnvironment
Represents the structure around a map inside a grass database.
Given a map file path, all the related files to that map in the GRASS Location/Mapset are defined.
- Since:
- 3.0
- Author:
- Andrea Antonello (www.hydrologis.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic double
A maximum value to be used when no range is available for a map.static double
A minimum value to be used when no range is available for a map. -
Constructor Summary
ConstructorsConstructorDescriptionJGrassMapEnvironment
(File cellFile) Constructs an instance of JGrassMapEnvironment.JGrassMapEnvironment
(File mapsetFile, String mapName) Constructs an instance of JGrassMapEnvironment. -
Method Summary
Modifier and TypeMethodDescriptionRead theJGrassRegion
from the active region file.Reads the categories for the map wrapped by thisJGrassMapEnvironment
.Getter for the categories string.getCATS()
Getter for CATS file.Getter for CATS folder.getCELL()
Getter for CELL file, i.e. the main map file.Getter for CELL folder.Getter for CELLHD file.Getter for CELLMISC_FORMAT file.Getter for CELLMISC_NULL file.Getter for CELLMISC_QUANT file.Getter for CELLMISC_RANGE file.getColorRules
(double[] range) Read the colorrules for the map wrapped by thisJGrassMapEnvironment
.getCOLR()
Getter for COLR file.Getter for COLR folder.Read thecrs
from the location.Getter for DEFAULT_WIND file.getFCELL()
Getter for FCELL file.Getter for FCELL folder.Read the file region of the map.getHIST()
Getter for the history file.Getter for the legend string.Getter for LOCATION folder.Getter for the main map file.Getter for mapName.Getter for MAPSET folder.Getter for PERMANENT MAPSET folder.Getter for PROJ_INFO file.Getter for PROJ_UNITS file.Getter for PROJ_WKT file.double[]
Reads the data range from a color table file, if existing.double[]
Reads the data range by reading the map.double[]
Reads the data range from the GRASS range file.Getter for RECLASSEDENVIRONMENT.getWIND()
Getter for WIND file.void
setReclassed
(String reclassedMapset, String reclassedMap) Reclasses the environment.
-
Field Details
-
defaultMapMin
public static double defaultMapMinA minimum value to be used when no range is available for a map. -
defaultMapMax
public static double defaultMapMaxA maximum value to be used when no range is available for a map.
-
-
Constructor Details
-
JGrassMapEnvironment
Constructs an instance of JGrassMapEnvironment.- Parameters:
cellFile
- the absolute path to a grass raster map, through which the environment is defined.
-
JGrassMapEnvironment
Constructs an instance of JGrassMapEnvironment.This constructor is a facility method in the case the mapset file and the name of the GRASS raster map are passed.
- Parameters:
mapsetFile
- file of the mapset pathmapName
- name of the GRASS raster map
-
-
Method Details
-
setReclassed
Reclasses the environment.In the case a reclassed map was found, this method has to be called, in order to set the current environment to the new reclassed one.
- Parameters:
reclassedMapset
- the name of the mapset holding the reclassed mapreclassedMap
- the name of the reclassed map
-
getMapName
Getter for mapName.- Returns:
- the map name.
-
getPERMANENT_MAPSET
Getter for PERMANENT MAPSET folder.- Returns:
- the PERMANENT MAPSET folder file.
-
getMAPSET
Getter for MAPSET folder.- Returns:
- the MAPSET folder file.
-
getLOCATION
Getter for LOCATION folder.- Returns:
- the LOCATION file folder.
-
getDEFAULT_WIND
Getter for DEFAULT_WIND file.- Returns:
- the DEFAULT_WIND file.
-
getPROJ_INFO
Getter for PROJ_INFO file.- Returns:
- the PROJ_INFO file.
-
getPROJ_WKT
Getter for PROJ_WKT file.- Returns:
- the PROJ_WKT file.
-
getPROJ_UNITS
Getter for PROJ_UNITS file.- Returns:
- the PROJ_UNITS file.
-
getWIND
Getter for WIND file.- Returns:
- the WIND file.
-
getFCELL
Getter for FCELL file.- Returns:
- the FCELL file.
-
getFcellFolder
Getter for FCELL folder.- Returns:
- the FCELL folder file.
-
getCELL
Getter for CELL file, i.e. the main map file.- Returns:
- the CELL file.
-
getMapFile
Getter for the main map file.- Returns:
- the main map file.
-
getCellFolder
Getter for CELL folder.- Returns:
- the CELL folder file.
-
getCATS
Getter for CATS file.- Returns:
- the CATS file.
-
getCatsFolder
Getter for CATS folder.- Returns:
- the CATS folder file.
-
getHIST
Getter for the history file.- Returns:
- the HIST file.
-
getCELLHD
Getter for CELLHD file.- Returns:
- the CELLHD file.
-
getCOLR
Getter for COLR file.- Returns:
- the COLR file.
-
getColrFolder
Getter for COLR folder.- Returns:
- the COLR folder file.
-
getCELLMISC_FORMAT
Getter for CELLMISC_FORMAT file.- Returns:
- the CELLMISC_FORMAT file.
-
getCELLMISC_QUANT
Getter for CELLMISC_QUANT file.- Returns:
- the CELLMISC_QUANT file.
-
getCELLMISC_RANGE
Getter for CELLMISC_RANGE file.- Returns:
- the CELLMISC_RANGE file.
-
getCELLMISC_NULL
Getter for CELLMISC_NULL file.- Returns:
- the CELLMISC_NULL file.
-
getRECLASSEDENVIRONMENT
Getter for RECLASSEDENVIRONMENT.- Returns:
- the RECLASSEDENVIRONMENT.
-
getColorRules
Read the colorrules for the map wrapped by thisJGrassMapEnvironment
.- Parameters:
range
- the range to use for the default colortable, in the case of missing color file. Can be null.- Returns:
- a
List
of color rules in string format. - Throws:
IOException
-
getCategories
Reads the categories for the map wrapped by thisJGrassMapEnvironment
.The categories are returned in a
List
of strings that may be of two types:
- value:categorytext
- value1-value2:categorytext
- Returns:
- the list of categories in text format.
- Throws:
IOException
-
getActiveRegion
Read theJGrassRegion
from the active region file.- Returns:
- the active grass region.
- Throws:
IOException
-
getRangeFromColorTable
Reads the data range from a color table file, if existing.- Returns:
- the data range or null if no range could be read.
- Throws:
IOException
-
getRangeFromRangeFile
Reads the data range from the GRASS range file.- Returns:
- the data range or null if the content is infinite or NaN.
- Throws:
IOException
-
getRangeFromMapScan
Reads the data range by reading the map.- Returns:
- the data range.
- Throws:
IOException
-
getLegendString
Getter for the legend string.- Returns:
- the legendstring.
- Throws:
IOException
-
getCategoriesString
Getter for the categories string.- Returns:
- the categories string.
- Throws:
IOException
-
getCoordinateReferenceSystem
Read thecrs
from the location.- Returns:
- the crs of the location containing the map.
- Throws:
Exception
-
getFileRegion
Read the file region of the map.- Returns:
- the
JGrassRegion
of the file. - Throws:
IOException
-