|
30 | 30 | import org.openstreetmap.josm.data.imagery.ImageryInfo; |
31 | 31 | import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; |
32 | 32 | import org.openstreetmap.josm.data.imagery.LayerDetails; |
| 33 | +import org.openstreetmap.josm.data.imagery.TemplatedWMSTileSource; |
33 | 34 | import org.openstreetmap.josm.data.imagery.WMTSTileSource; |
34 | 35 | import org.openstreetmap.josm.data.imagery.WMTSTileSource.Layer; |
35 | 36 | import org.openstreetmap.josm.data.imagery.WMTSTileSource.WMTSGetCapabilitiesException; |
| 37 | +import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
36 | 38 | import org.openstreetmap.josm.gui.ExtendedDialog; |
37 | 39 | import org.openstreetmap.josm.gui.MainApplication; |
38 | 40 | import org.openstreetmap.josm.gui.layer.AlignImageryPanel; |
@@ -279,7 +281,9 @@ protected static ImageryInfo getWMSLayerInfo(ImageryInfo info) throws IOExceptio |
279 | 281 | public static ImageryInfo getWMSLayerInfo(ImageryInfo info, Function<WMSImagery, LayerSelection> choice) |
280 | 282 | throws IOException, WMSGetCapabilitiesException { |
281 | 283 | 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()); |
283 | 287 | LayerSelection selection = choice.apply(wms); |
284 | 288 | if (selection == null) { |
285 | 289 | return null; |
|
0 commit comments