TerriaJS / terriajs

A library for building rich, web-based geospatial data platforms.
https://terria.io
Apache License 2.0
1.16k stars 361 forks source link

"Ideal Zoom" broken on Esri MapServer when added through Add Web Data #6590

Closed meh9 closed 1 year ago

meh9 commented 1 year ago

Using e.g. the Transmission Lines layer in NatMap:

https://nationalmap.gov.au/#share=s-sSnPL1c2uOvNEW9F2eP7Xo50Vj

Clicking the Ideal Zoom button moves the map to the ideal zoom for the layer.

However, if you take the URL:

https://services.ga.gov.au/gis/rest/services/Foundation_Electricity_Infrastructure/MapServer

And add it through Add Web Data:

https://nationalmap.gov.au/#share=s-qocoeehV6CtYPlGwrsHVDZOHqvO

Clicking the Ideal Zoom button now does nothing, and no error or other message is logged in the console.

Testing this same thing with a WMS service, e.g.:

https://services.ga.gov.au/gis/services/Foundation_Electricity_Infrastructure/MapServer/WMSServer?request=GetCapabilities&service=WMS

When adding this through Add Web Data, adding the Transmission Lines layer and then clicking Ideal Zoom it works fine.

na9da commented 1 year ago

This happens because the esri source is in EPSG:7844 CRS. When trying to compute the extent for a MapServer item, we need to convert the extent from the source CRS to destination CRS (which is hardcoded as EPSG:4326).

EPSG:7844 is not defined in our proj4 definitions file, so the extent information from the server is ignored altogether.

The CRS conversion is a complicated topic but an easy fix is to define EPSG:7844 as +proj=longlat +ellps=GRS80 +no_defs +type=crs in Terria.