umap-project 2.7.1__py3-none-any.whl → 2.7.2__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.

Potentially problematic release.


This version of umap-project might be problematic. Click here for more details.

umap/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION = "2.7.1"
1
+ VERSION = "2.7.2"
@@ -81,6 +81,8 @@ export class Formatter {
81
81
  {
82
82
  delimiter: 'auto',
83
83
  includeLatLon: false,
84
+ sexagesimal: false,
85
+ parseLatLon: (raw) => Number.parseFloat(raw.toString().replace(',', '.')),
84
86
  },
85
87
  (err, result) => {
86
88
  // csv2geojson fallback to null geometries when it cannot determine
@@ -115,7 +117,9 @@ export class Formatter {
115
117
  }
116
118
 
117
119
  async fromGeoRSS(str) {
118
- const GeoRSSToGeoJSON = await import('../../vendors/georsstogeojson/GeoRSSToGeoJSON.js')
120
+ const GeoRSSToGeoJSON = await import(
121
+ '../../vendors/georsstogeojson/GeoRSSToGeoJSON.js'
122
+ )
119
123
  return GeoRSSToGeoJSON.parse(this.toDom(str))
120
124
  }
121
125
 
@@ -81,6 +81,8 @@ function csv2geojson(x, options, callback) {
81
81
  }
82
82
 
83
83
  options.delimiter = options.delimiter || ',';
84
+ options.parseLatLon = options.parseLatLon || parseFloat;
85
+ options.sexagesimal = options.sexagesimal !== false;
84
86
 
85
87
  var latfield = options.latfield || '',
86
88
  lonfield = options.lonfield || '',
@@ -129,6 +131,7 @@ function csv2geojson(x, options, callback) {
129
131
 
130
132
  if (!latfield) latfield = guessLatHeader(parsed[0]);
131
133
  if (!lonfield) lonfield = guessLonHeader(parsed[0]);
134
+
132
135
  var noGeometry = (!latfield || !lonfield);
133
136
 
134
137
  if (noGeometry) {
@@ -152,13 +155,15 @@ function csv2geojson(x, options, callback) {
152
155
  lonf, latf,
153
156
  a;
154
157
 
155
- a = sexagesimal(lonk, 'EW');
156
- if (a) lonk = a;
157
- a = sexagesimal(latk, 'NS');
158
- if (a) latk = a;
158
+ if (options.sexagesimal) {
159
+ a = sexagesimal(lonk, 'EW');
160
+ if (a) lonk = a;
161
+ a = sexagesimal(latk, 'NS');
162
+ if (a) latk = a;
163
+ }
159
164
 
160
- lonf = parseFloat(lonk);
161
- latf = parseFloat(latk);
165
+ lonf = options.parseLatLon(lonk);
166
+ latf = options.parseLatLon(latk);
162
167
 
163
168
  if (isNaN(lonf) ||
164
169
  isNaN(latf)) {
@@ -179,8 +184,8 @@ function csv2geojson(x, options, callback) {
179
184
  geometry: {
180
185
  type: 'Point',
181
186
  coordinates: [
182
- parseFloat(lonf),
183
- parseFloat(latf)
187
+ lonf,
188
+ latf
184
189
  ]
185
190
  }
186
191
  });
@@ -494,6 +494,39 @@ def test_import_csv_without_valid_latlon_headers(tilelayer, live_server, page):
494
494
  expect(page.locator('umap-alert div[data-level="error"]')).to_be_visible()
495
495
 
496
496
 
497
+ def test_import_csv_with_commas_in_latlon(tilelayer, live_server, page, settings):
498
+ settings.UMAP_ALLOW_ANONYMOUS = True
499
+ page.goto(f"{live_server.url}/map/new/")
500
+ page.get_by_title("Open browser").click()
501
+ layers = page.locator(".umap-browser .datalayer")
502
+ markers = page.locator(".leaflet-marker-icon")
503
+ page.get_by_title("Import data").click()
504
+ textarea = page.locator(".umap-upload textarea")
505
+ textarea.fill("lat;lon;foobar\n12,24;48,34;mypoint\n12,23;48,35;mypoint2")
506
+ page.locator('select[name="format"]').select_option("csv")
507
+ page.get_by_role("button", name="Import data", exact=True).click()
508
+ expect(layers).to_have_count(1)
509
+ expect(markers).to_have_count(2)
510
+ with page.expect_response(re.compile(r".*/datalayer/create/.*")):
511
+ page.get_by_role("button", name="Save").click()
512
+ datalayer = DataLayer.objects.last()
513
+ saved_data = json.loads(Path(datalayer.geojson.path).read_text())
514
+ assert saved_data["features"][0]["geometry"] == {
515
+ "coordinates": [
516
+ 48.35,
517
+ 12.23,
518
+ ],
519
+ "type": "Point",
520
+ }
521
+ assert saved_data["features"][1]["geometry"] == {
522
+ "coordinates": [
523
+ 48.34,
524
+ 12.24,
525
+ ],
526
+ "type": "Point",
527
+ }
528
+
529
+
497
530
  def test_create_remote_data(page, live_server, tilelayer):
498
531
  def handle(route):
499
532
  route.fulfill(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: umap-project
3
- Version: 2.7.1
3
+ Version: 2.7.2
4
4
  Summary: Create maps with OpenStreetMap layers in a minute and embed them in your site.
5
5
  Author-email: Yohan Boniface <yb@enix.org>
6
6
  Maintainer-email: David Larlet <david@larlet.fr>
@@ -1,4 +1,4 @@
1
- umap/__init__.py,sha256=9Q043H_lTm3CNUBFKtTHx5hfV_u0qzcsBuYqRMN36U4,18
1
+ umap/__init__.py,sha256=NUyqnQWTVjbgd-Uh6a7vcIXyYuuaRt2kNMLp7-l4x_k,18
2
2
  umap/admin.py,sha256=LoQytPGK6pLBqZ5QgQ9DIPAxhTG31cTtHOCqO9BY5S4,2645
3
3
  umap/apps.py,sha256=5ssKqPUuNJlapaBmr4LY_HDb7J1NFCT3wzythxQOOfs,109
4
4
  umap/asgi.py,sha256=CuVSNBwNb4AvuaD_Ha3ehtvf-c46ijZoVOSoP6WhXp8,432
@@ -227,7 +227,7 @@ umap/static/umap/js/modules/browser.js,sha256=FXM-Dau0gxqFj77k9FUPBuf6gvrcN6ezsf
227
227
  umap/static/umap/js/modules/caption.js,sha256=WVesRXhlIlr5SAiKDv7nOquihvq1pv-dDHsG6i3nQeU,4041
228
228
  umap/static/umap/js/modules/dompurify.js,sha256=SOmoM-pTgYCKCKXFo6-znemWPLiLsFgR4lxM_moWaA8,328
229
229
  umap/static/umap/js/modules/facets.js,sha256=K4qfnCtgIK7oMkL4YvAvPovHfaCK_aRyW5rl7nAFqK0,4677
230
- umap/static/umap/js/modules/formatter.js,sha256=rdOA_HQ89euI1ttLm2CXCUdphMc5-oU-69qeV3hk1Rk,4473
230
+ umap/static/umap/js/modules/formatter.js,sha256=AgRVx9mX_ZYmz7H0AgtJBBp6cPbMhv7KMqia0-uEcIY,4596
231
231
  umap/static/umap/js/modules/global.js,sha256=8s61zn5EKFfZi7j8Ek1-QOpb1D3uRsTEtb3Uv47IQVU,2005
232
232
  umap/static/umap/js/modules/help.js,sha256=k0gUpRf8ik9_okGH7Jv4JOjveNbbvSdk1yV_oZ3kSkQ,9870
233
233
  umap/static/umap/js/modules/i18n.js,sha256=dEpjsWoEZa-Tr5_MDO0tuWkt7kLL3crxXqhttyP-khU,1387
@@ -381,7 +381,7 @@ umap/static/umap/unittests/hlc.js,sha256=GvpBaBSgfMs0Zym0_zOs2QldUOcbFNVIKweBhuw
381
381
  umap/static/umap/unittests/sync.js,sha256=JSyT4ZwuRF1mMUzLLJzjIs_6iZz8S2iF1imJGLpSdwQ,12751
382
382
  umap/static/umap/unittests/utils.js,sha256=oVckWaCK26yR8nX9NlVEL_eVKf0i8Z-UNnK5K9xY9t0,25609
383
383
  umap/static/umap/vendors/colorbrewer/colorbrewer.js,sha256=wEHf7UslhI09j7tfzC1V9FLgTbZELDbbtGiL2x0y9vY,23051
384
- umap/static/umap/vendors/csv2geojson/csv2geojson.js,sha256=Cb88gwY7oibx7WL1Y3bfxc_Cur6yo62nLGaEmzP7Fbw,15530
384
+ umap/static/umap/vendors/csv2geojson/csv2geojson.js,sha256=FARwXdqk_yf3ttJmSyrJ204B9glI2YaZ2vuhaQPmhVk,15712
385
385
  umap/static/umap/vendors/dompurify/purify.es.js,sha256=z-0CPcG0TCk11WMdauq46gDt65U61y_i-ltN5dKc500,64057
386
386
  umap/static/umap/vendors/dompurify/purify.es.mjs.map,sha256=wzzJMafObQYxw2FUcIM4AJShakCHU1hiEm1MotxK79g,123512
387
387
  umap/static/umap/vendors/editable/Leaflet.Editable.js,sha256=5-RlyT7RhocenG85yKIhSPdCvUrpxH2o-lvWS9St5uA,69568
@@ -536,7 +536,7 @@ umap/tests/integration/test_edit_polygon.py,sha256=JeIW6NcBltIl958uJ_T-0dRCT5gOo
536
536
  umap/tests/integration/test_export_map.py,sha256=jH0BXm-7Ov26OEkve9-xKMfRwXwR73zRrZLIQusyUOY,12112
537
537
  umap/tests/integration/test_facets_browser.py,sha256=J--y2rpI__0RIPzcTx4Kn2UwuurFdh-6i_Y4c6GxUyY,10658
538
538
  umap/tests/integration/test_features_id_generation.py,sha256=e99_8AxeMAi53JjVGlsI32zlrXGAU19FHJfTuYdiBVQ,1511
539
- umap/tests/integration/test_import.py,sha256=k_lrh8HhMLGtpuzYxREyCi_fAQTZboeq6Wd34_MkgV4,28995
539
+ umap/tests/integration/test_import.py,sha256=AAZ3WZPgxbRQ1QhAF55RsxbmftNjT2e-ldmSyIol8zA,30256
540
540
  umap/tests/integration/test_map.py,sha256=2ZO54RFVycJKGczfioX0nU1oCu29FVC9hR6wbT4s1NE,8736
541
541
  umap/tests/integration/test_map_list.py,sha256=l1FImKnJkY7DupYX8waKaUZqhnORR20L8dzaqu-eF8E,1280
542
542
  umap/tests/integration/test_map_preview.py,sha256=kP0vkEiUN7EJNCvZgNeUAzrrXfgwpU0S2UnmOBV4P5A,3540
@@ -554,8 +554,8 @@ umap/tests/integration/test_view_marker.py,sha256=f_WqtVe0ZfDX_SOeNXFh54ubvhJWeu
554
554
  umap/tests/integration/test_view_polygon.py,sha256=NMJC6Nt9VpQ8FIU9Pqq2OspHv49xsWlsoXCr8iBa0VA,2060
555
555
  umap/tests/integration/test_view_polyline.py,sha256=n1QVIdl-Xg9yN9o-Jc6VnPhFAuUspsgY0odiUe_jJC4,1598
556
556
  umap/tests/integration/test_websocket_sync.py,sha256=pcEoXgEFvLBdmQA_rGa5BcHE2eBe3P0qZ6X3j4goRzQ,12764
557
- umap_project-2.7.1.dist-info/METADATA,sha256=F5SItQUyySWPv1tWPgUcYWX6msZwnFSLyeYhfBqDBbY,2888
558
- umap_project-2.7.1.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
559
- umap_project-2.7.1.dist-info/entry_points.txt,sha256=gz-KDQfEsMLBae8ABOD3foJsCYGPW1tA4Y394R_1RW8,39
560
- umap_project-2.7.1.dist-info/licenses/LICENSE,sha256=kQtrtRKgiPhcl7aO0-lmvbrNAXu7WHyiXvPrUk-TD2Q,820
561
- umap_project-2.7.1.dist-info/RECORD,,
557
+ umap_project-2.7.2.dist-info/METADATA,sha256=VejupE32RcK6HSyW6zXkuXtmqDPIMo9V-oXQ8nQkpts,2888
558
+ umap_project-2.7.2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
559
+ umap_project-2.7.2.dist-info/entry_points.txt,sha256=gz-KDQfEsMLBae8ABOD3foJsCYGPW1tA4Y394R_1RW8,39
560
+ umap_project-2.7.2.dist-info/licenses/LICENSE,sha256=kQtrtRKgiPhcl7aO0-lmvbrNAXu7WHyiXvPrUk-TD2Q,820
561
+ umap_project-2.7.2.dist-info/RECORD,,