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 NetCDFProjectionALBERS_EQUAL_AREACurrently supported NetCDF projections.static NetCDFProjectionLAMBERT_AZIMUTHAL_EQUAL_AREAstatic NetCDFProjectionLAMBERT_CONFORMAL_CONIC_1SPstatic NetCDFProjectionLAMBERT_CONFORMAL_CONIC_2SPstatic NetCDFProjectionMERCATOR_1SPstatic NetCDFProjectionMERCATOR_2SPstatic NetCDFProjectionORTHOGRAPHICstatic StringPARAMS_SEPARATORstatic NetCDFProjectionPOLAR_STEREOGRAPHICstatic NetCDFProjectionROTATED_POLEstatic NetCDFProjectionSTEREOGRAPHICstatic NetCDFProjectionTRANSVERSE_MERCATOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()Return the NetCDF CF GridMapping nameParameterValueGroupgetNetcdfParameters(ParameterValueGroup ogcParameters)Subclasses override this if they wish to adjust OGC parameters before they are written to NetCDF.StringgetOGCName()Return the OGC/GeoTools projection nameParameterValueGroupgetOgcParameters(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 NetCDFProjectiongetSupportedProjection(String projectionName)Get a NetCDF Projection definition referred by namestatic CoordinateReferenceSystemlookForDatasetCRS(NetcdfDataset dataset)Look for a dataset globalCoordinateReferenceSystemdefinition provided through a spatial_ref global attribute.static CoordinateReferenceSystemlookForVariableCRS(NetcdfDataset dataset, CoordinateReferenceSystem defaultCrs)static CoordinateReferenceSystemlookForVariableCRS(NetcdfDataset dataset, CoordinateReferenceSystem defaultCrs, Map<String,Object> crsProperties)Look for a CoordinateReferenceSystem defined into a variablestatic CoordinateReferenceSystemlookupForCustomEpsg(CoordinateReferenceSystem crs)Check if any custom EPSG maps the provided crs and return that onestatic CoordinateReferenceSystemparseProjection(NetcdfDataset dataset)Look for a SPATIAL_REF global attribute and parsing it (as WKT) to setup aCoordinateReferenceSystemstatic CoordinateReferenceSystemparseProjection(Variable var)Extract the georeferencing projection information from the specified variable and setup aCoordinateReferenceSysteminstancestatic CoordinateReferenceSystemparseProjection(Variable var, NetCDFProjection.CRSParser crsParser)Extract the georeferencing projection information from the specified variable and setup aCoordinateReferenceSysteminstancestatic CoordinateReferenceSystemparseProjection(Variable var, NetCDFProjection.CRSParser crsParser, Map<String,Object> crsProperties)Extract the georeferencing projection information from the specified variable and setup aCoordinateReferenceSysteminstance
-
-
-
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 aCoordinateReferenceSysteminstance- 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 aCoordinateReferenceSysteminstance- 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 aCoordinateReferenceSysteminstance- 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 globalCoordinateReferenceSystemdefinition provided through a spatial_ref global attribute.
-
-