The support forum is temporarily read-only. For urgent requests, please email contact[at]psyberia.net

[resolved] WMS server custom map wrong BBOX coordinates

Any question about the app? Ask it here
Post Reply
Jrm
Posts: 5
Joined: Wed Sep 14, 2022 1:04 am

[resolved] WMS server custom map wrong BBOX coordinates

Post by Jrm »

Hi,

I created the following .aqx file to view in AlpineQuest (High res imagery of Western Australia)

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<aqx version="11">
  <source id="MAP_UID">
    <name>Landgate Imagery</name>
    <zoom-levels z="1-22">
      <server>https://mapviewerplusproxy-a.app.landgate.wa.gov.au/proxy/forward.jsp?https://services.slip.wa.gov.au/arcgis/rest/services/Landgate_Subscription_Imagery/WANow/MapServer/export?format=png8&bbox={$bbox}&size=256,256&f=image</server>
      <referer>https://map-viewer-plus.app.landgate.wa.gov.au/</referer>
    </zoom-levels>
  </source>
</aqx>
However the map appeared blank. After debugging, I found out that with the {$bbox} variable, the link generated by AQ was:

[...]?format=png8&bbox=-27.68,118.82,-27.05,119.53&size=256,256&f=image

But the WMS server appears to use swapped BBOX coordinates. The good link is actually:

[...]?format=png8&bbox=118.82,-27.68,119.53,-27.05&size=256,256&f=image

(removed some decimals for readability). So I'm assuming that the server accept the BBOX coordinates as [BottomLeftY,BottomLeftX,TopRightY,TopRightX] whereas AQ generates them as [BottomLeftX,BottomLeftY,TopRightX,TopRightY].

Or something like that.

Now, obviously I can't change how the server reads the coordinates so I'm wondering if it's possible in an AQX file to swap the $bbox around? Or is this something I can control with <bbox-crs-code>???</bbox-crs-code>? I tried a few different EPSG codes without much luck. I think the coordinate system is correct, it's just that the points are swapped around.
Jrm
Posts: 5
Joined: Wed Sep 14, 2022 1:04 am

Re: WMS server custom map wrong BBOX coordinates

Post by Jrm »

Update: Solved this by creating a "proxy page" on my server, basically a PHP script that reads the {$bbox} and generates a 302 redirect to the correct URL... Not ideal but it's gonna have to do
Psyberia-Support
Site Admin
Posts: 6408
Joined: Wed Apr 14, 2010 9:41 pm

Re: WMS server custom map wrong BBOX coordinates

Post by Psyberia-Support »

Hi Jrm and sorry for the delay,

Yes I guess this is because you haven't explicitly set a bbox CRS code, so the app choses Lat/Long by default which is displayed in this "reversed" order (for WMS 1.3 compatibility).
You should use a common projected bbox CRS and it will work fine, for example add this after the "<zoom-levels>" tag:

Code: Select all

<bbox-crs-code>EPSG:3857</bbox-crs-code>
Or this one (same projection but alternative code):

Code: Select all

<bbox-crs-code>EPSG:102100</bbox-crs-code>
You should also specify this in the server URL (see full version below).

Another option (which I do not recommend) if you want to keep the Lat/Long bbox crs is to add this line:

Code: Select all

<bbox-crs-code ignore-axis-orientation="true">EPSG:4326</bbox-crs-code>
Let me know if you have any additional question (I haven't tested it).
Best regards


Full version:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<aqx version="11">
  <source id="MAP_UID">
    <name>Landgate Imagery</name>
    <zoom-levels z="1-22">
      <bbox-crs-code>EPSG:3857</bbox-crs-code>
      <server>https://mapviewerplusproxy-a.app.landgate.wa.gov.au/proxy/forward.jsp?https://services.slip.wa.gov.au/arcgis/rest/services/Landgate_Subscription_Imagery/WANow/MapServer/export?format=png8&bbox={$bbox}&CRS=EPSG:3857&SRS=EPSG:3857&size=256,256&f=image</server>
      <referer>https://map-viewer-plus.app.landgate.wa.gov.au/</referer>
    </zoom-levels>
  </source>
</aqx>
Do you like AlpineQuest ? Leave a small comment on Google Play !
Jrm
Posts: 5
Joined: Wed Sep 14, 2022 1:04 am

Re: WMS server custom map wrong BBOX coordinates

Post by Jrm »

Psyberia-Support wrote: Sun Sep 25, 2022 2:11 amHi Jrm and sorry for the delay,
Thank you! I finally got it to work.

Code: Select all

<bbox-crs-code ignore-axis-orientation="true">
did the trick, but I also had to create my own WKT def as it seems AQ doesn't include it.

For anyone looking at this later, here is the final working version.

Code: Select all

<import-ogc-wkt-def code="MY_7844_DEF">
GEOGCS["GDA2020",
    DATUM["Geocentric_Datum_of_Australia_2020",
        SPHEROID["GRS 1980",6378137,298.257222101]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","7844"]]
</import-ogc-wkt-def>

<name>Western Australia Hi Res Imagery</name>
<description>High definition satetllite imagery</description>

<source id="WA_IMAG" type="satellite">
  <name>WA Imagery</name>
  <preview-location>113.2,-22.55,8</preview-location>
  <zoom-levels z="5-20">
    <projection-code>MY_7844_DEF</projection-code>
    <bbox-crs-code ignore-axis-orientation="true">MY_7844_DEF</bbox-crs-code>
    <server>https://mapviewerplusproxy-a.app.landgate.wa.gov.au/proxy/forward.jsp?https://services.slip.wa.gov.au/arcgis/rest/services/Landgate_Subscription_Imagery/WANow/MapServer/export?dynamicLayers=%5B%7B%22id%22%3A4%2C%22name%22%3A%22WA%20Now%20Imagery%22%2C%22source%22%3A%7B%22type%22%3A%22mapLayer%22%2C%22mapLayerId%22%3A4%7D%2C%22minScale%22%3A0%2C%22maxScale%22%3A0%7D%5D&dpi=96&transparent=true&format=png8&layers=show:1,4&bbox={$bbox}&bboxSR=7844&imageSR=7844&size=256,256&f=image</server>
    <referer>https://map-viewer-plus.app.landgate.wa.gov.au/</referer>
  </zoom-levels>
</source>
Have fun
Psyberia-Support
Site Admin
Posts: 6408
Joined: Wed Apr 14, 2010 9:41 pm

Re: WMS server custom map wrong BBOX coordinates

Post by Psyberia-Support »

Ok great.
Do you like AlpineQuest ? Leave a small comment on Google Play !
Post Reply