Skip to content

Commit

Permalink
Fix draw export projection
Browse files Browse the repository at this point in the history
Fix #4216
  • Loading branch information
nboisteault committed Feb 19, 2024
1 parent 9f8b57b commit d48a18d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions assets/src/modules/Digitizing.js
Original file line number Diff line number Diff line change
Expand Up @@ -1084,14 +1084,18 @@ export default class Digitizing {

download(format) {
if (this.featureDrawn) {
const options = {
featureProjection: mainLizmap.projection,
dataProjection: 'EPSG:4326'
};
if (format === 'geojson') {
const geoJSON = (new GeoJSON()).writeFeatures(this.featureDrawn);
const geoJSON = (new GeoJSON()).writeFeatures(this.featureDrawn, options);
Utils.downloadFileFromString(geoJSON, 'application/geo+json', 'export.geojson');
} else if (format === 'gpx') {
const gpx = (new GPX()).writeFeatures(this.featureDrawn);
const gpx = (new GPX()).writeFeatures(this.featureDrawn, options);
Utils.downloadFileFromString(gpx, 'application/gpx+xml', 'export.gpx');
} else if (format === 'kml') {
const kml = (new KML()).writeFeatures(this.featureDrawn);
const kml = (new KML()).writeFeatures(this.featureDrawn, options);
Utils.downloadFileFromString(kml, 'application/vnd.google-earth.kml+xml', 'export.kml');
}
}
Expand Down

0 comments on commit d48a18d

Please sign in to comment.