diff --git a/package-lock.json b/package-lock.json index 09d3bcd3..49df7934 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,8 @@ "dependencies": { "@babel/runtime": "^7.23.1", "@eonasdan/tempus-dominus": "^6.2.6", + "@mapbox/shp-write": "^0.4.3", + "@maphubs/tokml": "^0.6.1", "@popperjs/core": "^2.11.6", "@terraformer/wkt": "^2.2.0", "@turf/turf": "^6.5.0", @@ -3057,6 +3059,28 @@ "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==", "dev": true }, + "node_modules/@mapbox/shp-write": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@mapbox/shp-write/-/shp-write-0.4.3.tgz", + "integrity": "sha512-mkKIHgtnytyP+cXfk+joYeWwk+SODZ7COQusTcO1rZQVUn68MjzW2F74XMsNIusabnwj5aoKNI8B3mYq9KZ9AQ==", + "dependencies": { + "dbf": "0.2.0", + "file-saver": "2.0.5", + "jszip": "^3.10.1" + } + }, + "node_modules/@maphubs/tokml": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@maphubs/tokml/-/tokml-0.6.1.tgz", + "integrity": "sha512-C1qIeLpSDKPIQmYxiPmSZbw1eQDIaWTzeIMf2ym3gzY1q0b7UwDQDuUpccidrdLqOcERx2dlT4URhKl9H2scfA==", + "dependencies": { + "minimist": "^1.2.5", + "rw": "^1.3.3" + }, + "bin": { + "tokml": "tokml" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -8540,8 +8564,7 @@ "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" }, "node_modules/cors": { "version": "2.8.5", @@ -10003,6 +10026,14 @@ "whatwg-url": "^7.0.0" } }, + "node_modules/dbf": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/dbf/-/dbf-0.2.0.tgz", + "integrity": "sha512-JMeGCJzFcVGsfnkIuqrnuiSkJpTu6c4AKJg3LXDnfW7zU/2PSIue3KG4fz9c+/mmlDzT+rVCwyEHzzhxzrzPiA==", + "dependencies": { + "jdataview": "~2.5.0" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -13533,6 +13564,11 @@ "node": ">= 4" } }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + }, "node_modules/immer": { "version": "9.0.21", "resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz", @@ -14483,6 +14519,11 @@ "node": ">=8" } }, + "node_modules/jdataview": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/jdataview/-/jdataview-2.5.0.tgz", + "integrity": "sha512-ZJop3D5nyDcWPBPv4NPnhCvx3HgQNsCXMfw8gpNKY16BobgxmVF+kJ08aHuqk6bJQVeL2mkf6nDCcZPMompalw==" + }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -17675,6 +17716,44 @@ "node": ">=4.0" } }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/jszip/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/jszip/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/jszip/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -17737,6 +17816,14 @@ "node": ">= 0.8.0" } }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/lilconfig": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", @@ -19223,6 +19310,11 @@ "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==" }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, "node_modules/param-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", @@ -20667,8 +20759,7 @@ "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "node_modules/progress": { "version": "2.0.3", @@ -22874,6 +22965,11 @@ "node": ">=0.10.0" } }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -28942,6 +29038,25 @@ "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==", "dev": true }, + "@mapbox/shp-write": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@mapbox/shp-write/-/shp-write-0.4.3.tgz", + "integrity": "sha512-mkKIHgtnytyP+cXfk+joYeWwk+SODZ7COQusTcO1rZQVUn68MjzW2F74XMsNIusabnwj5aoKNI8B3mYq9KZ9AQ==", + "requires": { + "dbf": "0.2.0", + "file-saver": "2.0.5", + "jszip": "^3.10.1" + } + }, + "@maphubs/tokml": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@maphubs/tokml/-/tokml-0.6.1.tgz", + "integrity": "sha512-C1qIeLpSDKPIQmYxiPmSZbw1eQDIaWTzeIMf2ym3gzY1q0b7UwDQDuUpccidrdLqOcERx2dlT4URhKl9H2scfA==", + "requires": { + "minimist": "^1.2.5", + "rw": "^1.3.3" + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -33268,8 +33383,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" }, "cors": { "version": "2.8.5", @@ -34266,6 +34380,14 @@ "whatwg-url": "^7.0.0" } }, + "dbf": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/dbf/-/dbf-0.2.0.tgz", + "integrity": "sha512-JMeGCJzFcVGsfnkIuqrnuiSkJpTu6c4AKJg3LXDnfW7zU/2PSIue3KG4fz9c+/mmlDzT+rVCwyEHzzhxzrzPiA==", + "requires": { + "jdataview": "~2.5.0" + } + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -36946,6 +37068,11 @@ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + }, "immer": { "version": "9.0.21", "resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz", @@ -37638,6 +37765,11 @@ "istanbul-lib-report": "^3.0.0" } }, + "jdataview": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/jdataview/-/jdataview-2.5.0.tgz", + "integrity": "sha512-ZJop3D5nyDcWPBPv4NPnhCvx3HgQNsCXMfw8gpNKY16BobgxmVF+kJ08aHuqk6bJQVeL2mkf6nDCcZPMompalw==" + }, "jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -40154,6 +40286,46 @@ "object.assign": "^4.1.0" } }, + "jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -40206,6 +40378,14 @@ "type-check": "~0.3.2" } }, + "lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "requires": { + "immediate": "~3.0.5" + } + }, "lilconfig": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", @@ -41369,6 +41549,11 @@ "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==" }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, "param-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", @@ -42472,8 +42657,7 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "progress": { "version": "2.0.3", @@ -44186,6 +44370,11 @@ } } }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, "setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", diff --git a/package.json b/package.json index 45a0e644..6481a3b7 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,8 @@ "dependencies": { "@babel/runtime": "^7.23.1", "@eonasdan/tempus-dominus": "^6.2.6", + "@mapbox/shp-write": "^0.4.3", + "@maphubs/tokml": "^0.6.1", "@popperjs/core": "^2.11.6", "@terraformer/wkt": "^2.2.0", "@turf/turf": "^6.5.0", diff --git a/private/api/proj42wkt.py b/private/api/proj42wkt.py new file mode 100644 index 00000000..a67b54ad --- /dev/null +++ b/private/api/proj42wkt.py @@ -0,0 +1,12 @@ +import sys +from osgeo import osr +try: + from urllib.parse import unquote +except ImportError: + from urllib import unquote + +srs_def = unquote(sys.argv[1]) + +proj = osr.SpatialReference() +proj.ImportFromProj4(srs_def) +print(proj.ExportToWkt()) \ No newline at end of file diff --git a/scripts/server.js b/scripts/server.js index e559d43d..f712d89f 100644 --- a/scripts/server.js +++ b/scripts/server.js @@ -657,10 +657,9 @@ setups.getBackendSetups(function (setups) { ], function (error, stdout, stderr) { if (error) { - logger("warn", error) + logger("warn", error); res.status(400).send(); - } - else { + } else { res.send(stdout); } } @@ -685,10 +684,9 @@ setups.getBackendSetups(function (setups) { ["private/api/BandsToProfile.py", path, x, y, xyorll, bands], function (error, stdout, stderr) { if (error) { - logger("warn", error) + logger("warn", error); res.status(400).send(); - } - else { + } else { res.send(stdout); } } @@ -766,6 +764,26 @@ setups.getBackendSetups(function (setups) { } ); + //utils chronos (spice time converter) + app.get( + `${ROOT_PATH}/api/utils/proj42wkt`, + ensureUser(), + ensureGroup(permissions.users), + function (req, res) { + const proj4 = encodeURIComponent(req.query.proj4); + + execFile( + "python", + ["private/api/proj42wkt.py", proj4], + function (error, stdout, stderr) { + if (error) + logger("error", "proj42wkt failure:", "server", null, error); + res.send(stdout); + } + ); + } + ); + /* //http://localhost:8888/test/timeLayer?start=2022-05-12T16:10:11.648750Z&end=2022-05-12T16:25:25.084933Z app.get("/test/timeLayer", (req, res) => { diff --git a/src/essence/Ancillary/Coordinates.js b/src/essence/Ancillary/Coordinates.js index fd14484a..46213747 100644 --- a/src/essence/Ancillary/Coordinates.js +++ b/src/essence/Ancillary/Coordinates.js @@ -53,7 +53,7 @@ const Coordinates = { stateIndices: [], // Will be like ['ll', 'cproj', 'rxy'] states: { ll: { - ancillaryTitle: 'lonlat', + ancillaryTitle: 'lon/lat', names: ['Longitude', 'Latitude', 'Elevation'], units: ['°', '°', 'm'], precision: [8, 8, 3], @@ -61,7 +61,7 @@ const Coordinates = { coordOffset: [0, 0], }, en: { - ancillaryTitle: 'll', + ancillaryTitle: 'east/north', names: ['Easting', 'Northing', 'Elevation'], units: ['m', 'm', 'm'], precision: [3, 3, 3], diff --git a/src/essence/Basics/Formulae_/Formulae_.js b/src/essence/Basics/Formulae_/Formulae_.js index 6be812e0..7a2820e9 100644 --- a/src/essence/Basics/Formulae_/Formulae_.js +++ b/src/essence/Basics/Formulae_/Formulae_.js @@ -1451,6 +1451,43 @@ var Formulae_ = { string += ']}' return string }, + // https://github.com/mapbox/simplestyle-spec + geoJSONForceSimpleStyleSpec(geojson, stringifyPropertyObjects) { + const g = JSON.parse(JSON.stringify(geojson)) + g.features.forEach((f) => { + if (f.properties.style) { + // style.color -> stroke + if (f.properties.style.color != null) + f.properties['stroke'] = f.properties.style.color + // style.opacity -> stroke-opacity + if (f.properties.style.opacity != null) + f.properties['stroke-opacity'] = f.properties.style.opacity + // style.weight -> stroke-width + if (f.properties.style.weight != null) + f.properties['stroke-width'] = f.properties.style.weight + // style.fillColor -> fill + if (f.properties.style.fillColor != null) + f.properties['fill'] = f.properties.style.fillColor + // style.fillOpacity -> fill-opacity + if (f.properties.style.fillOpacity != null) + f.properties['fill-opacity'] = + f.properties.style.fillOpacity + } + if (stringifyPropertyObjects) + Object.keys(f.properties).forEach((p) => { + const val = f.properties[p] + if ( + typeof val === 'object' && + !Array.isArray(val) && + val !== null + ) { + let str = JSON.stringify(val).replaceAll(`"`, '') + f.properties[p] = str.substring(1, str.length - 1) + } + }) + }) + return g + }, // Gets all tiles with tile xyz at zoom z tilesWithin(xyz, z) { let tiles = [] @@ -1628,7 +1665,7 @@ var Formulae_ = { var cvd = document.body.appendChild(cv) return cv.toDataURL() }, - downloadObject(exportObj, exportName, exportExt) { + downloadObject(exportObj, exportName, exportExt, downloadType) { var strung if (typeof exportObj === 'string') { strung = exportObj @@ -1652,7 +1689,7 @@ var Formulae_ = { try { // Create a blob of the data var fileToSave = new Blob([strung], { - type: 'application/json', + type: `application/${downloadType || 'json'}`, name: fileName, }) // Save the file //from FileSaver @@ -1660,7 +1697,8 @@ var Formulae_ = { } catch (err) { //https://stackoverflow.com/questions/19721439/download-json-object-as-a-file-from-browser#answer-30800715 var dataStr = - 'data:text/json;charset=utf-8,' + encodeURIComponent(strung) + `data:text/${downloadType || 'json'};charset=utf-8,` + + encodeURIComponent(strung) var downloadAnchorNode = document.createElement('a') downloadAnchorNode.setAttribute('href', dataStr) downloadAnchorNode.setAttribute('download', fileName) diff --git a/src/essence/Tools/Draw/DrawTool.css b/src/essence/Tools/Draw/DrawTool.css index 90f343ee..a5f4aad1 100644 --- a/src/essence/Tools/Draw/DrawTool.css +++ b/src/essence/Tools/Draw/DrawTool.css @@ -2283,7 +2283,7 @@ padding: 0; } #drawToolDrawFilesListElemContextMenu li { - padding: 6px 32px; + padding: 6px 9px; cursor: pointer; color: var(--color-a7); border-bottom: 1px solid var(--color-a1); @@ -2421,16 +2421,54 @@ background: var(--color-c); } -#cmExportGeoJSON, -#cmExportSourceGeoJSON { +#cmExport { + cursor: default; +} +#cmExport > div { + display: flex; + margin-bottom: 2px; +} +#cmExport > div:first-child { + margin-bottom: 4px; +} +#cmExport > div:not(:first-child) { + justify-content: space-between; + line-height: 27px; +} +#cmExport > div:first-child > div { + padding-left: 4px; +} +#cmExport:hover { + background: var(--color-a2) !important; +} +#cmExport > div > div:first-child { + color: var(--color-f); + padding-left: 19px; +} +#cmExport .dropdown { + background-color: var(--color-a1); + color: #ededed; + border: none; + width: 96px; + height: 27px; + font-size: 14px; + padding: 0px 3px; + border-left: 1px solid var(--color-a1-5); +} +#cmExportGo { display: block; + width: 100%; + margin-left: 19px; + height: 27px; + line-height: 27px; + margin-top: 2px; + background-color: var(--color-a); } -#cmExportGeoJSON > div:last-child, -#cmExportSourceGeoJSON > div:last-child { - font-size: 12px; - text-align: right; +#cmExportGo:hover { + background-color: var(--color-a1-5); } + /*FILE INFO TEMPLATE MODAL*/ #drawToolFileTemplateEditModal { background: var(--color-a-5); diff --git a/src/essence/Tools/Draw/DrawTool.js b/src/essence/Tools/Draw/DrawTool.js index ca11e032..b7bd39e2 100644 --- a/src/essence/Tools/Draw/DrawTool.js +++ b/src/essence/Tools/Draw/DrawTool.js @@ -226,7 +226,7 @@ var markup = [ "