umap-project 1.14.0a5__py3-none-any.whl → 2.0.0a0__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.

Files changed (224) hide show
  1. umap/__init__.py +1 -1
  2. umap/decorators.py +0 -14
  3. umap/locale/br/LC_MESSAGES/django.mo +0 -0
  4. umap/locale/br/LC_MESSAGES/django.po +137 -85
  5. umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/cs_CZ/LC_MESSAGES/django.po +136 -84
  7. umap/locale/el/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/el/LC_MESSAGES/django.po +136 -84
  9. umap/locale/en/LC_MESSAGES/django.po +128 -88
  10. umap/locale/es/LC_MESSAGES/django.mo +0 -0
  11. umap/locale/es/LC_MESSAGES/django.po +136 -84
  12. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  13. umap/locale/fr/LC_MESSAGES/django.po +131 -91
  14. umap/locale/hu/LC_MESSAGES/django.mo +0 -0
  15. umap/locale/hu/LC_MESSAGES/django.po +137 -85
  16. umap/locale/it/LC_MESSAGES/django.mo +0 -0
  17. umap/locale/it/LC_MESSAGES/django.po +136 -84
  18. umap/locale/ms/LC_MESSAGES/django.mo +0 -0
  19. umap/locale/ms/LC_MESSAGES/django.po +136 -84
  20. umap/locale/pl/LC_MESSAGES/django.mo +0 -0
  21. umap/locale/pl/LC_MESSAGES/django.po +136 -84
  22. umap/locale/sv/LC_MESSAGES/django.mo +0 -0
  23. umap/locale/sv/LC_MESSAGES/django.po +135 -83
  24. umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
  25. umap/locale/zh_TW/LC_MESSAGES/django.po +143 -91
  26. umap/models.py +23 -1
  27. umap/settings/__init__.py +1 -4
  28. umap/settings/base.py +1 -0
  29. umap/static/umap/base.css +5 -0
  30. umap/static/umap/content.css +185 -13
  31. umap/static/umap/favicons/icon.svg +2 -2
  32. umap/static/umap/img/edit.svg +3 -3
  33. umap/static/umap/img/icon-delete.svg +4 -0
  34. umap/static/umap/img/icon-download.svg +13 -0
  35. umap/static/umap/img/icon-duplicate.svg +5 -0
  36. umap/static/umap/img/icon-edit.svg +12 -0
  37. umap/static/umap/img/icon-share.svg +11 -0
  38. umap/static/umap/img/icon-view.svg +12 -0
  39. umap/static/umap/img/logo.svg +2 -2
  40. umap/static/umap/img/logo_small.svg +2 -2
  41. umap/static/umap/img/marker.svg +4 -0
  42. umap/static/umap/img/opensource.svg +2 -2
  43. umap/static/umap/img/osm.svg +2 -2
  44. umap/static/umap/js/components/fragment.js +1 -1
  45. umap/static/umap/js/modules/browser.js +159 -0
  46. umap/static/umap/js/modules/global.js +3 -1
  47. umap/static/umap/js/modules/request.js +155 -0
  48. umap/static/umap/js/umap.autocomplete.js +28 -38
  49. umap/static/umap/js/umap.controls.js +73 -58
  50. umap/static/umap/js/umap.core.js +4 -9
  51. umap/static/umap/js/umap.datalayer.permissions.js +13 -12
  52. umap/static/umap/js/umap.features.js +51 -49
  53. umap/static/umap/js/umap.forms.js +19 -19
  54. umap/static/umap/js/umap.icon.js +17 -17
  55. umap/static/umap/js/umap.importer.js +2 -1
  56. umap/static/umap/js/umap.js +242 -291
  57. umap/static/umap/js/umap.layer.js +173 -141
  58. umap/static/umap/js/umap.permissions.js +24 -25
  59. umap/static/umap/js/umap.popup.js +14 -14
  60. umap/static/umap/js/umap.share.js +4 -4
  61. umap/static/umap/js/umap.slideshow.js +4 -4
  62. umap/static/umap/js/umap.tableeditor.js +2 -2
  63. umap/static/umap/js/umap.ui.js +1 -1
  64. umap/static/umap/locale/am_ET.js +1 -11
  65. umap/static/umap/locale/am_ET.json +1 -11
  66. umap/static/umap/locale/ar.js +1 -11
  67. umap/static/umap/locale/ar.json +1 -11
  68. umap/static/umap/locale/ast.js +1 -11
  69. umap/static/umap/locale/ast.json +1 -11
  70. umap/static/umap/locale/bg.js +1 -11
  71. umap/static/umap/locale/bg.json +1 -11
  72. umap/static/umap/locale/br.js +1 -11
  73. umap/static/umap/locale/br.json +1 -11
  74. umap/static/umap/locale/ca.js +1 -11
  75. umap/static/umap/locale/ca.json +1 -11
  76. umap/static/umap/locale/cs_CZ.js +1 -11
  77. umap/static/umap/locale/cs_CZ.json +1 -11
  78. umap/static/umap/locale/da.js +1 -11
  79. umap/static/umap/locale/da.json +1 -11
  80. umap/static/umap/locale/de.js +1 -11
  81. umap/static/umap/locale/de.json +1 -11
  82. umap/static/umap/locale/el.js +1 -11
  83. umap/static/umap/locale/el.json +1 -11
  84. umap/static/umap/locale/en.js +1 -11
  85. umap/static/umap/locale/en.json +1 -11
  86. umap/static/umap/locale/en_US.json +1 -11
  87. umap/static/umap/locale/es.js +1 -11
  88. umap/static/umap/locale/es.json +1 -11
  89. umap/static/umap/locale/et.js +1 -11
  90. umap/static/umap/locale/et.json +1 -11
  91. umap/static/umap/locale/fa_IR.js +6 -16
  92. umap/static/umap/locale/fa_IR.json +6 -16
  93. umap/static/umap/locale/fi.js +1 -11
  94. umap/static/umap/locale/fi.json +1 -11
  95. umap/static/umap/locale/fr.js +1 -11
  96. umap/static/umap/locale/fr.json +1 -11
  97. umap/static/umap/locale/gl.js +1 -11
  98. umap/static/umap/locale/gl.json +1 -11
  99. umap/static/umap/locale/he.js +1 -11
  100. umap/static/umap/locale/he.json +1 -11
  101. umap/static/umap/locale/hr.js +1 -11
  102. umap/static/umap/locale/hr.json +1 -11
  103. umap/static/umap/locale/hu.js +1 -11
  104. umap/static/umap/locale/hu.json +1 -11
  105. umap/static/umap/locale/id.js +1 -11
  106. umap/static/umap/locale/id.json +1 -11
  107. umap/static/umap/locale/is.js +1 -11
  108. umap/static/umap/locale/is.json +1 -11
  109. umap/static/umap/locale/it.js +1 -11
  110. umap/static/umap/locale/it.json +1 -11
  111. umap/static/umap/locale/ja.js +1 -11
  112. umap/static/umap/locale/ja.json +1 -11
  113. umap/static/umap/locale/ko.js +1 -11
  114. umap/static/umap/locale/ko.json +1 -11
  115. umap/static/umap/locale/lt.js +1 -11
  116. umap/static/umap/locale/lt.json +1 -11
  117. umap/static/umap/locale/ms.js +1 -11
  118. umap/static/umap/locale/ms.json +1 -11
  119. umap/static/umap/locale/nl.js +1 -11
  120. umap/static/umap/locale/nl.json +1 -11
  121. umap/static/umap/locale/no.js +1 -11
  122. umap/static/umap/locale/no.json +1 -11
  123. umap/static/umap/locale/pl.js +1 -11
  124. umap/static/umap/locale/pl.json +1 -11
  125. umap/static/umap/locale/pl_PL.json +1 -11
  126. umap/static/umap/locale/pt.js +1 -11
  127. umap/static/umap/locale/pt.json +1 -11
  128. umap/static/umap/locale/pt_BR.js +1 -11
  129. umap/static/umap/locale/pt_BR.json +1 -11
  130. umap/static/umap/locale/pt_PT.js +1 -11
  131. umap/static/umap/locale/pt_PT.json +1 -11
  132. umap/static/umap/locale/ro.js +1 -11
  133. umap/static/umap/locale/ro.json +1 -11
  134. umap/static/umap/locale/ru.js +1 -11
  135. umap/static/umap/locale/ru.json +1 -11
  136. umap/static/umap/locale/sk_SK.js +1 -11
  137. umap/static/umap/locale/sk_SK.json +1 -11
  138. umap/static/umap/locale/sl.js +1 -11
  139. umap/static/umap/locale/sl.json +1 -11
  140. umap/static/umap/locale/sr.js +1 -11
  141. umap/static/umap/locale/sr.json +1 -11
  142. umap/static/umap/locale/sv.js +1 -11
  143. umap/static/umap/locale/sv.json +1 -11
  144. umap/static/umap/locale/th_TH.js +1 -11
  145. umap/static/umap/locale/th_TH.json +1 -11
  146. umap/static/umap/locale/tr.js +1 -11
  147. umap/static/umap/locale/tr.json +1 -11
  148. umap/static/umap/locale/uk_UA.js +1 -11
  149. umap/static/umap/locale/uk_UA.json +1 -11
  150. umap/static/umap/locale/vi.js +1 -11
  151. umap/static/umap/locale/vi.json +1 -11
  152. umap/static/umap/locale/vi_VN.json +1 -11
  153. umap/static/umap/locale/zh.js +1 -11
  154. umap/static/umap/locale/zh.json +1 -11
  155. umap/static/umap/locale/zh_CN.json +1 -11
  156. umap/static/umap/locale/zh_TW.Big5.json +1 -11
  157. umap/static/umap/locale/zh_TW.js +17 -27
  158. umap/static/umap/locale/zh_TW.json +17 -27
  159. umap/static/umap/map.css +2 -2
  160. umap/static/umap/nav.css +2 -1
  161. umap/static/umap/test/.eslintrc +0 -1
  162. umap/static/umap/test/Choropleth.js +29 -27
  163. umap/static/umap/test/DataLayer.js +207 -239
  164. umap/static/umap/test/Feature.js +33 -58
  165. umap/static/umap/test/Map.Export.js +11 -11
  166. umap/static/umap/test/Map.js +66 -67
  167. umap/static/umap/test/Marker.js +36 -32
  168. umap/static/umap/test/Polygon.js +95 -95
  169. umap/static/umap/test/Polyline.js +31 -31
  170. umap/static/umap/test/TableEditor.js +29 -25
  171. umap/static/umap/test/_pre.js +2 -7
  172. umap/static/umap/test/index.html +4 -4
  173. umap/static/umap/vendors/contextmenu/leaflet.contextmenu.css +54 -0
  174. umap/static/umap/vendors/contextmenu/leaflet.contextmenu.js +586 -0
  175. umap/static/umap/vendors/csv2geojson/index.js +259 -0
  176. umap/static/umap/vendors/dompurify/purify.js +1633 -0
  177. umap/static/umap/vendors/locatecontrol/L.Control.Locate.css +63 -0
  178. umap/static/umap/vendors/locatecontrol/L.Control.Locate.js +950 -0
  179. umap/static/umap/vendors/minimap/Control.MiniMap.css +88 -0
  180. umap/static/umap/vendors/minimap/Control.MiniMap.js +352 -0
  181. umap/static/umap/vendors/togeojson/togeojson.js +2 -0
  182. umap/templates/auth/user_form.html +3 -2
  183. umap/templates/base.html +1 -0
  184. umap/templates/registration/login.html +51 -36
  185. umap/templates/umap/about_summary.html +1 -1
  186. umap/templates/umap/branding.html +3 -0
  187. umap/templates/umap/content.html +15 -39
  188. umap/templates/umap/header.html +0 -0
  189. umap/templates/umap/home.html +4 -2
  190. umap/templates/umap/js.html +0 -1
  191. umap/templates/umap/map_detail.html +9 -0
  192. umap/templates/umap/map_init.html +1 -1
  193. umap/templates/umap/map_messages.html +4 -2
  194. umap/templates/umap/map_table.html +130 -69
  195. umap/templates/umap/navigation.html +2 -4
  196. umap/templates/umap/user_dashboard.html +29 -6
  197. umap/tests/base.py +1 -1
  198. umap/tests/integration/conftest.py +18 -0
  199. umap/tests/integration/test_anonymous_owned_map.py +6 -3
  200. umap/tests/integration/test_browser.py +166 -6
  201. umap/tests/integration/test_collaborative_editing.py +23 -5
  202. umap/tests/integration/test_dashboard.py +17 -0
  203. umap/tests/integration/test_edit_datalayer.py +4 -3
  204. umap/tests/integration/test_export_map.py +1 -1
  205. umap/tests/integration/test_import.py +9 -4
  206. umap/tests/integration/test_map.py +64 -0
  207. umap/tests/integration/test_map_preview.py +75 -0
  208. umap/tests/integration/test_owned_map.py +11 -25
  209. umap/tests/integration/test_picto.py +3 -3
  210. umap/tests/integration/test_querystring.py +52 -0
  211. umap/tests/integration/test_share.py +22 -0
  212. umap/tests/test_map_views.py +157 -14
  213. umap/tests/test_views.py +50 -11
  214. umap/urls.py +6 -12
  215. umap/views.py +170 -47
  216. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/METADATA +13 -15
  217. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/RECORD +220 -199
  218. umap/static/umap/js/umap.browser.js +0 -148
  219. umap/static/umap/js/umap.xhr.js +0 -304
  220. umap/static/umap/test/Controls.js +0 -100
  221. umap/static/umap/test/Map.Init.js +0 -46
  222. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/WHEEL +0 -0
  223. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/entry_points.txt +0 -0
  224. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,259 @@
