udata 7.0.6.dev28209__py2.py3-none-any.whl → 7.0.6.dev28233__py2.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 udata might be problematic. Click here for more details.

Files changed (27) hide show
  1. udata/core/dataset/rdf.py +65 -25
  2. udata/harvest/tests/dcat/evian.json +464 -0
  3. udata/harvest/tests/test_dcat_backend.py +15 -0
  4. udata/static/chunks/{11.a23c110811a9ac943478.js → 11.c0ccea08914b6b41568e.js} +3 -3
  5. udata/static/chunks/{11.a23c110811a9ac943478.js.map → 11.c0ccea08914b6b41568e.js.map} +1 -1
  6. udata/static/chunks/{13.0889e093f8664e38568c.js → 13.526a25163ababaa44409.js} +2 -2
  7. udata/static/chunks/{13.0889e093f8664e38568c.js.map → 13.526a25163ababaa44409.js.map} +1 -1
  8. udata/static/chunks/{16.f41599478d3e97ad9a30.js → 16.7901839b4227881947f6.js} +2 -2
  9. udata/static/chunks/{16.f41599478d3e97ad9a30.js.map → 16.7901839b4227881947f6.js.map} +1 -1
  10. udata/static/chunks/{19.2b534a26af8b17e9170b.js → 19.471d5a2a08eef6e5338a.js} +3 -3
  11. udata/static/chunks/{19.2b534a26af8b17e9170b.js.map → 19.471d5a2a08eef6e5338a.js.map} +1 -1
  12. udata/static/chunks/{5.7115454a1183e5c12eef.js → 5.534e0531d0e2b150146f.js} +3 -3
  13. udata/static/chunks/{5.7115454a1183e5c12eef.js.map → 5.534e0531d0e2b150146f.js.map} +1 -1
  14. udata/static/chunks/{6.16bb24fb8240f2746488.js → 6.e56975229e6065f68d2a.js} +3 -3
  15. udata/static/chunks/{6.16bb24fb8240f2746488.js.map → 6.e56975229e6065f68d2a.js.map} +1 -1
  16. udata/static/chunks/{9.3e752966ff14e47e11f2.js → 9.534426728626f11f4571.js} +2 -2
  17. udata/static/chunks/{9.3e752966ff14e47e11f2.js.map → 9.534426728626f11f4571.js.map} +1 -1
  18. udata/static/common.js +1 -1
  19. udata/static/common.js.map +1 -1
  20. udata/tests/api/test_datasets_api.py +2 -1
  21. udata/tests/dataset/test_dataset_model.py +2 -1
  22. {udata-7.0.6.dev28209.dist-info → udata-7.0.6.dev28233.dist-info}/METADATA +3 -2
  23. {udata-7.0.6.dev28209.dist-info → udata-7.0.6.dev28233.dist-info}/RECORD +27 -26
  24. {udata-7.0.6.dev28209.dist-info → udata-7.0.6.dev28233.dist-info}/LICENSE +0 -0
  25. {udata-7.0.6.dev28209.dist-info → udata-7.0.6.dev28233.dist-info}/WHEEL +0 -0
  26. {udata-7.0.6.dev28209.dist-info → udata-7.0.6.dev28233.dist-info}/entry_points.txt +0 -0
  27. {udata-7.0.6.dev28209.dist-info → udata-7.0.6.dev28233.dist-info}/top_level.txt +0 -0
udata/core/dataset/rdf.py CHANGED
@@ -7,6 +7,7 @@ import logging
7
7
 
8
8
  from datetime import date
9
9
  from html.parser import HTMLParser
10
+ from typing import Optional
10
11
  from dateutil.parser import parse as parse_dt
11
12
  from flask import current_app
12
13
  from geomet import wkt
@@ -339,36 +340,51 @@ def contact_point_from_rdf(rdf, dataset):
339
340
 
340
341
 
341
342
  def spatial_from_rdf(graph):
343
+ geojsons = []
342
344
  for term in graph.objects(DCT.spatial):
