Skip to content

Commit 9cbc747

Browse files
author
taylor.smock
committed
Fix #22642: {apikey} fails for Swedish historic orthophoto endpoint imagery
This occurred since we were not replacing the {apikey} for endpoints. git-svn-id: https://josm.openstreetmap.de/svn/trunk@18628 0c6e7542-c601-0410-84e7-c038aed88b3b
1 parent 073de3b commit 9cbc747

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030
import org.openstreetmap.josm.data.imagery.ImageryInfo;
3131
import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
3232
import org.openstreetmap.josm.data.imagery.LayerDetails;
33+
import org.openstreetmap.josm.data.imagery.TemplatedWMSTileSource;
3334
import org.openstreetmap.josm.data.imagery.WMTSTileSource;
3435
import org.openstreetmap.josm.data.imagery.WMTSTileSource.Layer;
3536
import org.openstreetmap.josm.data.imagery.WMTSTileSource.WMTSGetCapabilitiesException;
37+
import org.openstreetmap.josm.data.projection.ProjectionRegistry;
3638
import org.openstreetmap.josm.gui.ExtendedDialog;
3739
import org.openstreetmap.josm.gui.MainApplication;
3840
import org.openstreetmap.josm.gui.layer.AlignImageryPanel;
@@ -279,7 +281,9 @@ protected static ImageryInfo getWMSLayerInfo(ImageryInfo info) throws IOExceptio
279281
public static ImageryInfo getWMSLayerInfo(ImageryInfo info, Function<WMSImagery, LayerSelection> choice)
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) {
285289
return null;

0 commit comments

Comments
 (0)