opensearch-project / dashboards-maps

:globe_with_meridians: User interface for the backend geospatial plugin which can be integrated with OpenSearch Dashboards and a home for all other map related features.
https://opensearch.org/docs/latest/dashboards/geojson-regionmaps/#custom-vector-maps-with-geojson
Apache License 2.0
17 stars 44 forks source link

[BUG] Maps miscalculates WMS BBOX #600

Open lonnyj opened 5 months ago

lonnyj commented 5 months ago

Describe the bug

After loading a WMS layer in Maps, the BBOX parameter appears to be off by five decimal places and is 100,000 larger than it should be. This effectively makes custom WMS layers unusable in Maps.

To Reproduce Steps to reproduce the behavior:

  1. Go to Maps in Dashboards.
  2. Using the Default map, zoom to Iowa with Des Moines in the center of the map.
  3. Click on Add layer.
  4. Click on Custom map.
  5. Populate the fields (WMS URL: https://mesonet.agron.iastate.edu/cgi-bin/wms/us/mrms_nn.cgi, WMS layers: mrms_p72h, WMS version: 1.1.1, WMS format: image/png, WMS CRS: EPSG:4326).
  6. Open the Developer Tools for your browser and select the Network tab
  7. Click the Update button.
  8. In the Developer Tools, the URLs should look something like this: https://mesonet.agron.iastate.edu/cgi-bin/wms/us/mrms_nn.cgi?service=WMS&version=1.1.1&request=GetMap&format=image/png&transparent=true&layers=mrms_p72h&styles=&srs=EPSG:4326&width=256&height=256&bbox=-10644926.307106785,5009377.085697312,-10331840.239250705,5322463.153553393
  9. Notice that the bbox parameter values are well outside of +/-180 longitude and +/-90 latitude.

Expected behavior The bbox values should fall within the EPSG:4326/WGS 84 bounds of (longitude, latitude) -180, -90 and 180, 90. The result would be that WMS tiles should appear on the map according to what's in view at the time.

OpenSearch Version 2.12.0

Dashboards Version 2.12.0

Plugins

None. The Security plugin is also disabled.

Screenshots

None

Host/Environment (please complete the following information):

Additional context

Using the URL provided above, if I divide the BBOX values by 100,000, it produces a usable image.

https://mesonet.agron.iastate.edu/cgi-bin/wms/us/mrms_nn.cgi?service=WMS&version=1.1.1&request=GetMap&format=image/png&transparent=true&layers=mrms_p72h&styles=&srs=EPSG:4326&width=256&height=256&bbox=-106.44926307106785,50.09377085697312,-103.31840239250705,53.22463153553393

image

I also tested with WMS 1.3.0 and it appears to use the same, incorrect calculations.

ashwin-pc commented 5 months ago

@opensearch-project/admin can you move this to the dashboard maps plugin repo?

dblock commented 2 months ago

Catch All Triage - 1 2 3 4 5

qugu2427 commented 1 month ago

It seems like the bbox is always calculated for EPSG:3857. When I test with a local geoserver, I have to explicitly specify EPSG:3857 as the crs. Additionally the query url has bbox={bbox-epsg-3857} hardcoded.

EDIT: Per https://maplibre.org/maplibre-native/docs/book/design/archictural-problems-and-recommendations.html

MapLibre Native supports Web Mercator (EPSG:3857) as its only supported projection

and the bbox is hardcoded to use EPSG:3857. Therefore, I'm not quite sure why "WMS CRS" is even an input in the ui. Perhaps, it is best to lock the custom wms into using EPSG:3857.