Class NetCDFProjection
- Object
-
- NetCDFProjection
-
public class NetCDFProjection extends Object
Class used to properly setup NetCDF CF Projection parameters. Given a known OGC Projection, it will take care of remapping the Projection's parameters to NetCDF CF GridMapping parameters if supported.- See Also:
- NetCDF CF, Appendix F: Grid Mappings
-
-
Field Summary
Fields Modifier and Type Field Description static NetCDFProjection
ALBERS_EQUAL_AREA
Currently supported NetCDF projections.static NetCDFProjection
LAMBERT_AZIMUTHAL_EQUAL_AREA
static NetCDFProjection
LAMBERT_CONFORMAL_CONIC_1SP
static NetCDFProjection
LAMBERT_CONFORMAL_CONIC_2SP
static NetCDFProjection
MERCATOR_1SP
static NetCDFProjection
MERCATOR_2SP
static NetCDFProjection
ORTHOGRAPHIC
static String
PARAMS_SEPARATOR
static NetCDFProjection
POLAR_STEREOGRAPHIC
static NetCDFProjection
ROTATED_POLE
static NetCDFProjection
STEREOGRAPHIC
static NetCDFProjection
TRANSVERSE_MERCATOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
Return the NetCDF CF GridMapping nameParameterValueGroup
getNetcdfParameters(ParameterValueGroup ogcParameters)
Subclasses override this if they wish to adjust OGC parameters before they are written to NetCDF.String
getOGCName()
Return the OGC/GeoTools projection nameParameterValueGroup
getOgcParameters(ParameterValueGroup netcdfParameters)
Subclasses override this if they wish to adjust OGC parameters after they are read from NetCDF.Map<String,String>
getParameters()
Returns the underlying unmodifiable Referencing to NetCDF parameters mapping.static NetCDFProjection
getSupportedProjection(String projectionName)
Get a NetCDF Projection definition referred by namestatic CoordinateReferenceSystem
lookForDatasetCRS(NetcdfDataset dataset)
Look for a dataset globalCoordinateReferenceSystem
definition provided through a spatial_ref global attribute.static CoordinateReferenceSystem
lookForVariableCRS(NetcdfDataset dataset, CoordinateReferenceSystem defaultCrs)
static CoordinateReferenceSystem
lookForVariableCRS(NetcdfDataset dataset, CoordinateReferenceSystem defaultCrs, Map<String,Object> crsProperties)
Look for a CoordinateReferenceSystem defined into a variablestatic CoordinateReferenceSystem
lookupForCustomEpsg(CoordinateReferenceSystem crs)
Check if any custom EPSG maps the provided crs and return that onestatic CoordinateReferenceSystem
parseProjection(NetcdfDataset dataset)
Look for a SPATIAL_REF global attribute and parsing it (as WKT) to setup aCoordinateReferenceSystem
static CoordinateReferenceSystem
parseProjection(Variable var)
Extract the georeferencing projection information from the specified variable and setup aCoordinateReferenceSystem
instancestatic CoordinateReferenceSystem
parseProjection(Variable var, NetCDFProjection.CRSParser crsParser)
Extract the georeferencing projection information from the specified variable and setup aCoordinateReferenceSystem
instancestatic CoordinateReferenceSystem
parseProjection(Variable var, NetCDFProjection.CRSParser crsParser, Map<String,Object> crsProperties)
Extract the georeferencing projection information from the specified variable and setup aCoordinateReferenceSystem
instance
-
-
-
Field Detail
-
PARAMS_SEPARATOR
public static final String PARAMS_SEPARATOR
- See Also:
- Constant Field Values
-
ALBERS_EQUAL_AREA
public static final NetCDFProjection ALBERS_EQUAL_AREA
Currently supported NetCDF projections. Check the CF Document- See Also:
- NetCDF CF, Appendix F: Grid Mappings
-
MERCATOR_1SP
public static final NetCDFProjection MERCATOR_1SP
-
MERCATOR_2SP
public static final NetCDFProjection MERCATOR_2SP
-
LAMBERT_AZIMUTHAL_EQUAL_AREA
public static final NetCDFProjection LAMBERT_AZIMUTHAL_EQUAL_AREA
-
TRANSVERSE_MERCATOR
public static final NetCDFProjection TRANSVERSE_MERCATOR
-
ORTHOGRAPHIC
public static final NetCDFProjection ORTHOGRAPHIC
-
POLAR_STEREOGRAPHIC
public static final NetCDFProjection POLAR_STEREOGRAPHIC
-
STEREOGRAPHIC
public static final NetCDFProjection STEREOGRAPHIC
-
LAMBERT_CONFORMAL_CONIC_1SP
public static final NetCDFProjection LAMBERT_CONFORMAL_CONIC_1SP
-
LAMBERT_CONFORMAL_CONIC_2SP
public static final NetCDFProjection LAMBERT_CONFORMAL_CONIC_2SP
-
ROTATED_POLE
public static final NetCDFProjection ROTATED_POLE
-
-
Method Detail
-
getParameters
public Map<String,String> getParameters()
Returns the underlying unmodifiable Referencing to NetCDF parameters mapping.
-
getName
public String getName()
Return the NetCDF CF GridMapping name
-
getOGCName
public String getOGCName()
Return the OGC/GeoTools projection name
-
getOgcParameters
public ParameterValueGroup getOgcParameters(ParameterValueGroup netcdfParameters)
Subclasses override this if they wish to adjust OGC parameters after they are read from NetCDF. This is the inverse ofgetNetcdfParameters(ParameterValueGroup)
.- Parameters:
netcdfParameters
- parameter values read from NetCDF- Returns:
- parameter values used for OGC projection
-
getNetcdfParameters
public ParameterValueGroup getNetcdfParameters(ParameterValueGroup ogcParameters)
Subclasses override this if they wish to adjust OGC parameters before they are written to NetCDF. This is the inverse ofgetOgcParameters(ParameterValueGroup)
.- Parameters:
ogcParameters
- parameter values used for OGC projection- Returns:
- parameter values written to NetCDF
-
getSupportedProjection
public static NetCDFProjection getSupportedProjection(String projectionName)
Get a NetCDF Projection definition referred by name
-
parseProjection
public static CoordinateReferenceSystem parseProjection(Variable var) throws FactoryException
Extract the georeferencing projection information from the specified variable and setup aCoordinateReferenceSystem
instance- Throws:
FactoryException
-
parseProjection
public static CoordinateReferenceSystem parseProjection(Variable var, NetCDFProjection.CRSParser crsParser) throws FactoryException
Extract the georeferencing projection information from the specified variable and setup aCoordinateReferenceSystem
instance- Throws:
FactoryException
-
parseProjection
public static CoordinateReferenceSystem parseProjection(Variable var, NetCDFProjection.CRSParser crsParser, Map<String,Object> crsProperties) throws FactoryException
Extract the georeferencing projection information from the specified variable and setup aCoordinateReferenceSystem
instance- Throws:
FactoryException
-
parseProjection
public static CoordinateReferenceSystem parseProjection(NetcdfDataset dataset)
Look for a SPATIAL_REF global attribute and parsing it (as WKT) to setup aCoordinateReferenceSystem
-
lookupForCustomEpsg
public static CoordinateReferenceSystem lookupForCustomEpsg(CoordinateReferenceSystem crs) throws FactoryException
Check if any custom EPSG maps the provided crs and return that one- Throws:
FactoryException
-
lookForVariableCRS
public static CoordinateReferenceSystem lookForVariableCRS(NetcdfDataset dataset, CoordinateReferenceSystem defaultCrs) throws FactoryException
- Throws:
FactoryException
-
lookForVariableCRS
public static CoordinateReferenceSystem lookForVariableCRS(NetcdfDataset dataset, CoordinateReferenceSystem defaultCrs, Map<String,Object> crsProperties) throws FactoryException
Look for a CoordinateReferenceSystem defined into a variable- Throws:
FactoryException
-
lookForDatasetCRS
public static CoordinateReferenceSystem lookForDatasetCRS(NetcdfDataset dataset)
Look for a dataset globalCoordinateReferenceSystem
definition provided through a spatial_ref global attribute.
-
-