TransWikia.com

How to get the URL path to a layer in Geoserver?

Geographic Information Systems Asked by DPSSpatial_BoycottingGISSE on September 30, 2021

From the Geoserver Layers Preview page, is there a way to get the URL of the services in the ‘All Formats’ drop-down?

Alternately, is there a way to change which formats are listed in the ‘Common Formats’ column?

I’ve been sharing the Layer Preview page to external users as a way to give a quick way to share our data in various formats, but would like to, for example, give the URL for a CSV or SHP rather than send instructions to pull the drop-down menu.

2 Answers

The url is specified in the WMS GetMap Request.

http://docs.geoserver.org/stable/en/user/services/wms/reference.html#getmap

It is similar to this

localhost:8080/geoserver/wms?
request=GetMap
&service=WMS
&version=1.1.1
&layers=topp%3Astates
&srs=EPSG%3A4326
&format=text/csv

The formats can be found here:

https://docs.geoserver.org/latest/en/user/services/wfs/outputformats.html

You can then alter the outputFormat paramemeter of the URL to accomodate whatever format you need using the values in the link to the formats above.

(comment from DPSSpatial:)

For me, changing the URL from GeoJSON (easy to access the URL via the Layer Preview page in Geoserver) from:

https://servername.whatever.org/geoserver/dpsworkspace/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=dpsworkspace:Schools_Current&maxFeatures=1000&outputFormat=application%2Fjson

to:

https://servername.whatever.org/geoserver/dpsworkspace/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=dpsworkspace:Schools_Current&maxFeatures=1000&outputFormat=SHAPE-ZIP

Correct answer by neogeomat on September 30, 2021

Nyes...

Looking at the HTML, we see that the URL is generated when selecting an item in the drop down menu. It has 2 base URLs, one for WMS and the other one for WFS, and then it adds the selected output format value to the base URL.

You could keep a list of the available format and replace the format from the common format link

Answered by JGH on September 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP