Package org.geotools.gce.grassraster
Class JGrassMapEnvironment
- Object
-
- JGrassMapEnvironment
-
public class JGrassMapEnvironment extends Object
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
Fields Modifier and Type Field Description static double
defaultMapMax
A maximum value to be used when no range is available for a map.static double
defaultMapMin
A minimum value to be used when no range is available for a map.
-
Constructor Summary
Constructors Constructor Description JGrassMapEnvironment(File cellFile)
Constructs an instance of JGrassMapEnvironment.JGrassMapEnvironment(File mapsetFile, String mapName)
Constructs an instance of JGrassMapEnvironment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JGrassRegion
getActiveRegion()
Read theJGrassRegion
from the active region file.List<String>
getCategories()
Reads the categories for the map wrapped by thisJGrassMapEnvironment
.String
getCategoriesString()
Getter for the categories string.File
getCATS()
Getter for CATS file.File
getCatsFolder()
Getter for CATS folder.File
getCELL()
Getter for CELL file, i.e. the main map file.File
getCellFolder()
Getter for CELL folder.File
getCELLHD()
Getter for CELLHD file.File
getCELLMISC_FORMAT()
Getter for CELLMISC_FORMAT file.File
getCELLMISC_NULL()
Getter for CELLMISC_NULL file.File
getCELLMISC_QUANT()
Getter for CELLMISC_QUANT file.File
getCELLMISC_RANGE()
Getter for CELLMISC_RANGE file.List<String>
getColorRules(double[] range)
Read the colorrules for the map wrapped by thisJGrassMapEnvironment
.File
getCOLR()
Getter for COLR file.File
getColrFolder()
Getter for COLR folder.CoordinateReferenceSystem
getCoordinateReferenceSystem()
Read thecrs
from the location.File
getDEFAULT_WIND()
Getter for DEFAULT_WIND file.File
getFCELL()
Getter for FCELL file.File
getFcellFolder()
Getter for FCELL folder.JGrassRegion
getFileRegion()
Read the file region of the map.File
getHIST()
Getter for the history file.String
getLegendString()
Getter for the legend string.File
getLOCATION()
Getter for LOCATION folder.File
getMapFile()
Getter for the main map file.String
getMapName()
Getter for mapName.File
getMAPSET()
Getter for MAPSET folder.File
getPERMANENT_MAPSET()
Getter for PERMANENT MAPSET folder.File
getPROJ_INFO()
Getter for PROJ_INFO file.File
getPROJ_UNITS()
Getter for PROJ_UNITS file.File
getPROJ_WKT()
Getter for PROJ_WKT file.double[]
getRangeFromColorTable()
Reads the data range from a color table file, if existing.double[]
getRangeFromMapScan()
Reads the data range by reading the map.double[]
getRangeFromRangeFile()
Reads the data range from the GRASS range file.JGrassMapEnvironment
getRECLASSEDENVIRONMENT()
Getter for RECLASSEDENVIRONMENT.File
getWIND()
Getter for WIND file.void
setReclassed(String reclassedMapset, String reclassedMap)
Reclasses the environment.
-
-
-
Constructor Detail
-
JGrassMapEnvironment
public JGrassMapEnvironment(File cellFile)
Constructs an instance of JGrassMapEnvironment.- Parameters:
cellFile
- the absolute path to a grass raster map, through which the environment is defined.
-
JGrassMapEnvironment
public JGrassMapEnvironment(File mapsetFile, String mapName)
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 Detail
-
setReclassed
public void setReclassed(String reclassedMapset, String reclassedMap)
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
public String getMapName()
Getter for mapName.- Returns:
- the map name.
-
getPERMANENT_MAPSET
public File getPERMANENT_MAPSET()
Getter for PERMANENT MAPSET folder.- Returns:
- the PERMANENT MAPSET folder file.
-
getMAPSET
public File getMAPSET()
Getter for MAPSET folder.- Returns:
- the MAPSET folder file.
-
getLOCATION
public File getLOCATION()
Getter for LOCATION folder.- Returns:
- the LOCATION file folder.
-
getDEFAULT_WIND
public File getDEFAULT_WIND()
Getter for DEFAULT_WIND file.- Returns:
- the DEFAULT_WIND file.
-
getPROJ_INFO
public File getPROJ_INFO()
Getter for PROJ_INFO file.- Returns:
- the PROJ_INFO file.
-
getPROJ_WKT
public File getPROJ_WKT()
Getter for PROJ_WKT file.- Returns:
- the PROJ_WKT file.
-
getPROJ_UNITS
public File getPROJ_UNITS()
Getter for PROJ_UNITS file.- Returns:
- the PROJ_UNITS file.
-
getWIND
public File getWIND()
Getter for WIND file.- Returns:
- the WIND file.
-
getFCELL
public File getFCELL()
Getter for FCELL file.- Returns:
- the FCELL file.
-
getFcellFolder
public File getFcellFolder()
Getter for FCELL folder.- Returns:
- the FCELL folder file.
-
getCELL
public File getCELL()
Getter for CELL file, i.e. the main map file.- Returns:
- the CELL file.
-
getMapFile
public File getMapFile()
Getter for the main map file.- Returns:
- the main map file.
-
getCellFolder
public File getCellFolder()
Getter for CELL folder.- Returns:
- the CELL folder file.
-
getCATS
public File getCATS()
Getter for CATS file.- Returns:
- the CATS file.
-
getCatsFolder
public File getCatsFolder()
Getter for CATS folder.- Returns:
- the CATS folder file.
-
getHIST
public File getHIST()
Getter for the history file.- Returns:
- the HIST file.
-
getCELLHD
public File getCELLHD()
Getter for CELLHD file.- Returns:
- the CELLHD file.
-
getCOLR
public File getCOLR()
Getter for COLR file.- Returns:
- the COLR file.
-
getColrFolder
public File getColrFolder()
Getter for COLR folder.- Returns:
- the COLR folder file.
-
getCELLMISC_FORMAT
public File getCELLMISC_FORMAT()
Getter for CELLMISC_FORMAT file.- Returns:
- the CELLMISC_FORMAT file.
-
getCELLMISC_QUANT
public File getCELLMISC_QUANT()
Getter for CELLMISC_QUANT file.- Returns:
- the CELLMISC_QUANT file.
-
getCELLMISC_RANGE
public File getCELLMISC_RANGE()
Getter for CELLMISC_RANGE file.- Returns:
- the CELLMISC_RANGE file.
-
getCELLMISC_NULL
public File getCELLMISC_NULL()
Getter for CELLMISC_NULL file.- Returns:
- the CELLMISC_NULL file.
-
getRECLASSEDENVIRONMENT
public JGrassMapEnvironment getRECLASSEDENVIRONMENT()
Getter for RECLASSEDENVIRONMENT.- Returns:
- the RECLASSEDENVIRONMENT.
-
getColorRules
public List<String> getColorRules(double[] range) throws IOException
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
public List<String> getCategories() throws IOException
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
public JGrassRegion getActiveRegion() throws IOException
Read theJGrassRegion
from the active region file.- Returns:
- the active grass region.
- Throws:
IOException
-
getRangeFromColorTable
public double[] getRangeFromColorTable() throws IOException
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
public double[] getRangeFromRangeFile() throws IOException
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
public double[] getRangeFromMapScan() throws IOException
Reads the data range by reading the map.- Returns:
- the data range.
- Throws:
IOException
-
getLegendString
public String getLegendString() throws IOException
Getter for the legend string.- Returns:
- the legendstring.
- Throws:
IOException
-
getCategoriesString
public String getCategoriesString() throws IOException
Getter for the categories string.- Returns:
- the categories string.
- Throws:
IOException
-
getCoordinateReferenceSystem
public CoordinateReferenceSystem getCoordinateReferenceSystem() throws Exception
Read thecrs
from the location.- Returns:
- the crs of the location containing the map.
- Throws:
Exception
-
getFileRegion
public JGrassRegion getFileRegion() throws IOException
Read the file region of the map.- Returns:
- the
JGrassRegion
of the file. - Throws:
IOException
-
-