OGC : How to know which ogc service type is in my url location?

234 Views Asked by At

Having a predefined url for my ogc service how can i know if is wms or wfs: /My/predefined/URL/

Well i know that if i made /My/predefined/URL/?request=GetCapabilities i will find which service type is, but is there any faster way something like GetServiceType?

I want categorize my url from wms and wfs, and in some cases i could find that information directly on url but in other cases not. How can i do that without have to ask for each url getCapabilites and lookup for servicetype attribut to see if is wms or wfs.

2

There are 2 best solutions below

4
On

This is what GetCapabilities request is for. In some cases the URL may contain a hint which service type it is, but that's not always the case. So you have to ask the server and this is what GetCapabilities is for.

0
On

Well i know that if i made /My/predefined/URL/?request=GetCapabilities i will find which service type is, but is there any faster way something like GetServiceType?

Actually it is invalid to ask for a GetCapabilities response for an unknown service type, so if you can do this then your service must have the service parameter preset somehow.

To find out if your service is a WMS you need:

/My/predefined/URL/?request=GetCapabilities&service=WMS&

To find out if your service is a WFS you need:

/My/predefined/URL/?request=GetCapabilities&service=WFS&

To find out if your service is a WCS you need:

/My/predefined/URL/?request=GetCapabilities&service=WCS&

same for SOS, CSW, WPS, WMTS...

If the service is of the type specified you will get a GetCapabilities response, otherwise you will get an exception like:

<?xml version='1.0' encoding="UTF-8" ?>
<ServiceExceptionReport version="1.2.0"
xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wcs/1.0.0/OGC-exception.xsd">
  <ServiceException code="InvalidParameterValue" locator="request">msWCSDispatch(): WCS server error. WCS request not enabled. Check wcs/ows_enable_request settings.
  </ServiceException>
</ServiceExceptionReport>

Note it is entirely possible for a service endpoint like /My/predefined/URL/? to have multiple service types available.