343
- for object in term.objects():
344
- if isinstance(object, Literal):
345
- if object.datatype.__str__() == 'https://www.iana.org/assignments/media-types/application/vnd.geo+json':
346
- try:
347
- geojson = json.loads(object.toPython())
348
- except ValueError as e:
349
- log.warning(f"Invalid JSON in spatial GeoJSON {object.toPython()} {e}")
350
- continue
351
- elif object.datatype.__str__() == 'http://www.opengis.net/rdf#wktLiteral':
352
- try:
353
- # .upper() si here because geomet doesn't support Polygon but only POLYGON
354
- geojson = wkt.loads(object.toPython().strip().upper())
355
- except ValueError as e:
356
- log.warning(f"Invalid JSON in spatial WKT {object.toPython()} {e}")
345
+ try:
346
+ # This may not be official in the norm but some ArcGis return
347
+ # bbox as literal directly in DCT.spatial.
348
+ if isinstance(term, Literal):
349
+ geojson = bbox_to_geojson_multipolygon(term.toPython())
350
+ if geojson is not None:
351
+ geojsons.append(geojson)
352
+
353
+ continue
354
+
355
+ for object in term.objects():
356
+ if isinstance(object, Literal):
357
+ if object.datatype.__str__() == 'https://www.iana.org/assignments/media-types/application/vnd.geo+json':
358
+ try:
359
+ geojson = json.loads(object.toPython())
360
+ except ValueError as e:
361
+ log.warning(f"Invalid JSON in spatial GeoJSON {object.toPython()} {e}")
362
+ continue
363
+ elif object.datatype.__str__() == 'http://www.opengis.net/rdf#wktLiteral':
364
+ try:
365
+ # .upper() si here because geomet doesn't support Polygon but only POLYGON
366
+ geojson = wkt.loads(object.toPython().strip().upper())
367
+ except ValueError as e:
368
+ log.warning(f"Invalid JSON in spatial WKT {object.toPython()} {e}")
369
+ continue
370
+ else:
357
371
  continue
358
- else:
359
- continue
360
372
 
361
- if geojson['type'] == 'Polygon':
362
- geojson['type'] = 'MultiPolygon'
363
- geojson['coordinates'] = [geojson['coordinates']]
373
+ if geojson['type'] == 'Polygon':
374
+ geojson['type'] = 'MultiPolygon'
375
+ geojson['coordinates'] = [geojson['coordinates']]
364
376
 
365
- spatial_coverage = SpatialCoverage(geom=geojson)
377
+ geojsons.append(geojson)
378
+ except Exception as e:
379
+ log.exception(f"Exception during `spatial_from_rdf` for term {term}: {e}", stack_info=True)
366
380
 
367
- try:
368
- spatial_coverage.clean()
369
- return spatial_coverage
370
- except ValidationError:
371
- continue
381
+ for geojson in geojsons:
382
+ spatial_coverage = SpatialCoverage(geom=geojson)
383
+ try:
384
+ spatial_coverage.clean()
385
+ return spatial_coverage
386
+ except ValidationError:
387
+ continue
372
388
 
373
389
  return None
374
390
 
@@ -609,3 +625,27 @@ def dataset_from_rdf(graph: Graph, dataset=None, node=None):
609
625
  dataset.harvest.modified_at = modified_at
610
626
 
611
627
  return dataset
