ThinkGeo.com    |     Documentation    |     Premium Support

Errors connection to some WMTS

Hallo,
I try to use some wmts-services, without luck. I use following URLs:

When I use the following Code - the app hangs…

private void Window_Loaded(object sender, RoutedEventArgs e)
{
bool logInRequired = false;
bool networkAvailibe = false;
var myProxy = WebProxyHelper.DismaWebProxy(out logInRequired, out networkAvailibe, “http://www.contoso.com”, false);

        Map1.MapUnit = GeographyUnit.Meter;
        Map1.CurrentExtent = new RectangleShape(4950653.58289573, 23129180.9399217, 81969633.6420015, -22972627.2458641);
        WmtsTiledOverlay wmtsTiledOverlay = new WmtsTiledOverlay(new Collection<Uri> { new Uri("https://geodienste.sachsen.de/wmts_geosn_webatlas-sn/guest") });
        wmtsTiledOverlay.WmtsServerEncodingType = WmtsSeverEncodingType.Kvp;
        wmtsTiledOverlay.Parameters.Add("LAYER", "WebAtlasSN");
        wmtsTiledOverlay.Parameters.Add("STYLE", "default");
        wmtsTiledOverlay.Parameters.Add("FORMAT", "image/png");
        wmtsTiledOverlay.Parameters.Add("TileMatrixSet", "grid_3857");
        wmtsTiledOverlay.WebProxy = myProxy;
        wmtsTiledOverlay.InitializeConnection();
        // contextualWMSLegend=0&crs=EPSG:3857&dpiMode=7&featureCount=10&format=image/png&layers=WMTS&styles=default&tileMatrixSet=grid_3857&url=https://geodienste.sachsen.de/wmts_geosn_webatlas-sn/guest?SERVICE%3DWMTS%26REQUEST%3DGetCapabilities
        Map1.Overlays.Add(wmtsTiledOverlay);
        Map1.Refresh();
    }

When i use the following Code, the App hangs in Drawcore…

    public DismaWmtsRasterLayer(Uri uri, System.Net.IWebProxy proxy) : base()
    {
        this.ServerUris.Add(uri);
        this.WmtsSeverEncodingType = WmtsSeverEncodingType.Kvp;

        this.UpperScale = double.MaxValue;
        this.LowerScale = 0;

        this.WebProxy = proxy;
        this.Open();

        Collection<string> layers = this.GetServerLayerNames();
        Collection<string> styles = this.GetServerLayerStyles();
        Collection<string> tileMatrixSetNames = this.GetServerTileMatrixSetNames();

        if (layers.Count > 0) this.ActiveLayerName = layers[0];
        if (styles.Count > 0) this.ActiveStyleName = styles[0];
        Collection<string> formats = this.GetLayerOutputFormats(ActiveLayerName);
        if (formats.Count > 0) this.OutputFormat = formats[0];

        // if (tileMatrixSetNames.Count > 0) this.TileMatrixSetName = tileMatrixSetNames[0];
        this.TileMatrixSetName = "grid_3857";
        this.Close();
    }

    protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)
    {
        if (string.IsNullOrWhiteSpace(this.ActiveLayerName)) return;
        base.DrawCore(canvas, labelsInAllLayers);
    }

Please advise, how to resolve These Errors…

Regards Torsten

Hi Torsten,

Our developer research your capability and found some problem:

a. For you code, please modify your code

from wmtsTiledOverlay.Parameters.Add(“LAYER”, “WebAtlasSN”);

to wmtsTiledOverlay.Parameters.Add(“LAYER”, “WMTS”);

b. For your server( https://geoportal.sachsen.de/mapviewer2/proxy?https://geodienste.sachsen.de/wmts_geosn_webatlas-sn/guest?&request=GetCapabilities&service=WMTS&version=1.0.0), the ows:Identifier of TileMatrix is not the correct format, for example it should be something like “grid_3857:3” but not “03”

So the tile link should be looks like:
https://geodienste.sachsen.de/wmts_geosn_webatlas-sn/guest?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=WMTS&STYLE=default&FORMAT=image/png&TileMatrixSet=grid_3857&TileMatrix=grid_3857:3&TileRow=0&TileCol=0

As below is the other capability we found with standard format, you can refer that.

wmts-getcapabilities.xml (183.2 KB)

If you have any update about this please let us know.

Regards,

Ethan

Hi Ethan,

thanks for your replay. I will try to connect with the Service Provider for the mentioned WMTS in saxonia.
I’m not familary with the capabilities-files returned wmts. But when I try to connect with some other wmts-services in Germany (offerd by our authorities) the string for the ows-identifier seems to be the same as for the saxonia Services. It’s really a mistake by our providers?

Regards Torsten

Hi Ethan,

there is another URL i tried to connect - http://www.geodaten-mv.de/dienste/webatlasde_wmts

Regards Torsten

Hi Torsten,

Thanks for your further information, I double check that again, and I want to described this problem more clearly.

The reason is our WMTS class will automatic add “grid_3857” for the “TileMatrix” parameter for KVP type server, and it will ignore the start “0” for example make “01” to “0”. But the WMTS provider don’t support this format, that’s why it don’t works.

So the workaround for it is, you can modify the uri in sending request event, just replace the TileMatrix parameter to make it valid for the server.

And here is the sample for you:

8739.zip (10.2 KB)

Wish that’s helpful.

Regards,

Ethan

Hallo Ethan,

that was really helpfull. Many thanks.

Regards
Torsten

Hi Juergen,

I am glad to hear that’s helpful.

Regards,

Ethan

Hello Ethan,

I know the Topic is old, but after I update MapSuite (WPF) from Version 10.2.1 to the latest Version 10.3, the mentioned wmts (see start of the thread) doesen’t show. As you advised, i have included the workaround in the sending request Event (correct the TileMatrix parameter) - and it worked in Version 10.2.1.

Now, an error occurs:

System.NullReferenceException:
bei ThinkGeo.MapSuite.Layers.WmtsLayer.ZkE=(Collection1 cells, TileMatrix tileMatrix) bei ThinkGeo.MapSuite.Layers.WmtsLayer.bDY=(GeoCanvas canvas) bei ThinkGeo.MapSuite.Layers.WmtsLayer.DrawCore(GeoCanvas canvas, Collection1 labelsInAllLayers)
bei Tis.Client.Map.Layers.WMTSLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)

How can i solve the rroblem?

Regards Torsten

Hi Juergen,

Thanks to let us know that.

It’s introduced when we fix one other issue.

Please wait our new package WMTS 10.3.1, and the WPF need to get the latest version at the same time.

The new package will be available in one or two days.

Regards,

Ethan

Hi Ethan,

work’s perfect. Thanks.

Regards,
Torsten

Hi Torsten,

I am glad to hear that works.

Regards,

Ethan

Hallo Ethan,

one more question – or a new problem: the tiles from the wmts-services (mentioned above - http://www.geodaten-mv.de/dienste/webatlasde_wmts) don’t fit exactly (there are small white borders). Please see the attached picture.

How can I solve this problem?

Regards
Torsten

Hi Juergen,

Please get this package https://www.nuget.org/packages/ThinkGeo.MapSuite/11.0.0-beta080, it will be available in one or two days.

Regards,

Ethan