Publish Styles Only

Add Layers to QGIS

Previously, we used osm2pgsql to import a PBF file to our PostGIS database.

However, we never published the layers created to GeoServer.

1. Create a new qgis project, andorra.qgs

2. Expand the geosuite PostGIS connection

../_images/1-andorra.png ../_images/spacer11.png

3. Add the planet_osm_polygon layer to the project

../_images/2-andorra.png ../_images/spacer11.png

4. Add the planet_osm_points layer to the project

../_images/3-andorra.png ../_images/spacer11.png

Create Styles

1. In the top menu, go to Web > GeoCat > StyleViewer

../_images/5-andorra.png ../_images/spacer11.png

2. As shown below, the SLD style for our layer is displayed

../_images/4-andorra.png ../_images/spacer11.png

3. Double click the planet_osm_polygon layer to open the Properties box

../_images/7-andorra.png ../_images/spacer11.png

4. On the Symbology section, select a new fill color and click Save

../_images/8-andorra.png ../_images/spacer11.png

5. Our new polygon style is updated as below

../_images/10-andorra.png ../_images/spacer11.png

6. Repeat for the planet_osm_points layer, selecting ‘Blue Diamond’

../_images/good-no.png ../_images/spacer11.png

7. Again, we see the SLD style for the layer is displayed on save

../_images/good-no-2.png ../_images/spacer11.png

Publish Styles

1. As before, go to Web > GeoCat > Publish

../_images/22.png ../_images/spacer11.png

2. In order to publish only our styles to GeoServer, tick the “Symbology only” checkbox and then click Publish

../_images/auth-5.png ../_images/spacer11.png

3. We should see a success message like below

../_images/good-2.png ../_images/spacer11.png

Set Styles in GeoServer

1. Log in to GeoServer and click Add New Layer

../_images/layer-11.png ../_images/spacer11.png

2. Click the publish links for planet_osm_polygon and planet_osm_points layers from our PostGIS store

../_images/publish-andorra-1.png ../_images/spacer11.png

3. Go to Layers and select the planet_osm_polygon layer

../_images/publish-andorra-2.png ../_images/spacer11.png

4. On the Publish tab, select the green polygon style we uploaded above

../_images/publish-andorra-3.png ../_images/spacer11.png

5. Repeat for the planet_osm_points layer

../_images/publish-andorra-4.png ../_images/spacer11.png

6. The styles we created in QGIS and uploaded using GeoCat Bridge are now applied

../_images/publish-andorra-5.png ../_images/spacer11.png

Summary

We used GeoCat bridge to upload styles we created in QGIS and applied the styles in GeoServer