5

I'm trying to add an External WMS layer to geoserver with a PHP page, using the REST service of Geoserver. I've already read the tutorials for creating the geoserver features (http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html), but i couldn't find the way to create a new store and layer with an external WMS service.

in other words: I have the URL of the external WMS service (=store), the layer i want to publish (=layer) and the epgs i want to use.

Is there a way to load all of these information in the geoserver schema?

6

Unfortunately this is not documented in the api reference or samples. But here is the gist of it.

First create the store:

POST /rest/workspaces/<ws>/wmsstores

<wmsStore>
   <name>wms</name>
   <capabilitiesURL>http://somehost/wms?</capabilitiesURL>
   <workspace>sf</workspace>
</wmsStore>

And then create the layers:

POST /rest/workspaces/<ws>/wmsstores/wms/wmslayers/

<wmsLayer>
   <name>layerName</name>
</wmsLayer>
  • Thank you jdeolive for the answer, i'll try to implement this code in my php application. But, i can't figure out how could do that. Can you tell me with more details how can i add this POST code to a php page? Maybe this is a stupid question, but really, i can't figure how to use this REST commands with php – Michele 2 Apr 17 '12 at 22:14
  • You can add <type>WMS</type> into wmsStore-tag so in the datasources overview in geoserver the type of this datasource gets specified instead of default "?" (applies for geoserver 2.2.3 in my case). I also had to specify header "Content-Type=application/xml". – ulrich Aug 25 '15 at 7:45
  • If you need a complete guide, go here gis.stackexchange.com/questions/200813/… – Magno C Jul 7 '16 at 19:24
0

You can also manually configure GeoServer for external WMS layers as explained here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.