umap-project 2.4.1__py3-none-any.whl → 2.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- umap/__init__.py +1 -1
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +145 -90
- umap/locale/en/LC_MESSAGES/django.po +13 -13
- umap/locale/eu/LC_MESSAGES/django.mo +0 -0
- umap/locale/eu/LC_MESSAGES/django.po +145 -89
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +100 -50
- umap/static/umap/base.css +5 -2
- umap/static/umap/content.css +2 -2
- umap/static/umap/css/contextmenu.css +11 -0
- umap/static/umap/css/dialog.css +25 -4
- umap/static/umap/css/importers.css +2 -0
- umap/static/umap/css/panel.css +6 -4
- umap/static/umap/css/slideshow.css +69 -0
- umap/static/umap/css/tableeditor.css +69 -0
- umap/static/umap/css/tooltip.css +3 -3
- umap/static/umap/img/16-white.svg +4 -0
- umap/static/umap/img/source/16-white.svg +5 -1
- umap/static/umap/js/components/alerts/alert.css +11 -11
- umap/static/umap/js/components/alerts/alert.js +1 -1
- umap/static/umap/js/modules/autocomplete.js +27 -5
- umap/static/umap/js/modules/browser.js +20 -14
- umap/static/umap/js/modules/caption.js +4 -4
- umap/static/umap/js/modules/dompurify.js +2 -3
- umap/static/umap/js/modules/facets.js +53 -17
- umap/static/umap/js/modules/formatter.js +153 -0
- umap/static/umap/js/modules/global.js +25 -16
- umap/static/umap/js/modules/help.js +26 -26
- umap/static/umap/js/modules/importer.js +10 -10
- umap/static/umap/js/modules/importers/communesfr.js +3 -1
- umap/static/umap/js/modules/importers/datasets.js +8 -6
- umap/static/umap/js/modules/importers/geodatamine.js +14 -14
- umap/static/umap/js/modules/importers/overpass.js +19 -15
- umap/static/umap/js/modules/orderable.js +2 -2
- umap/static/umap/js/modules/request.js +1 -1
- umap/static/umap/js/modules/rules.js +26 -11
- umap/static/umap/js/modules/schema.js +16 -12
- umap/static/umap/js/{umap.share.js → modules/share.js} +58 -103
- umap/static/umap/js/modules/slideshow.js +141 -0
- umap/static/umap/js/modules/sync/engine.js +3 -3
- umap/static/umap/js/modules/sync/updaters.js +10 -11
- umap/static/umap/js/modules/sync/websocket.js +1 -1
- umap/static/umap/js/modules/tableeditor.js +329 -0
- umap/static/umap/js/modules/ui/base.js +93 -0
- umap/static/umap/js/modules/ui/contextmenu.js +50 -0
- umap/static/umap/js/modules/ui/dialog.js +169 -31
- umap/static/umap/js/modules/ui/panel.js +7 -5
- umap/static/umap/js/modules/ui/tooltip.js +7 -77
- umap/static/umap/js/modules/urls.js +1 -2
- umap/static/umap/js/modules/utils.js +36 -16
- umap/static/umap/js/umap.controls.js +27 -29
- umap/static/umap/js/umap.core.js +19 -15
- umap/static/umap/js/umap.datalayer.permissions.js +15 -18
- umap/static/umap/js/umap.features.js +113 -131
- umap/static/umap/js/umap.forms.js +203 -228
- umap/static/umap/js/umap.icon.js +17 -22
- umap/static/umap/js/umap.js +117 -107
- umap/static/umap/js/umap.layer.js +374 -324
- umap/static/umap/js/umap.permissions.js +7 -10
- umap/static/umap/js/umap.popup.js +20 -20
- umap/static/umap/locale/am_ET.js +22 -5
- umap/static/umap/locale/am_ET.json +22 -5
- umap/static/umap/locale/ar.js +22 -5
- umap/static/umap/locale/ar.json +22 -5
- umap/static/umap/locale/ast.js +22 -5
- umap/static/umap/locale/ast.json +22 -5
- umap/static/umap/locale/bg.js +22 -5
- umap/static/umap/locale/bg.json +22 -5
- umap/static/umap/locale/br.js +22 -5
- umap/static/umap/locale/br.json +22 -5
- umap/static/umap/locale/ca.js +56 -39
- umap/static/umap/locale/ca.json +56 -39
- umap/static/umap/locale/cs_CZ.js +22 -5
- umap/static/umap/locale/cs_CZ.json +22 -5
- umap/static/umap/locale/da.js +22 -5
- umap/static/umap/locale/da.json +22 -5
- umap/static/umap/locale/de.js +22 -5
- umap/static/umap/locale/de.json +22 -5
- umap/static/umap/locale/el.js +27 -10
- umap/static/umap/locale/el.json +27 -10
- umap/static/umap/locale/en.js +22 -6
- umap/static/umap/locale/en.json +22 -6
- umap/static/umap/locale/en_US.json +22 -5
- umap/static/umap/locale/es.js +22 -6
- umap/static/umap/locale/es.json +22 -6
- umap/static/umap/locale/et.js +22 -5
- umap/static/umap/locale/et.json +22 -5
- umap/static/umap/locale/eu.js +167 -150
- umap/static/umap/locale/eu.json +167 -150
- umap/static/umap/locale/fa_IR.js +22 -5
- umap/static/umap/locale/fa_IR.json +22 -5
- umap/static/umap/locale/fi.js +22 -5
- umap/static/umap/locale/fi.json +22 -5
- umap/static/umap/locale/fr.js +22 -6
- umap/static/umap/locale/fr.json +22 -6
- umap/static/umap/locale/gl.js +22 -5
- umap/static/umap/locale/gl.json +22 -5
- umap/static/umap/locale/he.js +22 -5
- umap/static/umap/locale/he.json +22 -5
- umap/static/umap/locale/hr.js +22 -5
- umap/static/umap/locale/hr.json +22 -5
- umap/static/umap/locale/hu.js +89 -72
- umap/static/umap/locale/hu.json +89 -72
- umap/static/umap/locale/id.js +22 -5
- umap/static/umap/locale/id.json +22 -5
- umap/static/umap/locale/is.js +22 -5
- umap/static/umap/locale/is.json +22 -5
- umap/static/umap/locale/it.js +22 -5
- umap/static/umap/locale/it.json +22 -5
- umap/static/umap/locale/ja.js +22 -5
- umap/static/umap/locale/ja.json +22 -5
- umap/static/umap/locale/ko.js +22 -5
- umap/static/umap/locale/ko.json +22 -5
- umap/static/umap/locale/lt.js +22 -5
- umap/static/umap/locale/lt.json +22 -5
- umap/static/umap/locale/ms.js +22 -5
- umap/static/umap/locale/ms.json +22 -5
- umap/static/umap/locale/nl.js +22 -5
- umap/static/umap/locale/nl.json +22 -5
- umap/static/umap/locale/no.js +22 -5
- umap/static/umap/locale/no.json +22 -5
- umap/static/umap/locale/pl.js +22 -5
- umap/static/umap/locale/pl.json +22 -5
- umap/static/umap/locale/pl_PL.json +22 -5
- umap/static/umap/locale/pt.js +22 -6
- umap/static/umap/locale/pt.json +22 -6
- umap/static/umap/locale/pt_BR.js +22 -5
- umap/static/umap/locale/pt_BR.json +22 -5
- umap/static/umap/locale/pt_PT.js +22 -5
- umap/static/umap/locale/pt_PT.json +22 -5
- umap/static/umap/locale/ro.js +22 -5
- umap/static/umap/locale/ro.json +22 -5
- umap/static/umap/locale/ru.js +22 -5
- umap/static/umap/locale/ru.json +22 -5
- umap/static/umap/locale/sk_SK.js +22 -5
- umap/static/umap/locale/sk_SK.json +22 -5
- umap/static/umap/locale/sl.js +22 -5
- umap/static/umap/locale/sl.json +22 -5
- umap/static/umap/locale/sr.js +22 -5
- umap/static/umap/locale/sr.json +22 -5
- umap/static/umap/locale/sv.js +22 -5
- umap/static/umap/locale/sv.json +22 -5
- umap/static/umap/locale/th_TH.js +22 -5
- umap/static/umap/locale/th_TH.json +22 -5
- umap/static/umap/locale/tr.js +22 -5
- umap/static/umap/locale/tr.json +22 -5
- umap/static/umap/locale/uk_UA.js +22 -5
- umap/static/umap/locale/uk_UA.json +22 -5
- umap/static/umap/locale/vi.js +22 -5
- umap/static/umap/locale/vi.json +22 -5
- umap/static/umap/locale/vi_VN.json +22 -5
- umap/static/umap/locale/zh.js +22 -5
- umap/static/umap/locale/zh.json +22 -5
- umap/static/umap/locale/zh_CN.json +22 -5
- umap/static/umap/locale/zh_TW.Big5.json +22 -5
- umap/static/umap/locale/zh_TW.js +22 -5
- umap/static/umap/locale/zh_TW.json +22 -5
- umap/static/umap/map.css +9 -153
- umap/static/umap/vars.css +15 -0
- umap/static/umap/vendors/dompurify/purify.es.js +5 -59
- umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -1
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +410 -428
- umap/static/umap/vendors/geojson-to-gpx/index.js +155 -0
- umap/static/umap/vendors/osmtogeojson/osmtogeojson.js +1 -2
- umap/static/umap/vendors/togeojson/togeojson.es.js +1109 -0
- umap/static/umap/vendors/togeojson/{togeojson.umd.js.map → togeojson.es.mjs.map} +1 -1
- umap/static/umap/vendors/tokml/tokml.es.js +895 -0
- umap/static/umap/vendors/tokml/tokml.es.mjs.map +1 -0
- umap/storage.py +6 -2
- umap/templates/umap/components/alerts/alert.html +3 -3
- umap/templates/umap/css.html +3 -0
- umap/templates/umap/js.html +0 -6
- umap/tests/fixtures/categorized_highway.geojson +1 -0
- umap/tests/fixtures/test_import_osm_relation.json +130 -0
- umap/tests/integration/conftest.py +8 -1
- umap/tests/integration/test_browser.py +3 -2
- umap/tests/integration/test_categorized_layer.py +141 -0
- umap/tests/integration/test_conditional_rules.py +21 -0
- umap/tests/integration/test_datalayer.py +9 -4
- umap/tests/integration/test_edit_datalayer.py +1 -0
- umap/tests/integration/test_edit_polygon.py +1 -1
- umap/tests/integration/test_export_map.py +2 -3
- umap/tests/integration/test_import.py +22 -0
- umap/tests/integration/test_map_preview.py +36 -2
- umap/tests/integration/test_tableeditor.py +158 -4
- umap/tests/integration/test_websocket_sync.py +2 -2
- umap/tests/test_views.py +2 -2
- umap/views.py +3 -2
- {umap_project-2.4.1.dist-info → umap_project-2.5.0.dist-info}/METADATA +8 -8
- {umap_project-2.4.1.dist-info → umap_project-2.5.0.dist-info}/RECORD +194 -184
- umap/static/umap/js/umap.slideshow.js +0 -165
- umap/static/umap/js/umap.tableeditor.js +0 -118
- umap/static/umap/vendors/togeojson/togeojson.umd.js +0 -2
- umap/static/umap/vendors/togpx/togpx.js +0 -547
- umap/static/umap/vendors/tokml/tokml.js +0 -343
- {umap_project-2.4.1.dist-info → umap_project-2.5.0.dist-info}/WHEEL +0 -0
- {umap_project-2.4.1.dist-info → umap_project-2.5.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.4.1.dist-info → umap_project-2.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<path d="M 16.0401,2.3158 H 2.005 v 14.0351 h 14.0351 z" fill="#ffffff" id="path1259" />
|
|
17
17
|
</mask>
|
|
18
18
|
</defs>
|
|
19
|
-
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="
|
|
19
|
+
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="12.134503" inkscape:cx="19.32506" inkscape:cy="29.296626" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" inkscape:window-width="1920" inkscape:window-height="1011" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" showguides="true" inkscape:guide-bbox="true" inkscape:snap-grids="true" inkscape:snap-to-guides="true" inkscape:showpageshadow="2" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1">
|
|
20
20
|
<inkscape:grid type="xygrid" id="grid3004" empspacing="4" visible="true" enabled="true" snapvisiblegridlinesonly="true" originx="0" originy="0" spacingy="1" spacingx="1" units="px" />
|
|
21
21
|
<sodipodi:guide orientation="-1,0" position="24,168" id="guide3084" inkscape:locked="false" inkscape:label="" inkscape:color="rgb(0,134,229)" />
|
|
22
22
|
<sodipodi:guide orientation="0,1" position="0,96" id="guide3086" inkscape:locked="false" inkscape:label="" inkscape:color="rgb(0,134,229)" />
|
|
@@ -210,5 +210,9 @@
|
|
|
210
210
|
<path fill-rule="evenodd" clip-rule="evenodd" d="m 87.166638,966.62162 -3.166579,-2.99638 -3.166613,2.99638 -0.833375,-0.78858 3.4333,-3.24873 c 0.312979,-0.29613 0.82041,-0.29613 1.133389,0 l 3.43324,3.24873 z m -6.333275,3.48122 3.166626,2.99639 3.166649,-2.99639 0.833362,0.78859 -3.433322,3.24872 c -0.312968,0.29608 -0.820411,0.29608 -1.133378,0 l -3.4333,-3.24872 z" fill="#efefef" id="path1-675" style="stroke-width:0.999996" />
|
|
211
211
|
<path style="fill:#efefef;fill-opacity:1;stroke-width:0.999996" d="m 63.166637,974.36218 -3.166626,-2.99639 -3.166649,2.99639 -0.833362,-0.78859 3.433322,-3.24872 c 0.312968,-0.29608 0.820411,-0.29608 1.133378,0 l 3.4333,3.24872 z" id="path5" />
|
|
212
212
|
<path style="fill:#efefef;fill-opacity:1;stroke-width:0.999996" d="m 56.000071,963.15076 3.43324,3.24873 c 0.312979,0.29613 0.82041,0.29613 1.133389,0 l 3.4333,-3.24873 -0.833375,-0.78858 -3.166613,2.99638 -3.166579,-2.99638 z" id="path1-675-2" />
|
|
213
|
+
<path d="m 16.583784,844.26236 c 0.129729,-0.17297 0.259459,-0.38919 0.302702,-0.64865 h 2.681081 c 0.25946,0 0.432433,-0.17297 0.432433,-0.43243 0,-0.25946 -0.172973,-0.43243 -0.432433,-0.43243 h -2.681081 c -0.08649,-0.38919 -0.345946,-0.77838 -0.691891,-1.03784 -0.821622,-0.60541 -1.945946,-0.38919 -2.508109,0.38919 -0.129729,0.17297 -0.216216,0.38919 -0.302702,0.64865 h -8.9513515 c -0.2594595,0 -0.4324325,0.17297 -0.4324325,0.43243 0,0.25946 0.172973,0.43243 0.4324325,0.43243 h 8.9513515 c 0.08649,0.38919 0.345946,0.77838 0.691892,1.03784 0.778378,0.6054 1.945946,0.43243 2.508108,-0.38919 z m -1.989189,-0.3027 c -0.216217,-0.12973 -0.345946,-0.34595 -0.38919,-0.60541 -0.04324,-0.25946 0,-0.47567 0.172973,-0.69189 0.302703,-0.43243 0.908109,-0.51892 1.297298,-0.21622 0.216216,0.12973 0.345946,0.34595 0.389189,0.60541 0,0.0432 0,0.0865 0,0.12973 0,0.21621 -0.04324,0.38919 -0.172973,0.56216 -0.302703,0.43243 -0.908108,0.51892 -1.297297,0.21622 z m -4.410811,5.23243 c 0.129729,-0.17297 0.259459,-0.38919 0.302702,-0.64865 h 9.081081 c 0.25946,0 0.432433,-0.17297 0.432433,-0.43243 0,-0.25946 -0.172973,-0.43243 -0.432433,-0.43243 h -9.081081 c -0.08649,-0.38919 -0.345945,-0.77838 -0.6918914,-1.03784 -0.8216216,-0.60541 -1.9459459,-0.38919 -2.5081081,0.38919 -0.1297297,0.17297 -0.2162162,0.38919 -0.3027027,0.64865 h -2.5513513 c -0.2594595,0 -0.4324325,0.17297 -0.4324325,0.43243 0,0.25946 0.172973,0.43243 0.4324325,0.43243 h 2.5513513 c 0.086486,0.38919 0.3459459,0.77838 0.6918919,1.03784 0.7783784,0.56216 1.9027027,0.38919 2.5081083,-0.38919 z m -1.9891894,-0.34595 c -0.2162162,-0.12973 -0.3459459,-0.34594 -0.3891892,-0.6054 -0.043243,-0.25946 0,-0.47568 0.172973,-0.69189 0.3027027,-0.43244 0.9081081,-0.51892 1.2972973,-0.21622 0.2162162,0.12973 0.3459459,0.34595 0.3891892,0.60541 0,0.0432 0,0.0865 0,0.12973 0,0 0,0 0,0 0,0 0,0 0,0 0,0.21621 -0.043243,0.38918 -0.172973,0.56216 -0.3027027,0.43243 -0.9081081,0.51892 -1.2972973,0.21621 z m 6.7027024,5.23244 c 0.12973,-0.17298 0.25946,-0.38919 0.302703,-0.64865 h 4.367567 c 0.25946,0 0.432433,-0.17298 0.432433,-0.43244 0,-0.25945 -0.172973,-0.43243 -0.432433,-0.43243 h -4.367567 c -0.08649,-0.38919 -0.345946,-0.77838 -0.691892,-1.03784 -0.389189,-0.3027 -0.864865,-0.38918 -1.34054,-0.34594 -0.475676,0.0865 -0.908109,0.34594 -1.167568,0.73513 -0.12973,0.21622 -0.216216,0.38919 -0.302703,0.64865 h -7.2648645 c -0.2594595,0 -0.4324325,0.17298 -0.4324325,0.43243 0,0.25946 0.172973,0.43244 0.4324325,0.43244 h 7.3081085 c 0.08649,0.38919 0.345945,0.77838 0.691891,1.03784 0.778379,0.56216 1.902703,0.38918 2.464865,-0.38919 z m -1.989189,-0.30271 c -0.216216,-0.17297 -0.345946,-0.38919 -0.389189,-0.64865 0,-0.0432 0,-0.0865 0,-0.0865 0,-0.0433 0,-0.0865 0,-0.0865 0,-0.17297 0.08649,-0.3027 0.172973,-0.43243 0.12973,-0.21622 0.345946,-0.34595 0.605405,-0.38919 0.25946,-0.0432 0.475676,0.0432 0.691892,0.17297 0.216216,0.12973 0.345946,0.34595 0.389189,0.60541 0,0.0432 0,0.0865 0,0.12973 0,0 0,0 0,0 0,0 0,0 0,0 0,0.21621 -0.04324,0.38919 -0.172973,0.56216 -0.302702,0.38919 -0.864864,0.47568 -1.297297,0.17297 z" id="path1-3" style="fill:#4d4d4d;fill-opacity:1;stroke-width:1" />
|
|
214
|
+
<path style="fill:#f2f2f2;stroke:#999999;stroke-width:0.25;paint-order:fill markers stroke" d="m 14.421687,32.436774 c -0.404754,-0.187394 -0.732475,-0.526889 -0.903241,-0.93569 l -0.129092,-0.309036 -4.5520263,-0.0013 c -2.5036146,-6.92e-4 -4.601133,-0.0324 -4.661152,-0.07045 -0.065629,-0.04161 -0.098477,-0.18071 -0.08241,-0.348979 l 0.026716,-0.279792 4.6347227,-0.02129 4.6347226,-0.02129 0.128805,-0.308351 c 0.377978,-0.904848 1.434044,-1.334376 2.303918,-0.937059 0.417306,0.190606 0.835088,0.617095 0.952249,0.972096 l 0.09065,0.274685 h 1.474083 c 1.418969,0 1.477589,0.0066 1.567871,0.175244 0.06808,0.127208 0.06936,0.228859 0.0047,0.370843 -0.08898,0.195282 -0.09153,0.1956 -1.567871,0.1956 h -1.478749 l -0.09216,0.279253 c -0.114748,0.347688 -0.600864,0.857219 -0.961643,1.007963 -0.378064,0.157965 -0.998032,0.139015 -1.390062,-0.04249 z m 1.259483,-0.796476 c 0.579671,-0.406017 0.557382,-1.24308 -0.04298,-1.614124 -0.691117,-0.427134 -1.613162,0.192303 -1.464646,0.983962 0.08466,0.451286 0.465191,0.758779 0.939003,0.758779 0.215497,0 0.46584,-0.05663 0.568623,-0.128617 z" id="path7" transform="translate(0,812.36218)" />
|
|
215
|
+
<path style="fill:#f2f2f2;stroke:#999999;stroke-width:0.25;paint-order:fill markers stroke" d="m 8.1902877,37.423896 c -0.4872187,-0.174113 -0.7923051,-0.442073 -0.9946703,-0.873627 l -0.1907982,-0.406887 -1.3702708,-0.0034 c -1.4982701,-0.0037 -1.5910875,-0.03214 -1.5406237,-0.47225 l 0.026557,-0.23161 1.4211632,-0.02255 1.4211632,-0.02255 0.1982698,-0.389502 c 0.347892,-0.683434 0.8634941,-1.009111 1.592299,-1.005764 0.7177082,0.0033 1.3415151,0.432422 1.6290831,1.120669 l 0.116359,0.278485 h 4.65745 c 4.520341,0 4.659962,0.0047 4.742759,0.159402 0.1159,0.216562 0.107667,0.300926 -0.04419,0.452784 -0.114657,0.114657 -0.660626,0.129501 -4.763204,0.129501 h -4.633703 l -0.104975,0.290304 c -0.152574,0.421935 -0.6274874,0.844474 -1.1103021,0.987854 -0.4962156,0.147361 -0.6614998,0.148792 -1.0523644,0.0091 z m 0.9689602,-0.845129 c 0.6980003,-0.331223 0.6980003,-1.377155 0,-1.708378 -0.3515556,-0.166824 -0.4925823,-0.168492 -0.8270409,-0.0098 -0.3376099,0.160207 -0.5444962,0.513326 -0.5444962,0.929363 0,0.368008 0.1600657,0.606145 0.5356626,0.796928 0.3157622,0.16039 0.4841923,0.158752 0.8358745,-0.0081 z" id="path8" transform="translate(0,812.36218)" />
|
|
216
|
+
<path style="fill:#f2f2f2;stroke:#999999;stroke-width:0.25;paint-order:fill markers stroke" d="m 12.773494,42.243521 c -0.4045,-0.187277 -0.732456,-0.526846 -0.902897,-0.934868 l -0.128748,-0.308213 -3.8106837,-0.02143 -3.8106834,-0.02142 -0.026557,-0.23161 c -0.055311,-0.482381 -0.1677415,-0.468805 3.8892984,-0.469606 l 3.7189457,-7.33e-4 0.21287,-0.431917 c 0.651632,-1.322166 2.472575,-1.284611 3.125651,0.06446 l 0.178591,0.36892 h 2.297219 c 2.258426,0 2.298803,0.003 2.391007,0.175244 0.06808,0.127207 0.06936,0.228859 0.0047,0.370843 l -0.08912,0.1956 h -2.305381 -2.30538 l -0.15493,0.350241 c -0.387132,0.875164 -1.437261,1.286451 -2.283867,0.894485 z m 1.063202,-0.700358 c 0.378023,-0.157949 0.544298,-0.425794 0.541165,-0.871741 -0.004,-0.573585 -0.363385,-0.908772 -0.974299,-0.908772 -0.312041,0 -0.40386,0.04292 -0.649922,0.303826 -0.257768,0.273313 -0.282484,0.339859 -0.246104,0.662621 0.04524,0.401361 0.228194,0.651219 0.595596,0.813394 0.317179,0.140006 0.399909,0.140082 0.733564,6.68e-4 z" id="path9" transform="translate(0,812.36218)" />
|
|
213
217
|
</g>
|
|
214
218
|
</svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[role="dialog"] {
|
|
1
|
+
.umap-alert[role="dialog"] {
|
|
2
2
|
box-sizing: border-box;
|
|
3
3
|
min-height: 46px;
|
|
4
4
|
line-height: 46px;
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
font-weight: bold;
|
|
10
10
|
color: #fff;
|
|
11
11
|
font-size: 0.8em;
|
|
12
|
-
z-index: 1012;
|
|
13
12
|
border-radius: 2px;
|
|
14
13
|
margin-top: calc(var(--header-height) + var(--panel-gutter));
|
|
15
14
|
display: flex;
|
|
@@ -19,37 +18,38 @@
|
|
|
19
18
|
transform: translate(-50%, 0);
|
|
20
19
|
max-width: calc(100% - var(--panel-gutter) * 2);
|
|
21
20
|
width: max-content;
|
|
21
|
+
z-index: var(--zindex-alert);
|
|
22
22
|
}
|
|
23
|
-
[role="dialog"] > div {
|
|
23
|
+
.umap-alert[role="dialog"] > div {
|
|
24
24
|
margin: 0 auto;
|
|
25
25
|
min-width: 60%;
|
|
26
26
|
background-size: 20px;
|
|
27
27
|
background-position: 0 15px;
|
|
28
28
|
padding-left: 28px;
|
|
29
29
|
}
|
|
30
|
-
[role="dialog"][data-level="info"] > div {
|
|
30
|
+
.umap-alert[role="dialog"][data-level="info"] > div {
|
|
31
31
|
background-image: url('../../../img/alert-icon-info.svg');
|
|
32
32
|
background-repeat: no-repeat;
|
|
33
33
|
}
|
|
34
|
-
[role="dialog"][data-level="success"] > div {
|
|
34
|
+
.umap-alert[role="dialog"][data-level="success"] > div {
|
|
35
35
|
background-image: url('../../../img/alert-icon-success.svg');
|
|
36
36
|
background-repeat: no-repeat;
|
|
37
37
|
}
|
|
38
|
-
[role="dialog"][data-level="error"] > div {
|
|
38
|
+
.umap-alert[role="dialog"][data-level="error"] > div {
|
|
39
39
|
background-image: url('../../../img/alert-icon-error.svg');
|
|
40
40
|
background-repeat: no-repeat;
|
|
41
41
|
}
|
|
42
|
-
[role="dialog"][data-level="error"] {
|
|
42
|
+
.umap-alert[role="dialog"][data-level="error"] {
|
|
43
43
|
background-color: var(--color-darkRed);
|
|
44
44
|
}
|
|
45
|
-
[role="dialog"] a {
|
|
45
|
+
.umap-alert[role="dialog"] a {
|
|
46
46
|
text-decoration: underline;
|
|
47
47
|
}
|
|
48
|
-
[role="dialog"] label {
|
|
48
|
+
.umap-alert[role="dialog"] label {
|
|
49
49
|
font-size: .8rem;
|
|
50
50
|
font-weight: normal;
|
|
51
51
|
}
|
|
52
|
-
[role="dialog"] a[target="_blank"] {
|
|
52
|
+
.umap-alert[role="dialog"] a[target="_blank"] {
|
|
53
53
|
background: url('../../../img/icon-external-link.svg') no-repeat right center;
|
|
54
54
|
padding-right: 14px;
|
|
55
55
|
background-size: 12px;
|
|
@@ -127,7 +127,7 @@ h3[role="alert"] + p {
|
|
|
127
127
|
#link-wrapper {
|
|
128
128
|
margin-bottom: 1rem;
|
|
129
129
|
}
|
|
130
|
-
[role="dialog"] #conflict-wrapper a[target="_blank"] {
|
|
130
|
+
.umap-alert[role="dialog"] #conflict-wrapper a[target="_blank"] {
|
|
131
131
|
background-position-y: 16px;
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -140,7 +140,7 @@ class uMapAlertConflict extends uMapAlert {
|
|
|
140
140
|
// biome-ignore lint/style/useNumberNamespace: Number.Infinity returns undefined by default
|
|
141
141
|
const {
|
|
142
142
|
level = 'info',
|
|
143
|
-
duration =
|
|
143
|
+
duration = Number.POSITIVE_INFINITY,
|
|
144
144
|
message = '',
|
|
145
145
|
forceCallback = undefined,
|
|
146
146
|
} = event.detail
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DomUtil,
|
|
3
2
|
DomEvent,
|
|
4
|
-
|
|
3
|
+
DomUtil,
|
|
5
4
|
Util,
|
|
5
|
+
setOptions,
|
|
6
6
|
} from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
7
7
|
import { translate } from './i18n.js'
|
|
8
8
|
import { Request, ServerRequest } from './request.js'
|
|
9
|
+
import { escapeHTML, generateId } from './utils.js'
|
|
9
10
|
|
|
10
11
|
export class BaseAutocomplete {
|
|
11
12
|
constructor(el, options) {
|
|
@@ -16,6 +17,7 @@ export class BaseAutocomplete {
|
|
|
16
17
|
allowFree: true,
|
|
17
18
|
minChar: 2,
|
|
18
19
|
maxResults: 5,
|
|
20
|
+
throttling: 300,
|
|
19
21
|
}
|
|
20
22
|
this.cache = ''
|
|
21
23
|
this.results = []
|
|
@@ -45,6 +47,7 @@ export class BaseAutocomplete {
|
|
|
45
47
|
placeholder: this.options.placeholder,
|
|
46
48
|
autocomplete: 'off',
|
|
47
49
|
className: this.options.className,
|
|
50
|
+
name: this.options.name || 'autocomplete',
|
|
48
51
|
})
|
|
49
52
|
DomEvent.on(this.input, 'keydown', this.onKeyDown, this)
|
|
50
53
|
DomEvent.on(this.input, 'keyup', this.onKeyUp, this)
|
|
@@ -125,7 +128,10 @@ export class BaseAutocomplete {
|
|
|
125
128
|
'Control',
|
|
126
129
|
]
|
|
127
130
|
if (!special.includes(e.key)) {
|
|
128
|
-
this.
|
|
131
|
+
if (this._typing) window.clearTimeout(this._typing)
|
|
132
|
+
this._typing = window.setTimeout(() => {
|
|
133
|
+
this.search()
|
|
134
|
+
}, this.options.throttling)
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
137
|
|
|
@@ -250,7 +256,7 @@ export class BaseAjax extends BaseAutocomplete {
|
|
|
250
256
|
return
|
|
251
257
|
}
|
|
252
258
|
if (val === this.cache) return
|
|
253
|
-
|
|
259
|
+
this.cache = val
|
|
254
260
|
val = val.toLowerCase()
|
|
255
261
|
const url = Util.template(this.url, { q: encodeURIComponent(val) })
|
|
256
262
|
this.handleResults(await this._search(url))
|
|
@@ -258,7 +264,7 @@ export class BaseAjax extends BaseAutocomplete {
|
|
|
258
264
|
|
|
259
265
|
async _search(url) {
|
|
260
266
|
const response = await this.request.get(url)
|
|
261
|
-
if (response
|
|
267
|
+
if (response?.ok) {
|
|
262
268
|
return await response.json()
|
|
263
269
|
}
|
|
264
270
|
}
|
|
@@ -345,3 +351,19 @@ export const MultipleMixin = (Base) =>
|
|
|
345
351
|
export class AjaxAutocompleteMultiple extends MultipleMixin(BaseServerAjax) {}
|
|
346
352
|
|
|
347
353
|
export class AjaxAutocomplete extends SingleMixin(BaseServerAjax) {}
|
|
354
|
+
|
|
355
|
+
export class AutocompleteDatalist {
|
|
356
|
+
constructor(input) {
|
|
357
|
+
this.input = input
|
|
358
|
+
this.datalist = document.createElement('datalist')
|
|
359
|
+
this.datalist.id = generateId()
|
|
360
|
+
this.input.setAttribute('list', this.datalist.id)
|
|
361
|
+
this.input.parentElement.appendChild(this.datalist)
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
set suggestions(values) {
|
|
365
|
+
this.datalist.innerHTML = values
|
|
366
|
+
.map((value) => `<option>${escapeHTML(value)}</option>`)
|
|
367
|
+
.join('')
|
|
368
|
+
}
|
|
369
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomEvent, DomUtil, stamp } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
2
|
import { translate } from './i18n.js'
|
|
3
3
|
|
|
4
4
|
export default class Browser {
|
|
@@ -37,7 +37,7 @@ export default class Browser {
|
|
|
37
37
|
? U.Icon.prototype.formatUrl(feature._getIconUrl(), feature)
|
|
38
38
|
: null
|
|
39
39
|
title.textContent = feature.getDisplayName() || '—'
|
|
40
|
-
const bgcolor = feature.
|
|
40
|
+
const bgcolor = feature.getPreviewColor()
|
|
41
41
|
colorBox.style.backgroundColor = bgcolor
|
|
42
42
|
if (symbol && symbol !== U.SCHEMA.iconUrl.default) {
|
|
43
43
|
const icon = U.Icon.makeIconElement(symbol, colorBox)
|
|
@@ -63,8 +63,8 @@ export default class Browser {
|
|
|
63
63
|
addDataLayer(datalayer, parent) {
|
|
64
64
|
let className = `datalayer ${datalayer.getHidableClass()}`
|
|
65
65
|
if (this.mode !== 'layers') className += ' show-list'
|
|
66
|
-
const container = DomUtil.create('div', className, parent)
|
|
67
|
-
|
|
66
|
+
const container = DomUtil.create('div', className, parent)
|
|
67
|
+
const headline = DomUtil.create('h5', '', container)
|
|
68
68
|
container.id = this.datalayerId(datalayer)
|
|
69
69
|
const ul = DomUtil.create('ul', '', container)
|
|
70
70
|
this.updateDatalayer(datalayer)
|
|
@@ -90,9 +90,9 @@ export default class Browser {
|
|
|
90
90
|
container.innerHTML = ''
|
|
91
91
|
datalayer.eachFeature((feature) => this.addFeature(feature, container))
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
const total = datalayer.count()
|
|
94
|
+
const current = container.querySelectorAll('li').length
|
|
95
|
+
const count = total === current ? total : `${current}/${total}`
|
|
96
96
|
const counter = DomUtil.create('span', 'datalayer-counter', headline)
|
|
97
97
|
counter.textContent = `(${count})`
|
|
98
98
|
counter.title = translate(`Features in this layer: ${count}`)
|
|
@@ -107,6 +107,7 @@ export default class Browser {
|
|
|
107
107
|
this.map.eachBrowsableDataLayer((datalayer) => {
|
|
108
108
|
datalayer.resetLayer(true)
|
|
109
109
|
this.updateDatalayer(datalayer)
|
|
110
|
+
if (this.map.fullPanel?.isOpen()) datalayer.tableEdit()
|
|
110
111
|
})
|
|
111
112
|
this.toggleBadge()
|
|
112
113
|
}
|
|
@@ -149,7 +150,7 @@ export default class Browser {
|
|
|
149
150
|
DomEvent.disableClickPropagation(container)
|
|
150
151
|
|
|
151
152
|
DomUtil.createTitle(container, translate('Data browser'), 'icon-layers')
|
|
152
|
-
|
|
153
|
+
this.formContainer = DomUtil.createFieldset(container, L._('Filters'), {
|
|
153
154
|
on: this.mode === 'filters',
|
|
154
155
|
className: 'filters',
|
|
155
156
|
icon: 'icon-filters',
|
|
@@ -169,7 +170,7 @@ export default class Browser {
|
|
|
169
170
|
callback: () => this.onFormChange(),
|
|
170
171
|
})
|
|
171
172
|
let filtersBuilder
|
|
172
|
-
formContainer.appendChild(builder.build())
|
|
173
|
+
this.formContainer.appendChild(builder.build())
|
|
173
174
|
DomEvent.on(builder.form, 'reset', () => {
|
|
174
175
|
window.setTimeout(builder.syncAll.bind(builder))
|
|
175
176
|
})
|
|
@@ -181,12 +182,11 @@ export default class Browser {
|
|
|
181
182
|
DomEvent.on(filtersBuilder.form, 'reset', () => {
|
|
182
183
|
window.setTimeout(filtersBuilder.syncAll.bind(filtersBuilder))
|
|
183
184
|
})
|
|
184
|
-
formContainer.appendChild(filtersBuilder.build())
|
|
185
|
+
this.formContainer.appendChild(filtersBuilder.build())
|
|
185
186
|
}
|
|
186
|
-
const reset = DomUtil.createButton('flat', formContainer, '', () =>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
})
|
|
187
|
+
const reset = DomUtil.createButton('flat', this.formContainer, '', () =>
|
|
188
|
+
this.resetFilters()
|
|
189
|
+
)
|
|
190
190
|
DomUtil.createIcon(reset, 'icon-restore')
|
|
191
191
|
DomUtil.element({
|
|
192
192
|
tagName: 'span',
|
|
@@ -202,6 +202,12 @@ export default class Browser {
|
|
|
202
202
|
this.update()
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
resetFilters() {
|
|
206
|
+
for (const form of this.formContainer?.querySelectorAll('form') || []) {
|
|
207
|
+
form.reset()
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
205
211
|
static backButton(map) {
|
|
206
212
|
const button = DomUtil.createButtonIcon(
|
|
207
213
|
DomUtil.create('li', '', undefined),
|
|
@@ -18,7 +18,7 @@ export default class Caption {
|
|
|
18
18
|
|
|
19
19
|
open() {
|
|
20
20
|
const container = DomUtil.create('div', 'umap-caption')
|
|
21
|
-
const hgroup = DomUtil.element({tagName: 'hgroup', parent: container})
|
|
21
|
+
const hgroup = DomUtil.element({ tagName: 'hgroup', parent: container })
|
|
22
22
|
DomUtil.createTitle(hgroup, this.map.options.name, 'icon-caption icon-block')
|
|
23
23
|
this.map.permissions.addOwnerLink('h4', hgroup)
|
|
24
24
|
if (this.map.options.description) {
|
|
@@ -40,9 +40,9 @@ export default class Caption {
|
|
|
40
40
|
|
|
41
41
|
addDataLayer(datalayer, container) {
|
|
42
42
|
if (!datalayer.options.inCaption) return
|
|
43
|
-
const p = DomUtil.create('p', 'datalayer-legend', container)
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const p = DomUtil.create('p', 'datalayer-legend', container)
|
|
44
|
+
const legend = DomUtil.create('span', '', p)
|
|
45
|
+
const headline = DomUtil.create('strong', '', p)
|
|
46
46
|
datalayer.onceLoaded(() => {
|
|
47
47
|
datalayer.renderLegend(legend)
|
|
48
48
|
if (datalayer.options.description) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { default as DOMPurifyInitializer } from '../../vendors/dompurify/purify.es.js'
|
|
2
1
|
import { JSDOM } from 'jsdom'
|
|
2
|
+
import { default as DOMPurifyInitializer } from '../../vendors/dompurify/purify.es.js'
|
|
3
3
|
|
|
4
4
|
console.log(DOMPurifyInitializer)
|
|
5
5
|
|
|
6
6
|
export default function getPurify() {
|
|
7
7
|
if (typeof window === 'undefined') {
|
|
8
8
|
return DOMPurifyInitializer(new JSDOM('').window)
|
|
9
|
-
} else {
|
|
10
|
-
return DOMPurifyInitializer(window)
|
|
11
9
|
}
|
|
10
|
+
return DOMPurifyInitializer(window)
|
|
12
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomEvent, DomUtil, stamp } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
2
|
import { translate } from './i18n.js'
|
|
3
3
|
import * as Utils from './utils.js'
|
|
4
4
|
|
|
@@ -12,8 +12,8 @@ export default class Facets {
|
|
|
12
12
|
const properties = {}
|
|
13
13
|
let selected
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
const type = defined
|
|
15
|
+
for (const name of names) {
|
|
16
|
+
const type = defined.get(name).type
|
|
17
17
|
properties[name] = { type: type }
|
|
18
18
|
selected = this.selected[name] || {}
|
|
19
19
|
selected.type = type
|
|
@@ -22,23 +22,29 @@ export default class Facets {
|
|
|
22
22
|
selected.choices = selected.choices || []
|
|
23
23
|
}
|
|
24
24
|
this.selected[name] = selected
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
this.map.eachBrowsableDataLayer((datalayer) => {
|
|
28
28
|
datalayer.eachFeature((feature) => {
|
|
29
|
-
|
|
29
|
+
for (const name of names) {
|
|
30
30
|
let value = feature.properties[name]
|
|
31
|
-
const type = defined
|
|
31
|
+
const type = defined.get(name).type
|
|
32
32
|
const parser = this.getParser(type)
|
|
33
33
|
value = parser(value)
|
|
34
34
|
switch (type) {
|
|
35
35
|
case 'date':
|
|
36
36
|
case 'datetime':
|
|
37
37
|
case 'number':
|
|
38
|
-
if (!isNaN(value)) {
|
|
38
|
+
if (!Number.isNaN(value)) {
|
|
39
|
+
// Special cases where we want to be lousy when checking isNaN without
|
|
40
|
+
// coercing to a Number first because we handle multiple types.
|
|
41
|
+
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/
|
|
42
|
+
// Reference/Global_Objects/Number/isNaN
|
|
43
|
+
// biome-ignore lint/suspicious/noGlobalIsNan: see above.
|
|
39
44
|
if (isNaN(properties[name].min) || properties[name].min > value) {
|
|
40
45
|
properties[name].min = value
|
|
41
46
|
}
|
|
47
|
+
// biome-ignore lint/suspicious/noGlobalIsNan: see above.
|
|
42
48
|
if (isNaN(properties[name].max) || properties[name].max < value) {
|
|
43
49
|
properties[name].max = value
|
|
44
50
|
}
|
|
@@ -50,15 +56,15 @@ export default class Facets {
|
|
|
50
56
|
properties[name].choices.push(value)
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
|
-
}
|
|
59
|
+
}
|
|
54
60
|
})
|
|
55
61
|
})
|
|
56
62
|
return properties
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
isActive() {
|
|
60
|
-
for (
|
|
61
|
-
if (min !== undefined || max
|
|
66
|
+
for (const { type, min, max, choices } of Object.values(this.selected)) {
|
|
67
|
+
if (min !== undefined || max !== undefined || choices?.length) {
|
|
62
68
|
return true
|
|
63
69
|
}
|
|
64
70
|
}
|
|
@@ -67,13 +73,13 @@ export default class Facets {
|
|
|
67
73
|
|
|
68
74
|
build() {
|
|
69
75
|
const defined = this.getDefined()
|
|
70
|
-
const names =
|
|
76
|
+
const names = [...defined.keys()]
|
|
71
77
|
const facetProperties = this.compute(names, defined)
|
|
72
78
|
|
|
73
79
|
const fields = names.map((name) => {
|
|
74
|
-
|
|
80
|
+
const criteria = facetProperties[name]
|
|
75
81
|
let handler = 'FacetSearchChoices'
|
|
76
|
-
switch (criteria
|
|
82
|
+
switch (criteria.type) {
|
|
77
83
|
case 'number':
|
|
78
84
|
handler = 'FacetSearchNumber'
|
|
79
85
|
break
|
|
@@ -84,7 +90,7 @@ export default class Facets {
|
|
|
84
90
|
handler = 'FacetSearchDateTime'
|
|
85
91
|
break
|
|
86
92
|
}
|
|
87
|
-
|
|
93
|
+
const label = defined.get(name).label
|
|
88
94
|
return [
|
|
89
95
|
`selected.${name}`,
|
|
90
96
|
{
|
|
@@ -101,18 +107,20 @@ export default class Facets {
|
|
|
101
107
|
getDefined() {
|
|
102
108
|
const defaultType = 'checkbox'
|
|
103
109
|
const allowedTypes = [defaultType, 'radio', 'number', 'date', 'datetime']
|
|
110
|
+
const defined = new Map()
|
|
111
|
+
if (!this.map.options.facetKey) return defined
|
|
104
112
|
return (this.map.options.facetKey || '').split(',').reduce((acc, curr) => {
|
|
105
113
|
let [name, label, type] = curr.split('|')
|
|
106
114
|
type = allowedTypes.includes(type) ? type : defaultType
|
|
107
|
-
acc
|
|
115
|
+
acc.set(name, { label: label || name, type: type })
|
|
108
116
|
return acc
|
|
109
|
-
},
|
|
117
|
+
}, defined)
|
|
110
118
|
}
|
|
111
119
|
|
|
112
120
|
getParser(type) {
|
|
113
121
|
switch (type) {
|
|
114
122
|
case 'number':
|
|
115
|
-
return parseFloat
|
|
123
|
+
return Number.parseFloat
|
|
116
124
|
case 'datetime':
|
|
117
125
|
return (v) => new Date(v)
|
|
118
126
|
case 'date':
|
|
@@ -121,4 +129,32 @@ export default class Facets {
|
|
|
121
129
|
return (v) => String(v || '')
|
|
122
130
|
}
|
|
123
131
|
}
|
|
132
|
+
|
|
133
|
+
dumps(parsed) {
|
|
134
|
+
const dumped = []
|
|
135
|
+
for (const [property, { label, type }] of parsed) {
|
|
136
|
+
dumped.push([property, label, type].filter(Boolean).join('|'))
|
|
137
|
+
}
|
|
138
|
+
return dumped.join(',')
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
has(property) {
|
|
142
|
+
return this.getDefined().has(property)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
add(property, label, type) {
|
|
146
|
+
const defined = this.getDefined()
|
|
147
|
+
if (!defined.has(property)) {
|
|
148
|
+
defined.set(property, { label, type })
|
|
149
|
+
this.map.options.facetKey = this.dumps(defined)
|
|
150
|
+
this.map.isDirty = true
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
remove(property) {
|
|
155
|
+
const defined = this.getDefined()
|
|
156
|
+
defined.delete(property)
|
|
157
|
+
this.map.options.facetKey = this.dumps(defined)
|
|
158
|
+
this.map.isDirty = true
|
|
159
|
+
}
|
|
124
160
|
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* Uses globals for: csv2geojson, osmtogeojson, GeoRSSToGeoJSON (not available as ESM) */
|
|
2
|
+
import { translate } from './i18n.js'
|
|
3
|
+
|
|
4
|
+
export const EXPORT_FORMATS = {
|
|
5
|
+
geojson: {
|
|
6
|
+
formatter: async (map) => JSON.stringify(map.toGeoJSON(), null, 2),
|
|
7
|
+
ext: '.geojson',
|
|
8
|
+
filetype: 'application/json',
|
|
9
|
+
},
|
|
10
|
+
gpx: {
|
|
11
|
+
formatter: async (map) => await map.formatter.toGPX(map.toGeoJSON()),
|
|
12
|
+
ext: '.gpx',
|
|
13
|
+
filetype: 'application/gpx+xml',
|
|
14
|
+
},
|
|
15
|
+
kml: {
|
|
16
|
+
formatter: async (map) => await map.formatter.toKML(map.toGeoJSON()),
|
|
17
|
+
ext: '.kml',
|
|
18
|
+
filetype: 'application/vnd.google-earth.kml+xml',
|
|
19
|
+
},
|
|
20
|
+
csv: {
|
|
21
|
+
formatter: async (map) => {
|
|
22
|
+
const table = []
|
|
23
|
+
map.eachFeature((feature) => {
|
|
24
|
+
const row = feature.toGeoJSON().properties
|
|
25
|
+
const center = feature.getCenter()
|
|
26
|
+
delete row._umap_options
|
|
27
|
+
row.Latitude = center.lat
|
|
28
|
+
row.Longitude = center.lng
|
|
29
|
+
table.push(row)
|
|
30
|
+
})
|
|
31
|
+
return csv2geojson.dsv.csvFormat(table)
|
|
32
|
+
},
|
|
33
|
+
ext: '.csv',
|
|
34
|
+
filetype: 'text/csv',
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class Formatter {
|
|
39
|
+
async fromGPX(str) {
|
|
40
|
+
const togeojson = await import('../../vendors/togeojson/togeojson.es.js')
|
|
41
|
+
return togeojson.gpx(this.toDom(str))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async fromKML(str) {
|
|
45
|
+
const togeojson = await import('../../vendors/togeojson/togeojson.es.js')
|
|
46
|
+
return togeojson.kml(this.toDom(str), {
|
|
47
|
+
skipNullGeometry: true,
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async fromGeoJSON(str) {
|
|
52
|
+
try {
|
|
53
|
+
return JSON.parse(str)
|
|
54
|
+
} catch (err) {
|
|
55
|
+
U.Alert.error(`Invalid JSON file: ${err}`)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async fromOSM(str) {
|
|
60
|
+
let src
|
|
61
|
+
try {
|
|
62
|
+
src = JSON.parse(str)
|
|
63
|
+
} catch (e) {
|
|
64
|
+
src = this.toDom(str)
|
|
65
|
+
}
|
|
66
|
+
return osmtogeojson(src, { flatProperties: true })
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
fromCSV(str, callback) {
|
|
70
|
+
csv2geojson.csv2geojson(
|
|
71
|
+
str,
|
|
72
|
+
{
|
|
73
|
+
delimiter: 'auto',
|
|
74
|
+
includeLatLon: false,
|
|
75
|
+
},
|
|
76
|
+
(err, result) => {
|
|
77
|
+
// csv2geojson fallback to null geometries when it cannot determine
|
|
78
|
+
// lat or lon columns. This is valid geojson, but unwanted from a user
|
|
79
|
+
// point of view.
|
|
80
|
+
if (result?.features.length) {
|
|
81
|
+
if (result.features[0].geometry === null) {
|
|
82
|
+
err = {
|
|
83
|
+
type: 'Error',
|
|
84
|
+
message: translate('Cannot determine latitude and longitude columns.'),
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (err) {
|
|
89
|
+
let message
|
|
90
|
+
if (err.type === 'Error') {
|
|
91
|
+
message = err.message
|
|
92
|
+
} else {
|
|
93
|
+
message = translate('{count} errors during import: {message}', {
|
|
94
|
+
count: err.length,
|
|
95
|
+
message: err[0].message,
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
U.Alert.error(message, 10000)
|
|
99
|
+
console.error(err)
|
|
100
|
+
}
|
|
101
|
+
if (result?.features.length) {
|
|
102
|
+
callback(result)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async fromGeoRSS(str) {
|
|
109
|
+
return GeoRSSToGeoJSON(this.toDom(c))
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
toDom(x) {
|
|
113
|
+
const doc = new DOMParser().parseFromString(x, 'text/xml')
|
|
114
|
+
const errorNode = doc.querySelector('parsererror')
|
|
115
|
+
if (errorNode) {
|
|
116
|
+
U.Alert.error(translate('Cannot parse data'))
|
|
117
|
+
}
|
|
118
|
+
return doc
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async parse(str, format) {
|
|
122
|
+
switch (format) {
|
|
123
|
+
case 'csv':
|
|
124
|
+
return new Promise((resolve, reject) => {
|
|
125
|
+
return this.fromCSV(str, (data) => resolve(data))
|
|
126
|
+
})
|
|
127
|
+
case 'gpx':
|
|
128
|
+
return await this.fromGPX(str)
|
|
129
|
+
case 'kml':
|
|
130
|
+
return await this.fromKML(str)
|
|
131
|
+
case 'osm':
|
|
132
|
+
return await this.fromOSM(str)
|
|
133
|
+
case 'georss':
|
|
134
|
+
return await this.fromGeoRSS(str)
|
|
135
|
+
case 'geojson':
|
|
136
|
+
return await this.fromGeoJSON(str)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async toGPX(geojson) {
|
|
141
|
+
const togpx = await import('../../vendors/geojson-to-gpx/index.js')
|
|
142
|
+
for (const feature of geojson.features) {
|
|
143
|
+
feature.properties.desc = feature.properties.description
|
|
144
|
+
}
|
|
145
|
+
const gpx = togpx.default(geojson)
|
|
146
|
+
return new XMLSerializer().serializeToString(gpx)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async toKML(geojson) {
|
|
150
|
+
const tokml = await import('../../vendors/tokml/tokml.es.js')
|
|
151
|
+
return tokml.toKML(geojson)
|
|
152
|
+
}
|
|
153
|
+
}
|