Subscribe to this thread
Home - General / All posts - Tips and tricks: overcome limits of the Mfd WMS client
KlausDE

6,410 post(s)
#07-Feb-14 21:27

WMS services seem not to care about Manifold disliking the format and have become a popular datasource. The server often offers the choice for image types like png, jpg, gif, transparent or intransparent background or a variety of projections.

Manifold users are excluded from this bargain because Mfd only considers the first option in the lists and your neighbour using ArcWhatever grins.

However there is an easy way around this limitation for your most wanted datasources. You need to modify the answer of the GetCapabilities request. This is simple but you need to run your own internet server, not a big problem when nearly every NAS or router offers this function.

  1. Get the original GetCapabilities document. For this purpose copy the address you usually put in the wms client and paste it in your browsers address field. The browser can not display this file type as it has no extension and will download the file.
  2. What the browser did not know: the file is a simple XML file. So add extension .XML and open it for editing in your prefered XML editor, for instance in microsofts free XML Notepad. Ignore possible error messages.
  3. Choose image format: In Capability->Request->GetMap delete all format lines but the one you want or at least all lines that come before your preference.
  4. Choose projection: search the file for every occurrence of the tag CRS. You will find them in Capability->Layer as a list of elements, in BoundingBox as an Attribute and possibly in Capability->Layer->Layer, Capability->Layer->LAyer->BoundingBox. Delete all attributes CRS but the one containing a text EPGS:<your EPGS> and delete all BoundingBox- and Layer-branches with wrong EPGS.
  5. You may have seen attributes like opaque in the Layer element and can try to modify the value 0|1 and test if the server is willing to handel this.
  6. Save your GetCapabilities file, delete the .XML extension and load it up to your server. You may want to add the selected EPGS numbers to the basename.
  7. Fill in the address of this file on your server in your Mfd WMS. It will get maps from the original server but build the request as configuered in your modified GetCapabilities document.

As a very last step write a feature request for a WMS client with configurable attributes and send it to sales@manifold.net to make all this unnecessary some day.


Do you really want to ruin economy only to save the planet?

walter
20 post(s)
#20-Feb-14 16:43

Hello KlausDE,

nice workaround. Unfortunately it does not work for most public WMS services published by authorities in Baden-Württemberg, i.e. (link to getcapabilities-call of Wasserschutzgebietszone-Service from Landesanstalt für Umwelt, Messungen und Naturschutz Baden-Württemberg)

-- nobody takes local authorities seriously named with less than 100 letters --

I removed all coordinate systems except EPSG:31467 (this is what Manifold calls "Gauss-Kruger Zone 3 (DHDN)" ), Manifold links the image, but X and Y values are puzzled (see image).

In the getcapabilities-xml-file the bounding box element of the layer has interchanged X and Y values.

Any suggestions?

Attachments:
puzzled_xy.png

KlausDE

6,410 post(s)
#20-Feb-14 22:29

[posting doubled by Edit ]


Do you really want to ruin economy only to save the planet?

KlausDE

6,410 post(s)
#20-Feb-14 22:30

I've noticed this effect for datasources in Gauss-Kruger Zone 2 or 3 (DHDN) offered by authorities in Northrhine Westfalia, too but not for data offered in the new UTM projections. The different alignment of tiles is probably coded somewhere in the GetCapabilities document. I don't know where and obviously also the Mfd WMS client can't deal with this WMS flavor.

Time for a refurbisment of the WMS client. Sales have recieved my feature request but it didn't cover this aspect.


Do you really want to ruin economy only to save the planet?

tonyw
736 post(s)
#21-Feb-14 19:01

Hi KlausDE

Thanks for a great post. One question, when you mention running your own Internet server and nearly every router offers this function, can you elaborate? I've searched the setup for my cable modem/router and searched the web for suggestions but no answers. My understanding is I load up my revised GetCapbailities file to the router, I make the motions in Manifold to link to a WMS, link to where the uploaded file is stored, the uploaded file then makes the correct call to the WMS? Sorry for being obtuse. I would really like to make this work. I have also sent this feature request to sales.

