Skip to content

Commit

Permalink
allow to use a distinct url/layername for background in BPs
Browse files Browse the repository at this point in the history
sometimes we dont want to use the same layer in the web interface
(where the zoom levels are known and the WMS is backed by a cached
layer) and in the BP (when the zoom level depends on the plot
size and we might want an uncached layer).
  • Loading branch information
landryb committed Nov 14, 2024
1 parent aa79774 commit af0a5b5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,22 @@ public ResponseEntity<byte[]> createImageBordereauParcellaire(

logger.debug("Call WMS for cadastral background");
// Get cadastral background image with good BBOX
final String cadastralLayerWmsUrl = CadastrappPlaceHolder.getProperty("cadastre.wms.url");
String cadastralLayerWmsUrl = CadastrappPlaceHolder.getProperty("cadastre.wms.url");
final String cadastralLayerWmsUsername = CadastrappPlaceHolder.getProperty("cadastre.wms.username");
final String cadastralLayerWmsPassword = CadastrappPlaceHolder.getProperty("cadastre.wms.password");

// overriden by cadastrebpbg if defined - allows to use a different layer source url for backgrounds in BPs
if (CadastrappPlaceHolder.getProperty("cadastrebpbg.wms.url") != null && !CadastrappPlaceHolder.getProperty("cadastrebpbg.wms.url").isEmpty()) {
cadastralLayerWmsUrl = CadastrappPlaceHolder.getProperty("cadastrebpbg.wms.url");
}
WebMapServer wmsCadastralLayer = createWebMapServer(cadastralLayerWmsUrl,cadastralLayerWmsUsername, cadastralLayerWmsPassword );

final String cadastralLayerName = CadastrappPlaceHolder.getProperty("cadastre.wms.layer.name");
String cadastralLayerName = CadastrappPlaceHolder.getProperty("cadastre.wms.layer.name");
final String cadastreSRS = CadastrappPlaceHolder.getProperty("cadastre.SRS");
final String cadastralLayerFormat = CadastrappPlaceHolder.getProperty("cadastre.format");

// overriden by cadastrebpbg if defined - allows to use a different layer name for backgrounds in BPs
if (CadastrappPlaceHolder.getProperty("cadastrebpbg.wms.layer.name") != null && !CadastrappPlaceHolder.getProperty("cadastrebpbg.wms.layer.name").isEmpty()) {
cadastralLayerName = CadastrappPlaceHolder.getProperty("cadastrebpbg.wms.layer.name");
}
GetMapRequest requestCadastralLayer = createAndConfigureMapRequest(wmsCadastralLayer, cadastralLayerFormat, cadastralLayerName, pdfImagePixelSize, cadastreSRS, bounds);

logger.debug("Create background cadastral image");
Expand Down
5 changes: 5 additions & 0 deletions cadastrapp/src/main/resources/cadastrapp.properties
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ cadastre.wms.layer.name=qgis:geo_parcelle
cadastre.wms.username=
cadastre.wms.password=

#if defined, used instead of cadastre.wms for the background layer in BP
#useful of cadastre.wms points at a cached layer and you want a different layer without resampling for BPs.
#cadastrebpbg.wms.url=https://georchestra.example.org/geoserver/wms
#cadastrebpbg.wms.layer.name=qgis:geo_parcelle

# Here you can configure the layer used to generate the plot selection on BP
# let it empty if cadastre.wms.url support SLD_BODY WMS param
# Note that it must support SLD_BODY WMS param
Expand Down

0 comments on commit af0a5b5

Please sign in to comment.