GeoserverWidget

Description

The geoserver widget enables the display of large datasets on a map by utilising the web mapping service provided by geoserver.

At present the geoserver widget assumes data loaded onto geoserver is configured to use EPSG:4326 - WGS 84, latitude/longitude coordinate system based on the Earth's center of mass, used by the Global Positioning System among others.

To improve performance it is recommended that data loaded onto geoserver is in the form of a materialized view.

Attributes

center: Object - Lat/Lng object indicating the map center point.

zoom: Number - The initial zoom level of the map

maxZoom: Number - The max zoom allowed on the map. This should correspond to the value set on the layers loaded onto geoserver.

layers: Array - An array of layers that should be loaded from geoserver. Each layer consists of the following parameters:

name: String - The name of the layer to display in the layer selection dropdown.

workspace: String - The name of the workspace on geoserver in which the layer is stored.

layer: String - The name of the layer as it exists on geoserver.

featureActionText: String | Null - Text to display in the button when a feature is selected. If set to null no button will display.

Example

<raw type="GeoserverMapWidget" action="mapAction"> <content variable="rawMapContent" /> </raw>
{ "center": {"lat": -34.151771086784734, "lng": 21.258544921875}, "zoom": 10, "maxZoom": 19, "featureActionText": "Edit Properties", "layers": [ { "name": "Hessequa Stands", "workspace": "hessequa", "layer": "mv_bi_geo_stands_water" } ] }
Screenshot 2024-12-11 at 11.47.06.png

Features

Layers

The Geosever Map Widget allows for the display of multiple layers on the map but only allows for the selection of one layer at a time. The selection layer is indicated by the “pointer“ symbol in the layer dropdown. Clicking on the lock icon of a particular layer will make that layer the selection layer.

Screenshot 2024-12-11 at 11.47.17.png

Legends

Legends for your layers are automatically retrieved from geoserver and displayed in the legend tab. It is important to note that the legend is directly linked to the style used by the layer which is configured on geoserver.

Adding Layers on Geoserver

Log in to geoserver here https://sams-geoserver-staging.heliumapps.com/geoserver using your Helium ID credentials. (You may require permissions from devops to access geoserver)

  1. Create a workspace for your project - this will be where all the layers for your project live. (You may require devops to create the workspace for you)

  2. Create a store within your workspace - this will be the connection to a specific schema in the Helium Rapid database.

    1. After clicking “Add new store” select the option for “PostGIS Database“

    2. Select the correct workspace and fill in the required connection parameters
      host: za-preprod-db-1b
      (you may require the postgres user & password from devops)

    3. All other values can be left as is, click save

  3. Add your layers - these will be the layers you would like to display

    1. Before adding your layer, be sure to grant the necessary select & usage permissions on the schema you will be using for the geoserver user.

    2. Select the workspace you would like to add layers for

    3. All the tables within the specified schema will be displayed. Choose the desired table and click publish.

    4. The coordinate reference system should indicate EPSG:4326, if not you will need to set this correctly under “Declared SRS”

    5. Under bounding boxes you will need to click on both “Compute from data“ and “Compute from native bounds“

    6. Click save

  4. You can change the style of the layer either by creating a new style or selecting a predefined style.

    1. To select a predefined style click on the layer name on the layers page.

    2. Select the “Publishing” tab

    3. Scroll down to “WMS Settings” and select the default style from the dropdown.

  5. Create a new style - this will be the style for a specific layer and can be create within geoserver or via a program like Qgis. Once the style is created a legend will automatically be created on geoserver. You are also free to upload your own legend.

    1. Give your style a name and select the appropriate workspace.

    2. You can choose to generate a style based on existing styles to get started