Publish your Collection using the EDC / BC Geoservice

Publish you collections as WMS service. The BC geoservice provides access to publishing your collection as a WMS service using the geoDB Python client. Please refer to the geoserver documentation for configuring the rest API call to your WMS/geojson service.

You will have access to this service if you have purchased a large management account. This service is in beta mode. If you find any issues, please report them on our GitHub Issues page.

Init the GeoDB client

from xcube_geodb.core.geodb import GeoDBClient
geodb = GeoDBClient(raise_it=False, server_url='', gs_server_url='')

Create a Database and Copy some Public Data Across

my_database_name = 'my-urban-eea-subset-db13'

In case your database does not exist, you need to uncomment the following line and create the database. Please note, that database names must be unique, which means if another user has already used a database name you cannot create a database with the same name.

<xcube_geodb.core.message.Message at 0x7f47d17014c0>

Here we copy a collection from a public database, so we can publish as a geoservice.

geodb.copy_collection(collection='SI001L2_LJUBLJANA_UA2018', new_collection='SI001L2_LJUBLJANA_UA2018', database='eea-urban-atlas', new_database=my_database_name)
<xcube_geodb.core.message.Message at 0x7f47cfa4e100>

You can check if the colleciton was successfully added to your database:

owner database collection table_name
0 geodb_965a53df-6c09-4de2-b9ec-1052a2a9534a my-urban-eea-subset-db13 SI001L2_LJUBLJANA_UA2018 SI001L2_LJUBLJANA_UA2018
## List Collections Published on the BC WMS Service


Publish your Collection to the BC WMS Service

geodb.publish_gs(collection='SI001L2_LJUBLJANA_UA2018', database=my_database_name)
<xcube_geodb.core.message.Message at 0x7f47d0983670>

You can now click on the preview link which will give you an unstyled view of your WMS output.

## List Collections Published on the BC WMS Service

<xcube_geodb.core.message.Message at 0x7f47d09912b0>

View the Data

Once you have published you collection, you can use the WMS service to visualise your collection. For this using ipyleaflet. In this example we have used a pre-defined style. You can always provide a custom style using the parameter sld. We have provided a class that will pass that parameter to the WMS service. Just replace WMSLayer with SldWMSLayer. The sldparameter is given as a URL to an SLD file.

url = f"{my_database_name}/wms?"

from ipyleaflet import Map, WMSLayer, basemaps
from traitlets import Unicode

class SldWMSLayer(WMSLayer):

    sld = Unicode('').tag(sync=True, o=True)

wmsn = WMSLayer(
#     sld=''
m = Map(basemap=basemaps.CartoDB.Positron, center=(46.0, 14.5), zoom=13)

geodb.unpublish_gs(collection='SI001L2_LJUBLJANA_UA2018', database=my_database_name)
[ ]:
geodb.drop_collection('SI001L2_LJUBLJANA_UA2018', database=my_database_name)