Skip to content

Commit

Permalink
Fix #22642: {apikey} fails for Swedish historic orthophoto endpoint i…
Browse files Browse the repository at this point in the history
…magery

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
  • Loading branch information
taylor.smock committed Jan 10, 2023
1 parent 073de3b commit 9cbc747
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
import org.openstreetmap.josm.data.imagery.ImageryInfo;
import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
import org.openstreetmap.josm.data.imagery.LayerDetails;
import org.openstreetmap.josm.data.imagery.TemplatedWMSTileSource;
import org.openstreetmap.josm.data.imagery.WMTSTileSource;
import org.openstreetmap.josm.data.imagery.WMTSTileSource.Layer;
import org.openstreetmap.josm.data.imagery.WMTSTileSource.WMTSGetCapabilitiesException;
import org.openstreetmap.josm.data.projection.ProjectionRegistry;
import org.openstreetmap.josm.gui.ExtendedDialog;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.layer.AlignImageryPanel;
Expand Down Expand Up @@ -279,7 +281,9 @@ protected static ImageryInfo getWMSLayerInfo(ImageryInfo info) throws IOExceptio
public static ImageryInfo getWMSLayerInfo(ImageryInfo info, Function<WMSImagery, LayerSelection> choice)
throws IOException, WMSGetCapabilitiesException {
CheckParameterUtil.ensureThat(ImageryType.WMS_ENDPOINT == info.getImageryType(), "wms_endpoint imagery type expected");
final WMSImagery wms = new WMSImagery(info.getUrl(), info.getCustomHttpHeaders());
// We need to get the URL with {apikey} replaced. See #22642.
final TemplatedWMSTileSource tileSource = new TemplatedWMSTileSource(info, ProjectionRegistry.getProjection());
final WMSImagery wms = new WMSImagery(tileSource.getBaseUrl(), info.getCustomHttpHeaders());
LayerSelection selection = choice.apply(wms);
if (selection == null) {
return null;
Expand Down

0 comments on commit 9cbc747

Please sign in to comment.