628
+
629
+ def bbox_to_geojson_multipolygon(bbox_as_str: str) -> Optional[dict] :
630
+ bbox = bbox_as_str.strip().split(',')
631
+ if len(bbox) != 4:
632
+ return None
633
+
634
+ west = float(bbox[0])
635
+ south = float(bbox[1])
636
+ east = float(bbox[2])
637
+ north = float(bbox[3])
638
+
639
+ low_left = [west, south]
640
+ top_left = [west, north]
641
+ top_right = [east, north]
642
+ low_right = [east, south]
643
+
644
+ return {
645
+ 'type': 'MultiPolygon',
646
+ 'coordinates': [
647
+ [
648
+ [low_left, low_right, top_right, top_left, low_left],
649
+ ],
650
+ ],
651
+ }
@@ -0,0 +1,464 @@
1
+ {
2
+ "@context": "https://project-open-data.cio.gov/v1.1/schema/catalog.jsonld",
3
+ "@type": "dcat:Catalog",
4
+ "conformsTo": "https://project-open-data.cio.gov/v1.1/schema",
5
+ "describedBy": "https://project-open-data.cio.gov/v1.1/schema/catalog.json",
6
+ "dataset": [
7
+ {
8
+ "@type": "dcat:Dataset",
9
+ "identifier": "https://www.arcgis.com/home/item.html?id=f6565516d1354383b25793e630cf3f2b&sublayer=5",
10
+ "landingPage": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/f6565516d1354383b25793e630cf3f2b_5",
11
+ "title": "stationnement velos",
12
+ "description": "<DIV STYLE=\"text-align:Left;\"><DIV><DIV><P><SPAN>Emplacement et description des stationnement vélos à Evian-les-Bains</SPAN></P></DIV></DIV></DIV>",
13
+ "keyword": [
14
+ "mobilite"
15
+ ],
16
+ "issued": "2022-07-29T10:07:13.000Z",
17
+ "modified": "2022-07-29T11:29:07.556Z",
18
+ "publisher": {
19
+ "name": "Ville d'Evian-les-Bains"
20
+ },
21
+ "contactPoint": {
22
+ "@type": "vcard:Contact",
23
+ "fn": "sigevian"
24
+ },
25
+ "accessLevel": "public",
26
+ "spatial": "6.5735,46.3912,6.6069,46.4028",
27
+ "license": "<DIV STYLE=\"text-align:Left;\"><DIV><DIV><P><SPAN>Soumis à la licence Etalab : https://www.etalab.gouv.fr/licence-ouverte-open-licence/</SPAN></P></DIV></DIV></DIV>",
28
+ "distribution": [
29
+ {
30
+ "@type": "dcat:Distribution",
31
+ "title": "ArcGIS Hub Dataset",
32
+ "format": "Web Page",
33
+ "mediaType": "text/html",
34
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/f6565516d1354383b25793e630cf3f2b_5"
35
+ },
36
+ {
37
+ "@type": "dcat:Distribution",
38
+ "title": "ArcGIS GeoService",
39
+ "format": "ArcGIS GeoServices REST API",
40
+ "mediaType": "application/json",
41
+ "accessURL": "https://services.arcgis.com/Hbks8qlTugfLqQka/arcgis/rest/services/stationnement_velo/FeatureServer/5"
42
+ },
43
+ {
44
+ "@type": "dcat:Distribution",
45
+ "title": "CSV",
46
+ "format": "CSV",
47
+ "mediaType": "text/csv",
48
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/f6565516d1354383b25793e630cf3f2b/csv?layers=5"
49
+ },
50
+ {
51
+ "@type": "dcat:Distribution",
52
+ "title": "GeoJSON",
53
+ "format": "GeoJSON",
54
+ "mediaType": "application/vnd.geo+json",
55
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/f6565516d1354383b25793e630cf3f2b/geojson?layers=5"
56
+ },
57
+ {
58
+ "@type": "dcat:Distribution",
59
+ "title": "Shapefile",
60
+ "format": "ZIP",
61
+ "mediaType": "application/zip",
62
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/f6565516d1354383b25793e630cf3f2b/shapefile?layers=5"
63
+ },
64
+ {
65
+ "@type": "dcat:Distribution",
66
+ "title": "KML",
67
+ "format": "KML",
68
+ "mediaType": "application/vnd.google-earth.kml+xml",
69
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/f6565516d1354383b25793e630cf3f2b/kml?layers=5"
70
+ }
71
+ ],
72
+ "theme": [
73
+ "geospatial"
74
+ ]
75
+ },
76
+ {
77
+ "@type": "dcat:Dataset",
78
+ "identifier": "https://www.arcgis.com/home/item.html?id=cb6aa94ccb21492396e799d1ad282c02&sublayer=8",
79
+ "landingPage": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/cb6aa94ccb21492396e799d1ad282c02_8",
80
+ "title": "poubelles",
81
+ "description": "<DIV STYLE=\"text-align:Left;\"><DIV><DIV><P><SPAN>Emplacement et description des poubelles à Evian-les-Bains</SPAN></P></DIV></DIV></DIV>",
82
+ "keyword": [
83
+ "environnement"
84
+ ],
85
+ "issued": "2022-07-29T09:08:13.000Z",
86
+ "modified": "2022-07-29T11:33:36.369Z",
87
+ "publisher": {
88
+ "name": "Ville d'Evian-les-Bains"
89
+ },
90
+ "contactPoint": {
91
+ "@type": "vcard:Contact",
92
+ "fn": "sigevian"
93
+ },
94
+ "accessLevel": "public",
95
+ "spatial": "6.5658,46.3835,6.6141,46.4047",
96
+ "license": "<DIV STYLE=\"text-align:Left;\"><DIV><DIV><P><SPAN>Soumis à la licence Etalab : https://www.etalab.gouv.fr/licence-ouverte-open-licence/</SPAN></P></DIV></DIV></DIV>",
97
+ "distribution": [
98
+ {
99
+ "@type": "dcat:Distribution",
100
+ "title": "ArcGIS Hub Dataset",
101
+ "format": "Web Page",
102
+ "mediaType": "text/html",
103
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/cb6aa94ccb21492396e799d1ad282c02_8"
104
+ },
105
+ {
106
+ "@type": "dcat:Distribution",
107
+ "title": "ArcGIS GeoService",
108
+ "format": "ArcGIS GeoServices REST API",
109
+ "mediaType": "application/json",
110
+ "accessURL": "https://services.arcgis.com/Hbks8qlTugfLqQka/arcgis/rest/services/poubelles/FeatureServer/8"
111
+ },
112
+ {
113
+ "@type": "dcat:Distribution",
114
+ "title": "CSV",
115
+ "format": "CSV",
116
+ "mediaType": "text/csv",
117
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/cb6aa94ccb21492396e799d1ad282c02/csv?layers=8"
118
+ },
119
+ {
120
+ "@type": "dcat:Distribution",
121
+ "title": "GeoJSON",
122
+ "format": "GeoJSON",
123
+ "mediaType": "application/vnd.geo+json",
124
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/cb6aa94ccb21492396e799d1ad282c02/geojson?layers=8"
125
+ },
126
+ {
127
+ "@type": "dcat:Distribution",
128
+ "title": "Shapefile",
129
+ "format": "ZIP",
130
+ "mediaType": "application/zip",
131
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/cb6aa94ccb21492396e799d1ad282c02/shapefile?layers=8"
132
+ },
133
+ {
134
+ "@type": "dcat:Distribution",
135
+ "title": "KML",
136
+ "format": "KML",
137
+ "mediaType": "application/vnd.google-earth.kml+xml",
138
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/cb6aa94ccb21492396e799d1ad282c02/kml?layers=8"
139
+ }
140
+ ],
141
+ "theme": [
142
+ "geospatial"
143
+ ]
144
+ },
145
+ {
146
+ "@type": "dcat:Dataset",
147
+ "identifier": "https://www.arcgis.com/home/item.html?id=b7c181ff568344daae2a77bafbcc7225&sublayer=0",
148
+ "landingPage": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/b7c181ff568344daae2a77bafbcc7225_0",
149
+ "title": "defibrillateurs",
150
+ "description": "<DIV STYLE=\"text-align:Left;\"><DIV><DIV><P><SPAN>défibrillateur</SPAN></P></DIV></DIV></DIV>",
151
+ "keyword": [
152
+ "sante"
153
+ ],
154
+ "issued": "2022-07-29T10:07:44.000Z",
155
+ "modified": "2023-03-13T14:34:36.923Z",
156
+ "publisher": {
157
+ "name": "Mairie Evian-les-Bains"
158
+ },
159
+ "contactPoint": {
160
+ "@type": "vcard:Contact",
161
+ "fn": "sigevian"
162
+ },
163
+ "accessLevel": "public",
164
+ "spatial": "6.5664,46.3889,6.6088,46.4039",
165
+ "license": "<DIV STYLE=\"text-align:Left;\"><DIV><DIV><P><SPAN>Soumis à la licence Etalab</SPAN></P></DIV></DIV></DIV>",
166
+ "distribution": [
167
+ {
168
+ "@type": "dcat:Distribution",
169
+ "title": "ArcGIS Hub Dataset",
170
+ "format": "Web Page",
171
+ "mediaType": "text/html",
172
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/b7c181ff568344daae2a77bafbcc7225_0"
173
+ },
174
+ {
175
+ "@type": "dcat:Distribution",
176
+ "title": "ArcGIS GeoService",
177
+ "format": "ArcGIS GeoServices REST API",
178
+ "mediaType": "application/json",
179
+ "accessURL": "https://services.arcgis.com/Hbks8qlTugfLqQka/arcgis/rest/services/defibrillateurs/FeatureServer/0"
180
+ },
181
+ {
182
+ "@type": "dcat:Distribution",
183
+ "title": "CSV",
184
+ "format": "CSV",
185
+ "mediaType": "text/csv",
186
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/b7c181ff568344daae2a77bafbcc7225/csv?layers=0"
187
+ },
188
+ {
189
+ "@type": "dcat:Distribution",
190
+ "title": "GeoJSON",
191
+ "format": "GeoJSON",
192
+ "mediaType": "application/vnd.geo+json",
193
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/b7c181ff568344daae2a77bafbcc7225/geojson?layers=0"
194
+ },
195
+ {
196
+ "@type": "dcat:Distribution",
197
+ "title": "Shapefile",
198
+ "format": "ZIP",
199
+ "mediaType": "application/zip",
200
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/b7c181ff568344daae2a77bafbcc7225/shapefile?layers=0"
201
+ },
202
+ {
203
+ "@type": "dcat:Distribution",
204
+ "title": "KML",
205
+ "format": "KML",
206
+ "mediaType": "application/vnd.google-earth.kml+xml",
207
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/b7c181ff568344daae2a77bafbcc7225/kml?layers=0"
208
+ }
209
+ ],
210
+ "theme": [
211
+ "geospatial"
212
+ ]
213
+ },
214
+ {
215
+ "@type": "dcat:Dataset",
216
+ "identifier": "https://www.arcgis.com/home/item.html?id=dcc09451ea4f4c1398584374120137a0&sublayer=6",
217
+ "landingPage": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/dcc09451ea4f4c1398584374120137a0_6",
218
+ "title": "places de marche",
219
+ "description": "<DIV STYLE=\"text-align:Left;\"><DIV><DIV><P><SPAN>Zone et description des emplacements du marché à Evian-les-Bains</SPAN></P></DIV></DIV></DIV>",
220
+ "keyword": [
221
+ "environnement"
222
+ ],
223
+ "issued": "2022-07-29T10:06:57.000Z",
224
+ "modified": "2024-02-09T14:33:50.766Z",
225
+ "publisher": {
226
+ "name": "Ville d'Evian-les-Bains"
227
+ },
228
+ "contactPoint": {
229
+ "@type": "vcard:Contact",
230
+ "fn": "sigevian"
231
+ },
232
+ "accessLevel": "public",
233
+ "spatial": "6.5873,46.4006,6.5889,46.4020",
234
+ "license": "",
235
+ "distribution": [
236
+ {
237
+ "@type": "dcat:Distribution",
238
+ "title": "ArcGIS Hub Dataset",
239
+ "format": "Web Page",
240
+ "mediaType": "text/html",
241
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/dcc09451ea4f4c1398584374120137a0_6"
242
+ },
243
+ {
244
+ "@type": "dcat:Distribution",
245
+ "title": "ArcGIS GeoService",
246
+ "format": "ArcGIS GeoServices REST API",
247
+ "mediaType": "application/json",
248
+ "accessURL": "https://services.arcgis.com/Hbks8qlTugfLqQka/arcgis/rest/services/place_de_marche/FeatureServer/6"
249
+ },
250
+ {
251
+ "@type": "dcat:Distribution",
252
+ "title": "CSV",
253
+ "format": "CSV",
254
+ "mediaType": "text/csv",
255
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/dcc09451ea4f4c1398584374120137a0/csv?layers=6"
256
+ },
257
+ {
258
+ "@type": "dcat:Distribution",
259
+ "title": "GeoJSON",
260
+ "format": "GeoJSON",
261
+ "mediaType": "application/vnd.geo+json",
262
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/dcc09451ea4f4c1398584374120137a0/geojson?layers=6"
263
+ },
264
+ {
265
+ "@type": "dcat:Distribution",
266
+ "title": "Shapefile",
267
+ "format": "ZIP",
268
+ "mediaType": "application/zip",
269
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/dcc09451ea4f4c1398584374120137a0/shapefile?layers=6"
270
+ },
271
+ {
272
+ "@type": "dcat:Distribution",
273
+ "title": "KML",
274
+ "format": "KML",
275
+ "mediaType": "application/vnd.google-earth.kml+xml",
276
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/dcc09451ea4f4c1398584374120137a0/kml?layers=6"
277
+ }
278
+ ],
279
+ "theme": [
280
+ "geospatial"
281
+ ]
282
+ },
283
+ {
284
+ "@type": "dcat:Dataset",
285
+ "identifier": "https://www.arcgis.com/home/item.html?id=94a712dd0d1747c1b899a58f927a2566&sublayer=4",
286
+ "landingPage": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/94a712dd0d1747c1b899a58f927a2566_4",
287
+ "title": "places PMR",
288
+ "description": "<DIV STYLE=\"text-align:Left;\"><DIV><DIV><P><SPAN>Emplacement et description des places PMR</SPAN></P></DIV></DIV></DIV>",
289
+ "keyword": [
290
+ "mobilite"
291
+ ],
292
+ "issued": "2022-07-29T09:09:31.000Z",
293
+ "modified": "2022-08-23T11:34:50.466Z",
294
+ "publisher": {
295
+ "name": "Ville Evian-les-Bains"
296
+ },
297
+ "contactPoint": {
298
+ "@type": "vcard:Contact",
299
+ "fn": "sigevian"
300
+ },
301
+ "accessLevel": "public",
302
+ "spatial": "6.5662,46.3885,6.6130,46.4045",
303
+ "license": "",
304
+ "distribution": [
305
+ {
306
+ "@type": "dcat:Distribution",
307
+ "title": "ArcGIS Hub Dataset",
308
+ "format": "Web Page",
309
+ "mediaType": "text/html",
310
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/maps/94a712dd0d1747c1b899a58f927a2566_4"
311
+ },
312
+ {
313
+ "@type": "dcat:Distribution",
314
+ "title": "ArcGIS GeoService",
315
+ "format": "ArcGIS GeoServices REST API",
316
+ "mediaType": "application/json",
317
+ "accessURL": "https://services.arcgis.com/Hbks8qlTugfLqQka/arcgis/rest/services/places_PMR/FeatureServer/4"
318
+ },
319
+ {
320
+ "@type": "dcat:Distribution",
321
+ "title": "CSV",
322
+ "format": "CSV",
323
+ "mediaType": "text/csv",
324
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/94a712dd0d1747c1b899a58f927a2566/csv?layers=4"
325
+ },
326
+ {
327
+ "@type": "dcat:Distribution",
328
+ "title": "GeoJSON",
329
+ "format": "GeoJSON",
330
+ "mediaType": "application/vnd.geo+json",
331
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/94a712dd0d1747c1b899a58f927a2566/geojson?layers=4"
332
+ },
333
+ {
334
+ "@type": "dcat:Distribution",
335
+ "title": "Shapefile",
336
+ "format": "ZIP",
337
+ "mediaType": "application/zip",
338
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/94a712dd0d1747c1b899a58f927a2566/shapefile?layers=4"
339
+ },
340
+ {
341
+ "@type": "dcat:Distribution",
342
+ "title": "KML",
343
+ "format": "KML",
344
+ "mediaType": "application/vnd.google-earth.kml+xml",
345
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/api/download/v1/items/94a712dd0d1747c1b899a58f927a2566/kml?layers=4"
346
+ }
347
+ ],
348
+ "theme": [
349
+ "geospatial"
350
+ ]
351
+ },
352
+ {
353
+ "@type": "dcat:Dataset",
354
+ "identifier": "https://www.arcgis.com/home/item.html?id=92a676a42a864c4baf58856e445b6d41",
355
+ "landingPage": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/documents/92a676a42a864c4baf58856e445b6d41_1231",
356
+ "title": "Publication actes dématérialisés",
357
+ "description": "",
358
+ "keyword": [
359
+ "OpenData"
360
+ ],
361
+ "issued": "2023-10-30T08:48:06.000Z",
362
+ "modified": "2023-10-30T08:56:01.000Z",
363
+ "publisher": {
364
+ "name": "sigevian"
365
+ },
366
+ "contactPoint": {
367
+ "@type": "vcard:Contact",
368
+ "fn": "sigevian"
369
+ },
370
+ "accessLevel": "public",
371
+ "spatial": "{{extent:computeSpatialProperty}}",
372
+ "license": "",
373
+ "distribution": [
374
+ {
375
+ "@type": "dcat:Distribution",
376
+ "title": "ArcGIS Hub Dataset",
377
+ "format": "Web Page",
378
+ "mediaType": "text/html",
379
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/documents/92a676a42a864c4baf58856e445b6d41_1231"
380
+ },
381
+ {
382
+ "@type": "dcat:Distribution",
383
+ "title": "ArcGIS GeoService",
384
+ "format": "ArcGIS GeoServices REST API",
385
+ "mediaType": "application/json",
386
+ "accessURL": "https://publiact.fr/company/1231"
387
+ }
388
+ ],
389
+ "theme": [
390
+ "geospatial"
391
+ ]
392
+ },
393
+ {
394
+ "@type": "dcat:Dataset",
395
+ "identifier": "https://www.arcgis.com/home/item.html?id=856b7eb926a14f4cb34d95597bafb610",
396
+ "landingPage": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/documents/856b7eb926a14f4cb34d95597bafb610",
397
+ "title": "Carte piéton concertation",
398
+ "description": "",
399
+ "keyword": [
400
+ "evian",
401
+ "mobilite"
402
+ ],
403
+ "issued": "2022-07-25T14:30:43.000Z",
404
+ "modified": "2022-08-01T09:26:34.000Z",
405
+ "publisher": {
406
+ "name": "sigevian"
407
+ },
408
+ "contactPoint": {
409
+ "@type": "vcard:Contact",
410
+ "fn": "sigevian"
411
+ },
412
+ "accessLevel": "public",
413
+ "spatial": "{{extent:computeSpatialProperty}}",
414
+ "license": "",
415
+ "distribution": [
416
+ {
417
+ "@type": "dcat:Distribution",
418
+ "title": "ArcGIS Hub Dataset",
419
+ "format": "Web Page",
420
+ "mediaType": "text/html",
421
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/documents/856b7eb926a14f4cb34d95597bafb610"
422
+ }
423
+ ],
424
+ "theme": [
425
+ "geospatial"
426
+ ]
427
+ },
428
+ {
429
+ "@type": "dcat:Dataset",
430
+ "identifier": "https://www.arcgis.com/home/item.html?id=8acd3deee8d042538e21925d0640f199",
431
+ "landingPage": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/documents/8acd3deee8d042538e21925d0640f199",
432
+ "title": "Carte vélo finale",
433
+ "description": "",
434
+ "keyword": [
435
+ "evian",
436
+ "mobilite"
437
+ ],
438
+ "issued": "2022-07-25T14:30:41.000Z",
439
+ "modified": "2022-07-28T13:29:26.000Z",
440
+ "publisher": {
441
+ "name": "sigevian"
442
+ },
443
+ "contactPoint": {
444
+ "@type": "vcard:Contact",
445
+ "fn": "sigevian"
446
+ },
447
+ "accessLevel": "public",
448
+ "spatial": "{{extent:computeSpatialProperty}}",
449
+ "license": "",
450
+ "distribution": [
451
+ {
452
+ "@type": "dcat:Distribution",
453
+ "title": "ArcGIS Hub Dataset",
454
+ "format": "Web Page",
455
+ "mediaType": "text/html",
456
+ "accessURL": "https://ville-d-evian-opendata-ville-evian.hub.arcgis.com/documents/8acd3deee8d042538e21925d0640f199"
457
+ }
458
+ ],
459
+ "theme": [
460
+ "geospatial"
461
+ ]
462
+ }
463
+ ]
464
+ }
@@ -160,6 +160,21 @@ class DcatBackendTest:
160
160
  assert len(datasets['1'].resources) == 2
