WMS, WMTS, TMS - Query

Hi

I can load OpenStreetMaps with the following
If providers.Add(providerID, “Custom TMS provider”, “https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png”, tkTileProjection.SphericalMercator, 0, 18) = False Then

I now need to add the aerial photo provided by our organization. I think it is a WMTS server. Can this be accessed in the same manner as above. I have seen documentation saying that WMTS is not yet supported but that was over a year ago. Has this changed, if not is there another way to load the aerial photos in a speedy fashion. I also have access to the ECW files and the TIFF files.
This will be a deal breaker for me and it will be a pity as I have been able to do everything else that I could previously do in MapObjects so far.

Regards

Colleen Crawford

Hello Colleen.

I don’t know anything about WMTS, and my initial review of the source code didn’t turn up any results.

We may have spoken about the ECW and/or TIFF files in the past. Both formats are supported, but they are assumed to be a single image as opposed to a set of tiled images. If they are tiled, then they would need to be organized in a directory structure similar to the web-based images (by zoom level and screen position).

Let me know if you need more clarification.

Regards,
Jerry.

As an afterthought, it may well be that the provider of the WMTS imagery can provide something like a URL that you could try out.

From what I understand there is Tile Map Server - is this what Open Street Map is?, then Web Map Server - where you have to give the bounding box coords for 1 image at a time, and then Web Map Tile Server which seems to be similar to Tile Map Server. I was wondering if WMTS would work the same way as the OpenStreetMap.

I saw this
TMS is a protocol created by OSGeo that allows tiles to be requested using integer indices. … WMTS is a protocol created by the OGC that allows tiles to be requested using integer indices. It also provides metadata for discovery and configuration.
I was hoping this meant it would work in the same way as Open Street Maps

I have tried the following

