ThinkGeo.com    |     Documentation    |     Premium Support

Load WMTS maps from geoserver

Hi,

I’m trying to load maps from geoserver through WMTS. I’m using following code:

        WmtsTiledOverlay wmtsTiledOverlay = new WmtsTiledOverlay(new Collection<Uri> { new Uri("http://172.31.89.208:8070/geoserver/gwc/service/wmts/") });
        wmtsTiledOverlay.WmtsServerEncodingType = WmtsSeverEncodingType.Kvp;
        wmtsTiledOverlay.Parameters.Add("LAYER", "World:WWDB_500m");
        wmtsTiledOverlay.Parameters.Add("STYLE", "_null");
        wmtsTiledOverlay.Parameters.Add("FORMAT", "image/png");
        wmtsTiledOverlay.Parameters.Add("TileMatrixSet", "EPSG:900913");
        wmtsTiledOverlay.InitializeConnection();
        Map1.Overlays.Clear();
        Map1.Overlays.Add(wmtsTiledOverlay);
        Map1.Refresh();

But after the refresh method I’m getting an exception:
Error on the remote server (400) Invalid request.

What’s the problem?

Regards
Gonzalo

Hi Gonzalo,

I cannot help you on this because it looks your server is a local IP.

I think you can check the capability of your WMTS server.

Add SendingWebRequest event, and catch the request url in it. Then compare the parameters to make sure whether anything is missing. You can do that for single tile, if the single tile works, then go back to adjust the parameters and make the entire layer works.

Wish that’s helpful.

Regards,

Ethan