161
161
  assert len(datasets['2'].resources) == 2
162
162
 
163
+ def test_harvest_literal_spatial(self, rmock):
164
+ url = mock_dcat(rmock, 'evian.json')
165
+ org = OrganizationFactory()
166
+ source = HarvestSourceFactory(backend='dcat',
167
+ url=url,
168
+ organization=org)
169
+
170
+ actions.run(source.slug)
171
+
172
+ datasets = {d.harvest.dct_identifier: d for d in Dataset.objects}
173
+ assert len(datasets) == 8
174
+ assert datasets['https://www.arcgis.com/home/item.html?id=f6565516d1354383b25793e630cf3f2b&sublayer=5'].spatial is not None
175
+ assert datasets['https://www.arcgis.com/home/item.html?id=f6565516d1354383b25793e630cf3f2b&sublayer=5'].spatial.geom == {'type': 'MultiPolygon', 'coordinates': [[[[6.5735, 46.3912], [6.6069, 46.3912], [6.6069, 46.4028], [6.5735, 46.4028], [6.5735, 46.3912]]]]}
176
+
177
+
163
178
  @pytest.mark.skip(reason="Mocking S3 requires `moto` which is not available for our current Python 3.7. We can manually test it.")
164
179
  @pytest.mark.options(SCHEMA_CATALOG_URL='https://example.com/schemas', HARVEST_JOBS_RETENTION_DAYS=0)
165
180
  # @mock_s3