Changeset 18628 in josm


Ignore:
Timestamp:
2023-01-10T23:55:56+01:00 (15 months ago)
Author:
taylor.smock
Message:

Fix #22642: {apikey} fails for Swedish historic orthophoto endpoint imagery

This occurred since we were not replacing the {apikey} for endpoints.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r18208 r18628  
    3131import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
    3232import org.openstreetmap.josm.data.imagery.LayerDetails;
     33import org.openstreetmap.josm.data.imagery.TemplatedWMSTileSource;
    3334import org.openstreetmap.josm.data.imagery.WMTSTileSource;
    3435import org.openstreetmap.josm.data.imagery.WMTSTileSource.Layer;
    3536import org.openstreetmap.josm.data.imagery.WMTSTileSource.WMTSGetCapabilitiesException;
     37import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    3638import org.openstreetmap.josm.gui.ExtendedDialog;
    3739import org.openstreetmap.josm.gui.MainApplication;
     
    280282            throws IOException, WMSGetCapabilitiesException {
    281283        CheckParameterUtil.ensureThat(ImageryType.WMS_ENDPOINT == info.getImageryType(), "wms_endpoint imagery type expected");
    282         final WMSImagery wms = new WMSImagery(info.getUrl(), info.getCustomHttpHeaders());
     284        // We need to get the URL with {apikey} replaced. See #22642.
     285        final TemplatedWMSTileSource tileSource = new TemplatedWMSTileSource(info, ProjectionRegistry.getProjection());
     286        final WMSImagery wms = new WMSImagery(tileSource.getBaseUrl(), info.getCustomHttpHeaders());
    283287        LayerSelection selection = choice.apply(wms);
    284288        if (selection == null) {
Note: See TracChangeset for help on using the changeset viewer.