Subscribe to this thread
Home - General / All posts - Trying to link an OGC WMS image - projection issues (Manifold 8)
djmcbell47 post(s)
#01-Sep-20 02:32

Hi all

Following my previous topic (where OpenStreetMap wasn't working), I've found an OpenStreetMap which should work, as a WMS. This works fine in QGIS.

The url to use is https://ows.terrestris.de/osm/service? and I've added it using File > Link > Image > OGC WMS Servers () as per cap1.PNG.

This is fine, it gets added as a component, and I've selected the same layers that give me the expected result in QGIS (just the "OpenStreetMap WMS - by terrestris").

Opening it, or adding it to a map, brings up the "The projection of this component has not been verified..." dialog, which opens up the "Assign Projection" dialog. Fine and dandy.

This, I believe, is where I'm falling down. I'm not quite certain how to use this.

In QGIS, this is registering as EPSG:4326, which is WGS84 - pretty much standard for worldwide. I think my settings are correct (and I use this for GPS data from other parties), but nothing is showing up - see cap2.PNG.

I can add it with this, but nothing at all is showing up on my map or when I double-click the component. There are no errors in the History pane. Is my projection wrong, or how I'm assigning my projection, or refreshing the map/component to see it (using ALT+F5, and also a Quick AOI update tool)? Also, how can I search by EPSG code, rather than a text value?

Attachments:
cap1.PNG
cap2.PNG

steveFitz

340 post(s)
#01-Sep-20 06:35

Worked fine on my copy of M8 8.0.30 in Australia although the link dialog showed 4096 x 4096 pixels and 256 x 256 tile by default.

I also noticed your assign projection had a different local scale to mine initially but not sure if that would matter.

strange...

adamw


10,447 post(s)
#01-Sep-20 08:27

I tried linking the image using the above server, using the single layer you mentioned, and keeping all other settings at defaults, and I get a coherent picture.

I suspect the problem is that you set the image size to 64 x 64 pixels - that's shown on your first screen. Keep it at 4096 x 4096, or even increase it further, that's the size 8 will use to represent the whole image at the most detailed level (will not zoom further):

The coordinate system assigned by the link is fine, click the prompt and accept it.

Attachments:
8-wms.png

ColinD

2,093 post(s)
online
#01-Sep-20 08:59

I got past this with another WMS by making the size way big- 100 million pixels. Works when you don't know the extent of the image.


Aussie Nature Shots

djmcbell47 post(s)
#02-Sep-20 05:19

Thanks, got it working but this also provided a useful tip for the resulting resolution.

djmcbell47 post(s)
#02-Sep-20 05:18

Got it working - the issue seemed to be with the "Cache data between sessions" being ticked. When I unticked that (and, as you say, used a higher size - currently 10,000,000 x 10,000,000 which provides a good enough resolution) it started working.

djmcbell47 post(s)
#02-Sep-20 07:44

Okay, next issue. I'm trying to add this OSM image to a map. The map itself is projected in Mercator (Standard > Cylindrical > Mercator).

If I assign the Mercator projection to the image (Standard > Cylindrical > Mercator), the image will not appear on the map. Or more rather, it will appear, but be elsewhere, so incorrectly projected.

If I assign the latitude / longitude WGS84 projection, then add the image to the map, I get the following:

"The projection of the image is incompatible with that of the map. The image will not be visible. Continue?"

Continuing will, as the message suggests, mean that the image isn't visible anyway.

Now, I understand that you cannot alter the projection of a linked image. However, I cannot easily change the projection that my map uses into one that works with the image, due to there being lots of legacy code in various different systems that manipulates it which breaks, making the map unusable anyway.

I saw in a help topic that most WMS use Mercator (though when I added it into QGIS and hovered over, it came up as EPSG:4326, or WGS84).

Think I'm nearly there, just need some help with this last bit.

adamw


10,447 post(s)
#02-Sep-20 07:52

Manifold 8 cannot re-project linked images on the fly (9 can, just in case) so if you have to have a map in coordinate system X and the linked image is in coordinate system Y, 8 will not be able to show the image on that map. Can you elaborate on why the map has to be in Mercator? Might it be that it is the layers that have to be in Mercator, but the map itself might be in lat/lon = same as the image? Alternatively, you can have two maps showing the same layers - one in lat/lon with the image, another in Mercator without the image. The map in lat/lon with the image will re-project layers in Mercator to lat/lon automatically. The map in Mercator will satisfy the legacy code.

djmcbell47 post(s)
#02-Sep-20 07:55

There are a lot of different services in other programs hooking into the map. I guess it could be changed, but it would be a really long process and this is legacy code I'm unfamiliar with.

The WMS does offer a variety of reprojections, including EPSG:3857. Full list:

<SRS>EPSG:900913</SRS>

<SRS>EPSG:3857</SRS>

<SRS>EPSG:25832</SRS>

<SRS>EPSG:25833</SRS>

<SRS>EPSG:29192</SRS>

<SRS>EPSG:29193</SRS>

<SRS>EPSG:31466</SRS>

<SRS>EPSG:31467</SRS>

<SRS>EPSG:31468</SRS>

<SRS>EPSG:32648</SRS>

<SRS>EPSG:4326</SRS>

<SRS>EPSG:4674</SRS>

<SRS>EPSG:3068</SRS>

<SRS>EPSG:3034</SRS>

<SRS>EPSG:3035</SRS>

<SRS>EPSG:2100</SRS>

<SRS>EPSG:31463</SRS>

<SRS>EPSG:4258</SRS>

<SRS>EPSG:4839</SRS>

<SRS>EPSG:2180</SRS>

<SRS>EPSG:21781</SRS>

<SRS>EPSG:2056</SRS>

<SRS>EPSG:4647</SRS>

<SRS>EPSG:4686</SRS>

<SRS>EPSG:5243</SRS>

I guess I need to know how to change which CRS it's targeting, either in Manifold itself or by parsing it in the url.

The map is in Mercator, but the layers are in latitude/longitude. Which makes me think this should have worked off the bat, but evidently not (which as you've said is because it cannot reproject images on the fly).

adamw


10,447 post(s)
#02-Sep-20 08:02

An alternative: I see from the server capabilities doc that it supports web Mercator = EPSG:3857. I almost suggested that you set that as the preferred coordinate system, but then remembered that we didn't have that feature in 8 either, it only appeared in 9 (sigh). You can, however, set up an intermediate WMS server that would redirect all requests to the original server, but override the capabilities document with a custom version that removes all coordinate systems except EPSG:3857 - this would make 8 use EPSG:3857 as well. This can be done using open source software. If you want to try this, tell me and I will dig up some links, this is something that was discussed on the forum before.

PS: We cross-posted. :-)

PPS: OK, I found the relevant link just in case:

https://docs.geoserver.org/latest/en/user/data/cascaded/wms.html

djmcbell47 post(s)
#02-Sep-20 08:15

Hmm... may give that a quick go tomorrow. We do use Geoserver for some things anyway. So basically, it'd be setting Geoserver up as a WMS and pumping it through that, except we can control the input/output CRS.

I did also try using the following url, and it got the list of layers, but even after I verified the projection (as Mercator) it was blank on the map:

https://ows.terrestris.de/osm/service?crs=EPSG:3857

Oddly enough, I know that most of our layers are stored in EPSG:4283 (GDA94), so I'm wondering if that's a small discrepancy and likely to be the map's projection instead. Unfortunately the WMS doesn't support that one.

djmcbell47 post(s)
#03-Sep-20 08:09

Hmm... nearly there. Having projection issues now.

The WMS has been set up and is supplying the data out in 4283, which I think is fine and dandy. See capture.png

But I really don't know what to bring this into the environment under. I've saved a copy of 4283.prj from https://epsg.io/4283 (see attachment) but it brings up the "The projection of this image is incompatible with that of the map".

The map's projection is coming up (which I think is found by right-clicking and going to Assign Projection) as that in mapproj.

Any idea what I can set it to, either in GeoServer or Manifold (or both) to make it compatible with the map?

I should mention that, during my experiments, I did find some that were compatible, but not projected correctly / in line with the map contents (see mapcontentsproj). Trying to bring that in line manually would be incredibly long-winded and fiddly.

As I say, nearly there, and using GeoServer as an interim seems like it would do the job.

Attachments:
4283.prj
Capture.PNG
mapcontentsproj.PNG
mapproj.PNG

adamw


10,447 post(s)
#03-Sep-20 08:50

From MAPPROJ.PNG, Manifold 8 is using web Mercator, EPSG:3857. That's likely because it was in the capabilities doc and because the capabilities doc didn't include any of the choices Manifold 8 thought would be better (if EPSG:4326 was listed, 8 would likely have used that). EPSG:4283 is lat/lon, obviously different from web Mercator. If you want Manifold 8 to use EPSG:4283, remove all other coordinate systems from the capabilities doc returned by the server. (There's a twist in that I don't remember how new EPSG:4283 is, if it was there 10 years ago when Manifold 8 was being built, it is likely supported, otherwise it might not be - and in this case, use EPSG:4326, it is close enough and it is supported by everyone. -- I checked and 8 does support EPSG:4283 so the italic may be ignored.)

djmcbell47 post(s)
#04-Sep-20 02:49

This is all very confusing.

If I try to use anything other than EPSG:3857 then Manifold says that it can't project it. Basically, it seems it needs to be a Mercator.

Which is fine, so long as it can project properly onto the map.

So I've set the WMS coming from GeoServer to be EPSG:3857, as in geocap.png. In Manifold though, I can't seem to hit the right settings to get it projected in position properly. The mancap is from loading it, going to Assign Projection (or Verify Projection), using Standard > Cylindrical > Mercator (which I understand is EPSG:3857) and then using Suggest.

The result.png shows the result of this projection, with the red road network supposed to be around the Victoria region of Australia (with a little bit going into SA). Very confused as I'm sure there must be something simple I'm missing.

Attachments:
geocap.PNG
mancap.PNG
result.PNG

adamw


10,447 post(s)
#04-Sep-20 09:22

EPSG:3857 is pseudo-Mercator, not Mercator. In Manifold 8 this is represented by Mercator with the datum set to 'World Geodetic 1984 (WGS84) Auto'.

When you link a WMS image in EPSG:3857, Manifold 8 should set this all automatically. Is it not doing it? If so, what system does it set by default and what is the result of the GetCapabilities request on the server (that redirects requests to the real server)?

The red lines in the screen seem to be off by a lot, this is likely the result of more than just a different datum.

djmcbell47 post(s)
#04-Sep-20 13:28

Thanks for your help, really think we're getting somewhere. And hopefully I'm learning a thing or two too!

I've attached the result of the GetCapabilities for this particular layer from the GeoServer interim.

When bringing it in, Manifold 8 gives it a default Latitude/Longitude with a World Geodetic 1984 (WGS84), as shown in default.png.

Attachments:
capabilities.txt
default.PNG

adamw


10,447 post(s)
#04-Sep-20 15:26

Can the layer shown in the TXT be inside a different layer? If so, can it be that the outer layer supports some other coordinate systems?

Also, it might make sense to switch WMS from 1.0.0 to 1.3.0.

djmcbell47 post(s)
#05-Sep-20 14:21

Yes, there is another layer wrapper in the txt around everything else. I think that basically acts as defaults for all the layers (it contains them all) and has a LOT of coordinate systems - including 4326, 4283 and 3857.

djmcbell47 post(s)
#07-Sep-20 00:10

Hmm... adding to the confusion. Though this may point at a way out.

My map already has a few components, which are in 4283. I can add these to the map itself with no problem.

I've tried importing my WMS (saved in GeoServer in 4283) and using the same projection as these (using the "import projection from component" button). These go into latitude/longitude but have the correct coordinates. I can add the WMS to a blank map, and also add the component, and they match up perfectly.

I can also add the component to the already-existing map, with no issues.

The issue is adding my WMS component to the already existing map, at which point it says that the projection is invalid.

djmcbell47 post(s)
#07-Sep-20 01:12

Sorry, I've got it in 4283 on GeoServer. Linked the WMS, set it to just the standard (Latitude/Longitude, WGS84) and that works fine on a new map alongside components in 4283. Says that the projection is invalid with that of the map when adding to the already-existing map.

djmcbell47 post(s)
#07-Sep-20 04:03

So basically, when opened in Manifold the WMS seems to be in 4326. The coordinates match up with latitude and longitude coordinates more or less exactly. However, that isn't compatible with the map. I guess I need to find out how to definitively make GeoServer export that layer to 3857 and 3857 only, or how to address it in Manifold so that it will be in 3857.

djmcbell47 post(s)
#07-Sep-20 06:23

Okay, so I need to find out how to edit, or override, my capabilities document in GeoServer (sorry this is a bit hodge-podge at the moment, I'm supposed to be doing some training) to only allow 3857. That seems pretty hard to find out how to do it at the moment.

adamw


10,447 post(s)
#07-Sep-20 12:22

Yes, exactly, the entire wrapping of the WMS is in order to override the capabilities document and tell Manifold 8 that the layer is only available in the coordinate system you want to use - 3857.

In an earlier post up above you say that the layer is inside a different layer that supports plenty of coordinate systems. In WMS, if a layer supports systems X, Y, Z, all layers declared inside it also support it. So, when Manifold 8 decides which coordinate system to use for your layer, it sees a big list of available systems and chooses EPSG:4326 - which is not what you want. You have to get rid of the upper-level layer or to remove all coordinate systems from it.

I don't know how exactly that is being done in Geoserver, one of the options that looks kind of promising is Always include Root Layer in capabilities (if it is unchecked and you direct the server to only expose a single layer, maybe the server will omit the parent layer - but that has to be verified).

adamw


10,447 post(s)
#07-Sep-20 12:32

A general idea: when connecting Geoserver to an external WMS, can you not (a) retrieve the capabilities document for the server, (b) edit it - keep the URLs for GetMap the same, but remove the layers you don't want and the coordinate systems you don't want, (c) put it onto some site, then (d) point Geoserver to the modified file?

djmcbell47 post(s)
#09-Sep-20 14:02

Quick update. It's fixed, kinda.

Having OpenStreetMap wasn't a necessity. Having something which looked like OSM was.

So I did lots of things. GeoServer was promising, except I couldn't get the extraneous CRS out of the xml. Even when I removed it, I think GeoServer was just making it up as it went along, and my knowledge of how the server did everything was limited.

I downloaded the vector shapefiles of Australia from OSM, put it into postgres, styled it and everything, and it worked... except the resulting pdfs were huge (a jump from 1mb to 30mb). I was going to try to put in an AOI update but the code we use is ancient and I didn't want to touch it.

I was going to use QGIS and code a quick Python script to download the tiles as geotiffs (I've done it before, not from OSM), but then realised that they'd be stuck at the same zoom level, and I really didn't want to have to deal with around 2000 tiles.

So instead just used the Virtual Earth image server.

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