From 12f67f3b42ec9968a853c4205b468db2e8d2ba4e Mon Sep 17 00:00:00 2001 From: Andrey R Date: Tue, 19 May 2026 10:13:17 +0200 Subject: [PATCH 1/3] Transform exported data to LV95 (#15) * Add button for exported data in LV95/EPSG:2056 --- .../src/main/resources/application.properties | 2 +- .../src/main/resources/static/css/extract.css | 7 ++++++- .../resources/static/js/requestDetails.js | 20 ++++++++++++------- .../resources/static/js/requestMap/map.js | 11 +++++++++- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/extract/src/main/resources/application.properties b/extract/src/main/resources/application.properties index 69f22403..a8385202 100644 --- a/extract/src/main/resources/application.properties +++ b/extract/src/main/resources/application.properties @@ -1,5 +1,5 @@ # Default properties for database persistence -spring.datasource.url=jdbc:postgresql://pgsql:5432/extract +spring.datasource.url=jdbc:postgresql://localhost:5432/extract spring.datasource.username=extractuser spring.datasource.password=demopassword spring.datasource.driver-class-name=org.postgresql.Driver diff --git a/extract/src/main/resources/static/css/extract.css b/extract/src/main/resources/static/css/extract.css index a2b3c056..b72862d4 100644 --- a/extract/src/main/resources/static/css/extract.css +++ b/extract/src/main/resources/static/css/extract.css @@ -565,6 +565,11 @@ table.list-table.files-list-table { bottom: 0.5em; } +.lv95 { + right: 8.5em; + bottom: 0.5em; +} + .export-kml { right: 4.5em; bottom: 0.5em; @@ -576,7 +581,7 @@ table.list-table.files-list-table { } .ol-control.ol-attribution { - right: 8.5em; + right: 15.5em; } .ol-attribution.ol-uncollapsible ~ .ol-control.export-button { diff --git a/extract/src/main/resources/static/js/requestDetails.js b/extract/src/main/resources/static/js/requestDetails.js index 1f226f2e..f2688608 100644 --- a/extract/src/main/resources/static/js/requestDetails.js +++ b/extract/src/main/resources/static/js/requestDetails.js @@ -239,6 +239,12 @@ function _initializeExportButtons(map) { label: LANG_MESSAGES.requestDetails.exportToKml.label, tooltip: LANG_MESSAGES.requestDetails.exportToKml.tooltip })); + map.addControl(new ExportToDxfControl({ + label: `${LANG_MESSAGES.requestDetails.exportToDxf.label} (LV95)`, + tooltip: `${LANG_MESSAGES.requestDetails.exportToDxf.tooltip} (LV95)`, + projection: "EPSG:2056", + styleClass: "lv95" + })); } @@ -364,7 +370,7 @@ class ExportToDxfControl extends ol.control.Control { button.title = options.tooltip; var element = document.createElement('div'); - element.className = 'export-dxf export-button ol-unselectable ol-control'; + element.className = `${options.styleClass || "export-dxf"} export-button ol-unselectable ol-control`; element.appendChild(button); super({ @@ -375,11 +381,10 @@ class ExportToDxfControl extends ol.control.Control { button.addEventListener('click', this.handleExportToDxf.bind(this), false); button.addEventListener('touchstart', this.handleExportToDxf.bind(this), false); this.DxfGlobalHandle = 2000; + this.projection = options.projection || ""; } buildDxfPolyline(ring) { - console.log(ring); - this.DxfGlobalHandle++; var pointsCount = ring.length; var dxfPolygon = ' 0\n' + @@ -1687,15 +1692,16 @@ class ExportToDxfControl extends ol.control.Control { return parseInt(number, 10).toString(16); } - + getLinearRingsFromFeatures(features) { - console.log(features); - var rings = []; for (var i = 0; i < features.length; i++) { var feature = features[i]; - var geometry = feature.getGeometry(); + var geometry = feature.getGeometry().clone(); + if (this.projection) { + geometry.transform('EPSG:3857', this.projection); + } if (geometry instanceof ol.geom.MultiPolygon) { var polygons = geometry.getPolygons(); diff --git a/extract/src/main/resources/static/js/requestMap/map.js b/extract/src/main/resources/static/js/requestMap/map.js index 2d5cdd3c..2b3e379c 100644 --- a/extract/src/main/resources/static/js/requestMap/map.js +++ b/extract/src/main/resources/static/js/requestMap/map.js @@ -15,8 +15,17 @@ * along with this program. If not, see . */ +function registerProjections() { + proj4.defs("EPSG:2056", + '+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333' + + ' +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel ' + + '+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs'); + ol.proj.proj4.register(proj4); +} + function initializeMap() { - + registerProjections(); + return new Promise(function(resolve, reject) { const attribution = new ol.control.Attribution({ collapsible: true, From 9629287f56f8a45533fb590f4125b5ba968eac41 Mon Sep 17 00:00:00 2001 From: "Andrey Rusakov (andrey.rusakov@camptocamp.com)" Date: Wed, 10 Jun 2026 11:15:05 +0200 Subject: [PATCH 2/3] Added geoshop connector as a submodule --- .gitmodules | 3 +++ .../src/main/resources/application.properties | 4 +-- pom.xml | 27 ++++++++++++++++++- sitn_geoshop_connector | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 sitn_geoshop_connector diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..a685cbe9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "sitn_geoshop_connector"] + path = sitn_geoshop_connector + url = https://github.com/sitn/sitn_geoshop_connector diff --git a/extract/src/main/resources/application.properties b/extract/src/main/resources/application.properties index a8385202..58d1971f 100644 --- a/extract/src/main/resources/application.properties +++ b/extract/src/main/resources/application.properties @@ -1,5 +1,5 @@ # Default properties for database persistence -spring.datasource.url=jdbc:postgresql://localhost:5432/extract +spring.datasource.url=jdbc:postgresql://pgsql:5432/extract spring.datasource.username=extractuser spring.datasource.password=demopassword spring.datasource.driver-class-name=org.postgresql.Driver @@ -55,4 +55,4 @@ table.page.size=10 #http.proxyUser=myProxyUser #http.proxyPassword=myProxyPassword -appplication.features.perRequestOwnership=false \ No newline at end of file +appplication.features.perRequestOwnership=false diff --git a/pom.xml b/pom.xml index 0ae2ce8b..31558230 100644 --- a/pom.xml +++ b/pom.xml @@ -73,11 +73,36 @@ + + maven-resources-plugin + 3.3.1 + + + copy-resource-one + generate-sources + + copy-resources + + + ./extract/src/main/resources/connectors/ + + + ./sitn_geoshop_connector/connectors/extract-connector-geoshop/target/ + + extract-connector-geoshop*.jar + + + + + + + - + extract-interface + sitn_geoshop_connector/connectors/extract-connector-geoshop extract-connector-easysdiv4 extract-task-archive extract-task-email diff --git a/sitn_geoshop_connector b/sitn_geoshop_connector new file mode 160000 index 00000000..87b9bd6c --- /dev/null +++ b/sitn_geoshop_connector @@ -0,0 +1 @@ +Subproject commit 87b9bd6cde1bc4c23f42c477fe51162856488c1d From 2ea1cd6d310accdd503e6d43cb4990704808426c Mon Sep 17 00:00:00 2001 From: "Andrey Rusakov (andrey.rusakov@camptocamp.com)" Date: Wed, 10 Jun 2026 11:29:30 +0200 Subject: [PATCH 3/3] Added submodules fetching to the build target --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0d7dfec..fe350513 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,8 @@ jobs: steps: - name: Download the code uses: actions/checkout@v4 + with: + submodules: recursive - name: Install JDK 17 uses: actions/setup-java@v4