If providers.Add(providerID, “http://w8vmgis01.durban.gov.za/arcgis/rest/services/WebViewers/AerialPhotography2019/ImageServer/WMTS/1.0.0/WMTSCapabilities.xml/{zoom}/{x}/{y}.png”, tkTileProjection.SphericalMercator, 0, 18) = False Then

MsgBox “Cannot Load Aerial Photo”

MsgBox providers.ErrorMsg(providers.LastErrorCode)
End If
It just gives the error Invalid URL - I tried it without /{zoom}/{x}/{y}.png same error

From QGIS documentation it seems you have to find the path to the WMTSCapablilties.xml and then find the Open Data source icon - then add the path to the .xml and select the server.
I am struggling with how to do this in MapWinGIS - from documentation it seems like it can be done but I can;t find what parameters to use

This is from the ESRI documentation

http://map-image-vectorservice-url>/tilemap/////

The level, row, and column arguments select the level and the top-left tile location, while the width and height specifies the size of the requested area.

It is all very confusing to me. I will continue searching to see if I can find an example of how MapWINGIS opens the WMTSCapablilties.xml so that it displays the images.

There is also SOAP and JSON so not sure which one to use

Regards

Colleen Crawford

Hello Colleen.

Searching the MapWinGIS source code, I see nothing related to WMTS or WMTSCapabilities, etc. I don’t think it is supported. But as you say, you’ve come this far; so before throwing it all away, you might want to consider that since this is all open source, the functionality could be added. At this moment, I don’t know what it would take, and it may not be trivial, but we could look around to see how others are doing it.

Thanks for your help.

I will be able to ask the GIS section when they return so maybe I can access it some other way. I did see messages from P meems where they did seem to say that they had been able to access WMTS.
See below

palmerj commented on Jul 12, 2018

Does anyway have any idea why adding and using this GDAL WMTS source as a raster layer is so slow? In QGIS the GDAL WMTS source loads for me in about 5secs, and each pan and zoom of the map on 1920x1200 screen takes about 3sec. But in the MapWinGIS control it’s take x4-5 longer.

wmts.xml.zip

@pmeems

Contributor

pmeems commented on Jul 12, 2018

Hi Jeremy,

I can confirm the slow behavior. I’m not sure why this is. Probably because the cache is not (properly) used.
We need to look into this.

We already have an JIRA issue about this: [MWGIS-9] Support WMTS services - MapWindow5 - Issue tracker
Now we need a developer with time to work on this.
Are you by any change a C++ developer or do you have some budget so we can allocate a developer to work on this?

My other option I thought was to load the coords of the images into my own database and then just load the tiff, ecw that is relevant for wherever I am zoomed into. Will have to see how this goes.

Regards

Colleen

Hi Colleen,

do you know the ip-address of your wmts-Server?

when i do a simple

nslookup w8vmgis01.durban.gov.za

i got an error telling me: non-existent domain.

cheers

Not sure of the IP address, I can find it out, but I think it has something to do with permissions, as I can access it from my work machine, but not from my home machine.

Regards
Colleen Crawford

This is the error when I try and access it from my home machine
w8vmgis01.durban.gov.za ’s server IP address could not be found.

ERR_NAME_NOT_RESOLVED

From my work machine I can access it but it redirects me to a the GIS Page

Regards

Colleen

Hello Colleen.

So I feel a little sheepish. I realize now that although MWGIS doesn’t natively support WMTS, it didn’t occur to me that GDAL might support the format. Of course, as you said in an earlier comment, the trick is to figure out how to use it within the context of MWGIS.

Have you reviewed this information? I’ve used the Vector drivers through GDAL, but never Raster drivers. I’ll see if there are any remnants in the MapWindow5 source code, or perhaps QGIS.

Jerry.

Hi Jerry

Thanks for the help, I looked at your info but not cled up on gdal at all.

It seems I am have the correct looking url - http://w8vmgis01.durban.gov.za/arcgis/rest/services/WebViewers/AerialPhotography2019/ImageServer/WMTS/1.0.0/WMTSCapabilities.xml
I have tried it with WMTS: in front as well. It also returns Invalid URL from within the app until I add /{zoom}/{x}/{y}.png - in this case it appears to work but a blank area is displayed on the Map.

Also if I type the url straight into chrome it will take me to the xml data - if I add eg 20/1200/1200.png for the parameters it takes me to the following screen

If I click on raster image I can see the image but can’t get it to display the image as I can for OpenStreetMaps

I will try and look at the MapWindow code and see if I can figure it out.

Here is some code from the .xml file

ows:ServiceIdentification

ows:TitleWebViewers_AerialPhotography2019</ows:Title>
ows:ServiceTypeOGC WMTS</ows:ServiceType>
ows:ServiceTypeVersion1.0.0</ows:ServiceTypeVersion>

</ows:ServiceIdentification>

ows:OperationsMetadata

<ows:Operation name=“GetCapabilities”>

ows:DCP

ows:HTTP

<ows:Get xlink:href=“http://w8vmgis01.durban.gov.za/arcgis/rest/services/WebViewers/AerialPhotography2019/ImageServer/WMTS/1.0.0/WMTSCapabilities.xml”>

<ows:Constraint name=“GetEncoding”>

ows:AllowedValues

ows:ValueRESTful</ows:Value>

</ows:AllowedValues>

</ows:Constraint>

</ows:Get>

<ows:Get xlink:href=“http://w8vmgis01.durban.gov.za/arcgis/rest/services/WebViewers/AerialPhotography2019/ImageServer/WMTS?”>

<ows:Constraint name=“GetEncoding”>

ows:AllowedValues

ows:ValueKVP</ows:Value>

</ows:AllowedValues>

</ows:Constraint>

</ows:Get>

</ows:HTTP>

</ows:DCP>

</ows:Operation>

<ows:Operation name=“GetTile”>

ows:DCP

ows:HTTP

<ows:Get xlink:href=“http://w8vmgis01.durban.gov.za/arcgis/rest/services/WebViewers/AerialPhotography2019/ImageServer/WMTS/tile/1.0.0/”>

<ows:Constraint name=“GetEncoding”>

ows:AllowedValues

ows:ValueRESTful</ows:Value>

</ows:AllowedValues>

</ows:Constraint>

</ows:Get>

<ows:Get xlink:href=“http://w8vmgis01.durban.gov.za/arcgis/rest/services/WebViewers/AerialPhotography2019/ImageServer/WMTS?”>

<ows:Constraint name=“GetEncoding”>

ows:AllowedValues

ows:ValueKVP</ows:Value>

</ows:AllowedValues>

</ows:Constraint>

</ows:Get>

</ows:HTTP>

</ows:DCP>

</ows:Operation>

</ows:OperationsMetadata>

ows:TitleWebViewers_AerialPhotography2019</ows:Title>
ows:IdentifierWebViewers_AerialPhotography2019</ows:Identifier>

<ows:BoundingBox crs=“urn:ogc:def:crs:EPSG::3857”>

ows:LowerCorner3383313.930740081 -3538173.791739587</ows:LowerCorner>
ows:UpperCorner3471775.685582804 -3439418.9065914745</ows:UpperCorner>

</ows:BoundingBox>

<ows:WGS84BoundingBox crs=“urn:ogc:def:crs:OGC:2:84”>

ows:LowerCorner30.392826149583104 -30.268995584591238</ows:LowerCorner>
ows:UpperCorner31.187491613935627 -29.49983460541403</ows:UpperCorner>

</ows:WGS84BoundingBox>

Default Style default

image/jpgpng

default028mm

GoogleMapsCompatible

ows:TitleTileMatrix using 0.28mm</ows:Title>
ows:AbstractThe tile matrix set that has scale values calculated based on the dpi defined by OGC specification (dpi assumes 0.28mm as the physical distance of a pixel).</ows:Abstract>
ows:Identifierdefault028mm</ows:Identifier>
ows:SupportedCRSurn:ogc:def:crs:EPSG::3857</ows:SupportedCRS>

ows:Identifier0</ows:Identifier>
5.59082264028501E8
-2.0037508342787E7 2.0037508342787E7
256
256
1
1

ows:Identifier1</ows:Identifier>
2.7954113201425016E8
-2.0037508342787E7 2.0037508342787E7
256
256
2
2

regards

Colleen Crawford

I have found the following and been trying them

Example 1 - Rest

''https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS/tile/1.0.0/WorldTimeZones/default/default028mm/1/0/0.png

''https://sampleserver6.arcgisonline.com/arcgis/rest/services/Toronto/ImageServer/WMTS/tile/1.0.0/Toronto/default/default028mm/13/2990/2289.png

My Code
http://w8vmgis01.durban.gov.za/arcgis/rest/services/WebViewers/AerialPhotography2019/ImageServer/WMTS/tile/1.0.0/WebViewers_AerialPhotography2019/default/default028mm/1/0/0.png

Example 2 - KVP

''https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS?service=WMTS&version=1.0.0&request=GetTile&layer=WorldTimeZones&style=default&tileMatrixSet=default028mm&tileMatrix=1&TileRow=0&TileCol=0&format=image/png

''https://sampleserver6.arcgisonline.com/arcgis/rest/services/Toronto/ImageServer/WMTS?service=WMTS&version=1.0.0&request=gettile&layer=WorldTimeZones&style=default&tileMatrixSet=default028mm&tileMatrix=13&TileRow=2990&TileCol=2289&format=image/png

My Code
http://w8vmgis01.durban.gov.za/arcgis/rest/services/WebViewers/AerialPhotography2019/ImageServer/WMTS?service=WMTS&version=1.0.0&request=GetTile&layer= WebViewers_AerialPhotography2019&style=default&tileMatrixSet=default028mm&tileMatrix=1&TileRow=0&TileCol=0&format=image/png

By running the above examples in the browser I get the image,
Up to Image Server the page from the samples and my page look very similar. When I go into the WMTS xml file they are very similar. I am not sure what to put as Layer name as the KVP sample for Toronto has WorldTimeZones as the name but if I change this to Toronto it also works. I tried to substitute what I thought was needed for our site but just get Error: Not Found
Code: 404

I took the Layer Name from the WMTS xml code
!-- Layer →

ows:TitleWebViewers_AerialPhotography2019</ows:Title>

ows:IdentifierWebViewers_AerialPhotography2019</ows:Identifier>

Does anyone know where I am going wrong here

Thanks

Colleen

Hello Colleen.

If there’s not much response here, perhaps you could submit a question on the GDAL forum; you may get better information there…

Will do, thanks. If I ever sort this all out I will post the solution here

Regards

Colleen

Thanks. It would be good to know.
Kind Regards.

Hi Jerry

I found this that was a post from you in 2018.
Map1.Tiles.providers.Add tkTileProvider.ProviderCustom, “ESRI”, “https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}.png”, tkTileProjection.SphericalMercator, , , “Esri, DigitalGlobe, GeoEye, i-cubed, USDA FSA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community”
Map1.Redraw3 tkRedrawType.RedrawSkipAllLayers, True

It loaded an aerial photo in exactly the right place. The only problem is that you cannot zoom in very close as it gets very blurry, hence I need to load our aerial photo.

I got the following path from our GIS section - http://gis.durban.gov.za/arcgis/rest/services/WebViewers/MRF2019/ImageServer - you can view this as well as it allows me to view from my home machine. It looks similar to the ESRI one except it is an Image Server and not a Map Server - not quite sure what the difference is. Plus it does not have Layers. I can view it through their ARCGIS Java Viewer but when I use the above code it is just blank.

I am trying to make some sense out if this with our GIS dept.

Regards

Colleen

Hopefully I am getting somewhere. Our GIS dept has said that they would create a Map Server for me. Then it should work very easily as per the above code. So there is obviously a difference between Image Server and Map Server although they look very similar

Regards

Colleen