Child pages
  • Adding netCDF to Geoserver
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

GeoServer is an open source server for sharing geospatial data. It is often used to publish shapefiles and PostGIS tables (Vector data), ArcGrid and GeoTiff (Raster data). Moreover, it also allows for configuration of (cascading) remote WMS. Deltares maintains its own instance of GeoServer here. Data layers from GeoServer can be exposed in via WMS/WFS in many standard formats for subsequent public use. As NetCDF data format is widely used by the scientific community, ingesting that data through GeoServer tools represents a valid and useful alternative of data dissemination. Additional information on NetCDF data format can be found here.

This tutorial refers to GeoServer <stable> version 2.8.2 on Windows. Since the stable version of GeoServer does not allow ingestion of NetCDF as input Coverage Format, Geoserver Extension can be installed from http://geoserver.org/release/2.8.x/. Once the extension has been downloaded, the .jar files have to be copied to GeoServer 2.8.2\webapps\geoserver\WEB-INF\lib\. For any of the following steps, the easiest way to work with NetCDF Coverage input is to use the user interface provided by GeoServer installation. However, for reasons of efficiency and process automation a client might prefer to use the REST API GeoServer provides. The REST configuration allows you to work with bindings from various programming languages or simply with cURL command line tool. Python bindings are also available from gsconfig.py, but there is no implementation of working with NetCDF files yet. 

Adding a NetCDF data store

GeoServer User interface

First of all, create and add a workspace. That has to be done prior to the store creation for our NetCDF resources. Once the workspace is created, you can add a NetCDF data store by following this page.

RESTful interface

Add a workspace called ws.

Python | gsconfig.py
import os
from geoserver.catalog import Catalog

geoserverRestURL = "http://localhost:8090/geoserver/rest/"
username = "admin" 
password = "geoserver"
workspace = 'ws'

cat = Catalog(geoserverRestURL, username, password)
ws = cat.create_workspace(workspace, workspace)
cmd | cURL
curl -u admin:geoserver -v -POST -H "Content-type: text/xml" -d "<workspace><name>ws</name></workspace>" "http://localhost:8090/geoserver/rest/workspaces"
Python | requests
import os
import requests
import zipfile

headers_xml = {'content-type': 'text/xml'}
headers_zip = {'content-type': 'application/zip'}
headers_sld = {'content-type': 'application/vnd.ogc.sld+xml'}

r_create_workspace = requests.post("http://localhost:8090/geoserver/rest/workspaces", 
    auth=('admin', 'geoserver'), 
    data='<workspace><name>' + workspace + '</name></workspace>',
    headers=headers_xml) 

At this moment, the NetCDF plugin supports datasets where each variable’s axis is identified by an independent coordinate variable, therefore two dimensional non-independent latitude-longitude coordinate variables aren’t currently supported.

 

 

 

  • No labels