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"
}
]
}
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.
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 Log in to | SAMS Geoserver using your Helium ID credentials. (You may require permissions from devops to access geoserver)
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)
Create a store within your workspace - this will be the connection to a specific schema in the Helium Rapid database.
After clicking “Add new store” select the option for “PostGIS Database“
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)All other values can be left as is, click save
Add your layers - these will be the layers you would like to display
Before adding your layer, be sure to grant the necessary
select
&usage
permissions on the schema you will be using for the geoserver user.Select the workspace you would like to add layers for
All the tables within the specified schema will be displayed. Choose the desired table and click publish.
The coordinate reference system should indicate EPSG:4326, if not you will need to set this correctly under “Declared SRS”
Under bounding boxes you will need to click on both “Compute from data“ and “Compute from native bounds“
Click save
You can change the style of the layer either by creating a new style or selecting a predefined style.
To select a predefined style click on the layer name on the layers page.
Select the “Publishing” tab
Scroll down to “WMS Settings” and select the default style from the dropdown.
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.
Give your style a name and select the appropriate workspace.
You can choose to generate a style based on existing styles to get started