thanks.

-Tony

KlausDE

6,410 post(s)
#21-Feb-14 23:02

What you need is an internet server. Every web configuration of your devices runs on a minimalistic internet server and AFAIK some routers and every NAS device I know offer a web space for your files.

If not that's no problem. While a full featured Apache server or a IIS use a significant amount of system resources and more RTFM skills than you might like for instance the Abyss Web Server is easy to manage, runs on your workstation in background and is easy to set up and maintain.

This solution running the Internet server on your workstation has the additional adventage that you'r ready to take the bait and test Manifolds IMS sooner or later.

Your description of the technology is correct. It's that simple and for the purpose of WMS redirection you don't need more than the 5 minutes Get Started example.


Do you really want to ruin economy only to save the planet?

tonyw
736 post(s)
#21-Feb-14 23:10

Excellent, thanks Klaus! This is exciting, it will raise the bar significantly with what I can do Manifold. In British Columbia (Canada), the provincial government has made most of its geospatial data for natural resources and land use information available via WMS but up to now I've had to use a another GIS to access it.

tonyw
736 post(s)
#08-Mar-14 20:10

Hi Klaus, I've made some progress bought a NAS with a webserver, have downloaded, saved and edited an .xml file from the BC provincial WMS server site here http://www.data.gov.bc.ca/dbc/geographic/connect/index.page

However I'm having the problem "Can't connect to server". I think my syntax is incorrect referring to the .xml file on the server. To simplify things I've mapped the folder on the webserver to be the M: drive. For testing I've gone back to using the downloaded but unaltered .xml file "base3" from the provincial server which I've copy and pasted to a folder on the server. This is the "Base Mapping and Trim" data set.

Testing in a Chrome web browser, when I enter the URL m:\base3 I get a tree view of the .xml file. So I think I'm correctly referencing the webspace on the NAS and correctly opening the stored .xml file.

Then back in Manifold, File > Link > Image > File type: OGC WMS servers, I entered the URL for the .xml file (renamed without ".xml") on the NAS and clicked the refresh icon. What happens is "Trying WMS 1.1.3", Trying WMS 1.1.2" etc. down to Trying WMS 1.0.0 then eventually "Can't connect to server".

This is the URL when copy and pasted from the provincial WMS site:

Original:

http://openmaps.gov.bc.ca/mapserver/base3?service=wms&request=getcapabilities&version=1.1.1

This is the URL modified to refer to the mapped drive on my NAS:

m:\base3 (which displays the document tree)

Also tried

file:///M:/base3 (which displays the document tree)

I've also tried the following, (which I don't think is correct, but worth a shot)

