Managing WMS and WCS on multidimensional NetCDF Datasets with
Geoserver
•Martin Desruisseaux, Geomatys
•Mickael Treguer, Ifremer
Ocean physics
Ifremer
National institute of marine research, the French public institute for marine research, Ifremer contributes, through studies and expert assessments, to knowledge about the ocean and its resources, monitoring of marine and coastal zones and the sustainable development of maritime activities.To these ends, it designs and operates observational, experimental and monitoring tools and facilities. Ifremer manages the ocean research fleet for the French scientific community.
Fisheries and aquaculture Ocean floors
Example of gridded datasets
Physical Oceonography• Temperature and Salinity• Sea Surface Temperature• Current• Wave• …
Biological Oceanography• Ocean color (chlorophyll)
Digital Elevation Model (DEM) …
NetCDF (Common Data Form)
Binary format suitable for lots of different data types
• portable self-describing binary data format.
• NetCDF is used extensively in the atmospheric and oceanic science communities.
Climate and Forecast conventions should be applied to environmental data if possible
• for correct labelling of axes (latitude, longitude, time, pressure, etc)
• for standard naming of variables (sea_water_potential_temperature etc)
Can also be dissiminated via the protocol OPeNDAP
• you access data using a URL
Allow GIS clients to access NetCDF/OPeNDAP datasets via standards-based interface (WMS, WCS)
4-D web mapping
A number of mapping systems are now available on the web
• Most mapping software assumes two-dimensional data (x-y)
Environmental science data is dynamic and four-dimensional (x-y-z-t)
OGC WMS/WCS support 4(plus)-D data (elevation, time)
• But not many servers or clients support the full specification
OGC NetCDF architectureClient Application
(Mapbuilder)
WCS
NetCDF Interface
(Unidata)
OpenDAP
netCDF files
WMS
GeoServer / GeoTools
SeaGrid
•“SeaGrid” website provides very quick visualisations of gridded data
•Images generated dynamically on the server
Selection of depth
depth levels available on
the data
<Layer queryable="1">
<Name>geom:coriolis</Name>
...
<Dimension name="elevation" units="EPSG:5030"/>
<Extent name="elevation" default="5">5,10,20, ... ,1850,1900,1950</Extent>
...
</Layer>
Selection of time
time available on the data
animation
<Layer queryable="1">
<Name>geom:coriolis</Name>
...
<Dimension name="time" units="ISO8601"/>
<Extent name="time" default=" 2007-06-20T14:00:00Z ">2007-06-06T14:00:00Z,2007-06-13T14:00:00Z,2007-06-20T14:00:00Z</Extent>
...
</Layer>
WCS
Draw a bbox to extract raw raster
data
GetCoverage WCS
specification
Future enhancements
It is planned to improve :• Extraction WCS
– Official supported format : GeoTiff, HDF-EOS, DTED, NITF, GML
– Add Netcdf output (convention CF)
It is planned to provide :•Access to opendap (distributed datasets)
•WMS GetFeatureInfo to retreive geophysical data
•Display wind/current fields as vectors (directions and intensities)
Past work
In GeoTools– Wrote initial referencing module– Wrote initial coverage module
• Strong focus on geophysics data• Some processing capabilities• No raster input/output
On SourceForge– Created SeaGIS in 2002– Raster input/output performed there, requiring database– Initially designed for a specific problematic (fisheries...)– Running since 2002, trying to generalize since that time
Topics
PostGrid as a coverage catalog
Geographic Image I/O
Coverage catalog
« PostGrid » is a schema in a PostGIS database Contains coverage metadata, not pixel values Used as an index for fast coverage lookup
– Which data are available (what, where, when…)– How to get the data (filename, format…)– What the pixel values means (categories…)
Images stay files in their native format (NetCDF, PNG…)
Current PostGrid scope
Envelope up to 4 dimensions (x,y,z,t)– Mandatory horizontal (x,y)
• The SRID must be supported by PostGIS• The « grid to CRS » transform must be affine
– Optional vertical (z)• SRID must be provided, but doesn't need to be supported• Ordinates as an array of values
– Optional temporal (t)• Set of time ranges
Horizontal slices in arbitrary files for different (z,t)
Current PostGrid scope
Envelope up to 4 dimensions (x,y,z,t)– Mandatory horizontal (x,y)
• The SRID must be supported by PostGIS• The « grid to CRS » transform must be affine
Affine transform versus envelope
Can compute one from the other...
• grid range • affine transform• envelope
• coordinate reference system
... but envelopes are ambiguous!
– Do we reverse y axis direction?– Do we swap axes (x,y) → (y,x)?– What about oblique grids?
Always specify Transform rather than Envelope when possible
...but envelopes are still valuable for indexing!
Database schema overview
• identifier• layer• path• format
Series
• series• filename• startTime• endTime• extent
GridCoverages
• identifier• width, height• scaleX, scaleY, ...• horizontalSRID• horizontalExtent• verticalSRID• verticalOrdinates
GridGeometries1 ∞ ∞ 1
• An indexed geometry column• Always in WGS84 (not image CRS)• Automatically generated by trigger
Formats SampleDimensions Categories1 ∞ 1 ∞
∞
1
Categories
Pixel values ↔ Geophysics values
0 = no data ↔ NaN0
1 = clouds ↔ NaN1
2 = land ↔ NaN2
3 .. 255 = temperature ↔ -3 .. 40°C
Tell what the pixel values means Convert to and from geophysics values They are not styling Required even if the data are already geophysics
– Relationship to pixel values is typically fixed for a data set– What this NaN value is? (clouds, land...)
PostGrid library
GeoServer
PostGrid
Image I/O
PostGrid
GeoServer
Evaluation at a direct position
Data Operation InterpolationsSpatial
(bicubic)Temporal
(linear)
Finalvalue
Geographic Image I/O
Image I/O
Geographic Image I/O Geographic Image Metadata
Coverage I/O Grid Coverage
GeoServer PostGrid
NETCDF GML in JPEG2000
Rendered Image
ImageReader specializations
ImageReader
GeographicImageReader
FileImageReader
NetcdfImageReader
• Convenience class only; ignore if you want• Creates IndexColorModel from (min,max) and data type
• Support for implementations that can't read a stream
• 3th dimension (often z) as bands, but doesn't have to
Geographic Image Metadata
Subclass of IIOMetadataFormat Almost the only committed API
Demo
Questions?