WMS files returning data but not rendering layer on map

Ben Zaganjori 5 Reputation points


I am trying to load the following WMS services on to my Azure Maps/atlas instance and I am running into multiple issues:

  1. British Columbia bedrock geology (WMS)- https://openmaps.gov.bc.ca/geo/pub/WHSE_MINERAL_TENURE.GEOL_BEDROCK_UNIT_POLY_SVW/ows?service=WMS&request=GetCapabilities for British Columbia does not load any layers onto the map even though the service is accepted. The layer data is returned but the layer is not rendered on the map. Browser console doesn't display any error and the <Format> tag under <GetMap> (for the URL above) shows image/png, image/jpeg and other supported formats which is what Azure maps expects. I even tried by manually providing the layers to options.activeLayers but it didn't work. 
  2. Canada Geology Map (WMS service that has layers for Surficial Geology and Bedrock Geology)- https://canada3d-geo-onegeology.azurewebsites.net/ows?SERVICE=WMS&REQUEST=GetCapabilities gives error "Could not load image because of The source image could not be decoded. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported." even though the XML response contains <Format> image/png, image/jpeg as supported. Just like in #1, this endpoint also returns the layer data but the layer does not get rendered on the map. I tried with the following Australia WMS URL: https://services.ga.gov.au/gis/services/GA_Surface_Geology/MapServer/WmsServer?request=GetCapabilities&service=WMS and it works fine (this one has image/svg+xml listed as format, in addition to image/png). For this WMS service, the layer data gets returned and the map is rendered correctly. 
  3. British Columbia 1:250k bedrock geology from OneGeology-  http://apps.empr.gov.bc.ca/geoserver/cgi/ows?SERVICE=WMS& or http://apps.empr.gov.bc.ca/geoserver/cgi/wms?service=WMS&version=1.1.0&request=GetMap&layers=cgi%3ACA-BC-BCGS-bedrock-geology gives the following errors: 
    a. Failed to load resource: net::ERR_CERT_COMMON_NAME_INVALID 
    b. Error parsing capabilities.
    c. atlas.min.js:55 Error: Unexpected token 'G', "GIF89a

I also tried the proposed solutions here: https://learn.microsoft.com/en-us/answers/questions/151804/azure-maps-ogc-map-layer-capabilities-support but this didn't work.

I would really appreciate some help on this!




A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,076 questions
Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
663 questions
{count} vote

1 answer

Sort by: Most helpful
  1. rbrundritt 16,471 Reputation points Microsoft Employee

    I went through and tested those services, here is what I found:

    1. British Columbia bedrock geology (WMS) - This seems to be accessible and everything by the image display is working. Looking into this the service is returning an XML file instead of a PNG. This XML has an error message regarding the default style. The issue seems to be that this service doesn't have a default style which is unusual as this is the first WMS service I've come across where this is the case (I've scanned over 172K WMS services). As such you need to specifically tell the layer which style to use. Here is an example:
          var firstLayer = capabilities.sublayers[0];
          layer.setOptions({ activeLayers: [firstLayer], styles: [firstLayer.styles.id]})
      Note that if you are zoomed out such that you see all of British Columbia, you may not see anything on the map. The service requires you to be zoomed in before it returns any images with data on them.
    2. Canada Geology Map - This failed initially for me due to a CORs issue (the service doesn't support CORs) and I needed to use a proxy service to connect to this service. This service looked to have the same issue with a missing default style, but even after using the previous fix, it still didn't work. I tried one of the image requests directly in the browser and it worked, but when I pass that request through a proxy service, I would get an error returned from the service. It looks like this service is blocking proxy services from accessing it. It might be possible to modify the headers of the request in the proxy to trick that service but you would need to do some experimenting. I noticed that this site also has a WMTS endpoint and that does work. Here is the endpoint: https://canada3d-geo-onegeology.azurewebsites.net/gwc/service/wmts?REQUEST=GetCapabilities however it seems this server is pretty slow and sometimes returns 503 errors. Overall there is a bunch of issues with this service in general.
    3. British Columbia 1:250k bedrock geology from OneGeology - I tried both the URLs you provided in the browser and they both return errors, thus why the map can't connect to them. Checking the server I found the following two valid WMS and WMTS endpoints: That said, it appears this server does not have HTTPS endpoints, only HTTP (odd in this day and age). So you likely won't be able to directly connect to this server from the map and will need a proxy service. That said, this service ended up having the same issues as #2. I made a bit more progress using the WMTS endpoint, but only enough to find out that this service is locked down and requires a username and password to access.
    1 person found this answer helpful.