1
+ 'use strict';
2
+
3
+ var dsv = require('d3-dsv'),
4
+ sexagesimal = require('@mapbox/sexagesimal');
5
+
6
+ var latRegex = /(Lat)(itude)?/gi,
7
+ lonRegex = /(L)(on|ng)(gitude)?/i;
8
+
9
+ function guessHeader(row, regexp) {
10
+ var name, match, score;
11
+ for (var f in row) {
12
+ match = f.match(regexp);
13
+ if (match && (!name || match[0].length / f.length > score)) {
14
+ score = match[0].length / f.length;
15
+ name = f;
16
+ }
17
+ }
18
+ return name;
19
+ }
20
+
21
+ function guessLatHeader(row) { return guessHeader(row, latRegex); }
22
+ function guessLonHeader(row) { return guessHeader(row, lonRegex); }
23
+
24
+ function isLat(f) { return !!f.match(latRegex); }
25
+ function isLon(f) { return !!f.match(lonRegex); }
26
+
27
+ function keyCount(o) {
28
+ return (typeof o == 'object') ? Object.keys(o).length : 0;
29
+ }
30
+
31
+ function autoDelimiter(x) {
32
+ var delimiters = [',', ';', '\t', '|'];
33
+ var results = [];
34
+
35
+ delimiters.forEach(function (delimiter) {
36
+ var res = dsv.dsvFormat(delimiter).parse(x);
37
+ if (res.length >= 1) {
38
+ var count = keyCount(res[0]);
39
+ for (var i = 0; i < res.length; i++) {
40
+ if (keyCount(res[i]) !== count) return;
41
+ }
42
+ results.push({
43
+ delimiter: delimiter,
44
+ arity: Object.keys(res[0]).length,
45
+ });
46
+ }
47
+ });
48
+
49
+ if (results.length) {
50
+ return results.sort(function (a, b) {
51
+ return b.arity - a.arity;
52
+ })[0].delimiter;
53
+ } else {
54
+ return null;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Silly stopgap for dsv to d3-dsv upgrade
60
+ *
61
+ * @param {Array} x dsv output
62
+ * @returns {Array} array without columns member
63
+ */
64
+ function deleteColumns(x) {
65
+ delete x.columns;
66
+ return x;
67
+ }
68
+
69
+ function auto(x) {
70
+ var delimiter = autoDelimiter(x);
71
+ if (!delimiter) return null;
72
+ return deleteColumns(dsv.dsvFormat(delimiter).parse(x));
73
+ }
74
+
75
+ function csv2geojson(x, options, callback) {
76
+
77
+ if (!callback) {
78
+ callback = options;
79
+ options = {};
80
+ }
81
+
82
+ options.delimiter = options.delimiter || ',';
83
+
84
+ var latfield = options.latfield || '',
85
+ lonfield = options.lonfield || '',
86
+ crs = options.crs || '';
87
+
88
+ var features = [],
89
+ featurecollection = {type: 'FeatureCollection', features: features};
90
+
91
+ if (crs !== '') {
92
+ featurecollection.crs = {type: 'name', properties: {name: crs}};
93
+ }
94
+
95
+ if (options.delimiter === 'auto' && typeof x == 'string') {
96
+ options.delimiter = autoDelimiter(x);
97
+ if (!options.delimiter) {
98
+ callback({
99
+ type: 'Error',
100
+ message: 'Could not autodetect delimiter'
101
+ });
102
+ return;
103
+ }
104
+ }
105
+
106
+ var numericFields = options.numericFields ? options.numericFields.split(',') : null;
107
+
108
+ var parsed = (typeof x == 'string') ?
109
+ dsv.dsvFormat(options.delimiter).parse(x, function (d) {
110
+ if (numericFields) {
111
+ for (var key in d) {
112
+ if (numericFields.includes(key)) {
113
+ d[key] = +d[key];
114
+ }
115
+ }
116
+ }
117
+ return d;
118
+ }) : x;
119
+
120
+ if (!parsed.length) {
121
+ callback(null, featurecollection);
122
+ return;
123
+ }
124
+
125
+ var errors = [];
126
+ var i;
127
+
128
+
129
+ if (!latfield) latfield = guessLatHeader(parsed[0]);
130
+ if (!lonfield) lonfield = guessLonHeader(parsed[0]);
131
+ var noGeometry = (!latfield || !lonfield);
132
+
133
+ if (noGeometry) {
134
+ for (i = 0; i < parsed.length; i++) {
135
+ features.push({
136
+ type: 'Feature',
137
+ properties: parsed[i],
138
+ geometry: null
139
+ });
140
+ }
141
+ callback(errors.length ? errors : null, featurecollection);
142
+ return;
143
+ }
144
+
145
+ for (i = 0; i < parsed.length; i++) {
146
+ if (parsed[i][lonfield] !== undefined &&
147
+ parsed[i][latfield] !== undefined) {
148
+
149
+ var lonk = parsed[i][lonfield],
150
+ latk = parsed[i][latfield],
151
+ lonf, latf,
152
+ a;
153
+
154
+ a = sexagesimal(lonk, 'EW');
155
+ if (a) lonk = a;
156
+ a = sexagesimal(latk, 'NS');
157
+ if (a) latk = a;
158
+
159
+ lonf = parseFloat(lonk);
160
+ latf = parseFloat(latk);
161
+
162
+ if (isNaN(lonf) ||
163
+ isNaN(latf)) {
164
+ errors.push({
165
+ message: 'A row contained an invalid value for latitude or longitude',
166
+ row: parsed[i],
167
+ index: i
168
+ });
169
+ } else {
170
+ if (!options.includeLatLon) {
171
+ delete parsed[i][lonfield];
172
+ delete parsed[i][latfield];
173
+ }
174
+
175
+ features.push({
176
+ type: 'Feature',
177
+ properties: parsed[i],
178
+ geometry: {
179
+ type: 'Point',
180
+ coordinates: [
181
+ parseFloat(lonf),
182
+ parseFloat(latf)
183
+ ]
184
+ }
185
+ });
186
+ }
187
+ }
188
+ }
189
+
190
+ callback(errors.length ? errors : null, featurecollection);
191
+ }
192
+
193
+ function toLine(gj) {
194
+ var features = gj.features;
195
+ var line = {
196
+ type: 'Feature',
197
+ geometry: {
198
+ type: 'LineString',
199
+ coordinates: []
200
+ }
201
+ };
202
+ for (var i = 0; i < features.length; i++) {
203
+ line.geometry.coordinates.push(features[i].geometry.coordinates);
204
+ }
205
+ line.properties = features.reduce(function (aggregatedProperties, newFeature) {
206
+ for (var key in newFeature.properties) {
207
+ if (!aggregatedProperties[key]) {
208
+ aggregatedProperties[key] = [];
209
+ }
210
+ aggregatedProperties[key].push(newFeature.properties[key]);
211
+ }
212
+ return aggregatedProperties;
213
+ }, {});
214
+ return {
215
+ type: 'FeatureCollection',
216
+ features: [line]
217
+ };
218
+ }
219
+
220
+ function toPolygon(gj) {
221
+ var features = gj.features;
222
+ var poly = {
223
+ type: 'Feature',
224
+ geometry: {
225
+ type: 'Polygon',
226
+ coordinates: [[]]
227
+ }
228
+ };
229
+ for (var i = 0; i < features.length; i++) {
230
+ poly.geometry.coordinates[0].push(features[i].geometry.coordinates);
231
+ }
232
+ poly.properties = features.reduce(function (aggregatedProperties, newFeature) {
233
+ for (var key in newFeature.properties) {
234
+ if (!aggregatedProperties[key]) {
235
+ aggregatedProperties[key] = [];
236
+ }
237
+ aggregatedProperties[key].push(newFeature.properties[key]);
238
+ }
239
+ return aggregatedProperties;
240
+ }, {});
241
+ return {
242
+ type: 'FeatureCollection',
243
+ features: [poly]
244
+ };
245
+ }
246
+
247
+ module.exports = {
248
+ isLon: isLon,
249
+ isLat: isLat,
250
+ guessLatHeader: guessLatHeader,
251
+ guessLonHeader: guessLonHeader,
252
+ csv: dsv.csvParse,
253
+ tsv: dsv.tsvParse,
254
+ dsv: dsv,
255
+ auto: auto,
256
+ csv2geojson: csv2geojson,
257
+ toLine: toLine,
258
+ toPolygon: toPolygon
259
+ };