m:\base3?service=wms&request=getcapabilities&version=1.1.1 (Can't connect to server)

If this was working I'm expecting to see the list of maps available on the provincial WMS server. Wondering if I'm missing a step? Anyone try this with the provincial WMS servers. It would be so great to get access to all those maps via WMS.

tonyw
736 post(s)
#09-Mar-14 04:15

Some more progress for a day's work. I used FTP to post the xml file to some webspace on a hosted server instead of the NAS. Posting to the hosted website worked, no more connection error. I'm connecting and can see the list of available layers. However when I load a layer I get back a purple square. So close, yet still so far.

I'm using Windows XML Notepad. It's find and replace operations are very slow yet the XML file is very small, maybe 165 kb. I've spent hours editing and still haven't produced one finished xml file with all the changes. There are 29 other such files available. I haven't found a way to Find and Delete so I find and delete LatLonBoundingBox so I Find and delete manually, one at a time. I've been testing with partially edited files working on one section at a time. While a good learning exercise, if the government changes the xml files, I can't see editing them again.

Thanks Klaus for the path. I have some other ideas including writing my own get capabilities file, I'm not sure how hard that would be. This is closer than I've ever been in several years of trying to use the data on the provincial WMS in my Manifold maps.

KlausDE

6,410 post(s)
#09-Mar-14 10:14

Thats the cumbersome way to go. (Manifold?-)WMS doesn't support GetCapabilities requests other than by html protocol.

Many NAS devices offer html access from the internet. It's that mode you have to configure for a local html server.


Do you really want to ruin economy only to save the planet?

tonyw
736 post(s)
#09-Mar-14 18:31

Hi Klaus,

I probably used wrong terminology, what I called the GetCapabilities file is the XML file that gets downloaded. I'm just a user and no techie. Writing anything custom as a plug-in to Manifold is beyond me, what I was thinking was taking the XML file and stripping it to the bare minimum so I can do trial and error to get the raster map image instead of the purple rectangle. The fact that I got a response from the provincial WMS server is encouraging and a big step forward. Currently the XML file I get from the provincial WMS server is hundreds and hundreds of lines long, handling 26 projections.

I found if I use XML notepad to re-save the XML, then I can edit it quicker in Notepad and the tree hierachy remains. Anyways WMS will have to be put back on the shelf for a future project.

madscientist67 post(s)
#21-Apr-14 14:41

I can't seem to make this work either. I can correctly tie in just using the WMS URL but I get the same error as Walter did where things are "puzzled" or dis-ordered. If I try it through a website after editing the xml I get cannot connect to server message.

Attached is a file which you can try. It would be a great help if someone can get it to work :) I've been struggling with it for a long time.

Attachments:
TestWMSURL.txt

adamw


10,447 post(s)
#21-Apr-14 16:19

Actually, I have problems working with this server as is, without any custom GetCapabilities documents. I guess that makes that server a bad choice for testing the procedure proposed by Klaus. (I will investigate the issues with the original server.)

adamw


10,447 post(s)
#22-Apr-14 14:23

We've got to the bottom of this.

Manifold 8 does, indeed, show tiles in the wrong order for some WMS servers.

This only happens for WMS servers which support WMS 1.3.0, and only for coordinate systems which use the YX axis order in the EPSG standard - most notably, EPSG 4326.

The GetCapabilities document retrieved by following the link in the text file attached above cites WMS 1.1.1 and uses XY ordering for EPSG 4326. However, first, the server actually supports 1.3.0, and Manifold discovers that by adding parameters to the initial URL and looking at replies. And, second, even if the server didn't support WMS 1.3.0, the document for WMS 1.1.1 is invalid, because it references a missing DTD (that's a server issue). So, when you tell Manifold to connect to a WMS server using the specified link, Manifold detects that the server supports WMS 1.3.0, uses WMS 1.3.0, uses EPSG 4326 and runs into the issue with the wrong axis order.

We will, of course, fix the issue. Whether we will deliver the fix as part of Manifold 8 is unclear at this point.

tonyw
736 post(s)
#21-Apr-14 18:42

Hi MadScientist

Check out this thread, I think I have come across a working solution.

http://www.georeference.org/forum/t122516.12

adamw


10,447 post(s)
#21-Apr-14 16:25

An additional step:

2.5. In Capability -> Request -> GetCapabilities, replace the URL which returns the GetCapabilities document with a link to your file (the same link you'd later use in the Manifold dialog in step 7). If you don't do this, Manifold might one day decide to follow that link and get the original GetCapabilities document instead of the edited version.

madscientist67 post(s)
#21-Apr-14 19:14

See if you guys can get into this file and try it. When you open it up you'll see it does connect but I can't tell which EPGS and can't get it to even display properly :(

The attachment in this message demonstrates what Walter was saying where things look "puzzled" .I see this in a lot of commercial WMS services when using Manifold but the WMS seems to work with other software.

Attachments:
WMSTest.map

adamw


10,447 post(s)
#22-Apr-14 14:23

I have answered above.

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.