Changeset 17502 in josm


Ignore:
Timestamp:
2021-02-21T09:07:46+01:00 (2 weeks ago)
Author:
wiktorn
Message:

Check current tile projection when querying WMS server.

Add same logic as in WMSEndpointTileSource to check, whether coordinates needs
to be switched or not. Before this change, switch was calculated only when
adding the layer, so changing map projection was ignored.

Also it was using JOSM map projection settings instead of the projection that
was chosen to query the server and this could result in replaced X and Y
coordinates.

Closes: #20509

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java

    r15739 r17502  
    1919import org.openstreetmap.josm.data.coor.EastNorth;
    2020import org.openstreetmap.josm.data.projection.Projection;
    21 import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    2221import org.openstreetmap.josm.gui.layer.WMSLayer;
    2322import org.openstreetmap.josm.tools.CheckParameterUtil;
     
    5756    private final Map<String, String> headers = new ConcurrentHashMap<>();
    5857    private final String date;
    59     private final boolean switchLatLon;
     58    private final boolean belowWMS130;
    6059
    6160    /**
     
    8887        // [1] https://www.epsg-registry.org/report.htm?type=selection&entity=urn:ogc:def:crs:EPSG::4326&reportDetail=short&style=urn:uuid:report-style:default-with-code&style_name=OGP%20Default%20With%20Code&title=EPSG:4326
    8988        // CHECKSTYLE.ON: LineLength
    90         if (baseUrl.toLowerCase(Locale.US).contains("crs=epsg:4326")) {
    91             switchLatLon = true;
    92         } else if (baseUrl.toLowerCase(Locale.US).contains("crs=")) {
    93             // assume WMS 1.3.0
    94             switchLatLon = ProjectionRegistry.getProjection().switchXY();
    95         } else {
    96             switchLatLon = false;
    97         }
     89        belowWMS130 = !baseUrl.toLowerCase(Locale.US).contains("crs=");
    9890    }
    9991
     
    133125                break;
    134126            case "bbox":
    135                 replacement = getBbox(zoom, tilex, tiley, switchLatLon);
     127                replacement = getBbox(zoom, tilex, tiley, !belowWMS130 && getTileProjection().switchXY());
    136128                break;
    137129            case "w":
Note: See TracChangeset for help on using the changeset viewer.