mirror of
https://github.com/umap-project/umap.git
synced 2025-05-15 18:21:53 +02:00
Compare commits
No commits in common. "1b058ce86233eeb5e8cc924cd32f54656e8bd923" and "05e3f5ce3d00034d74794c4c1080186ee1d45321" have entirely different histories.
1b058ce862
...
05e3f5ce3d
4 changed files with 1 additions and 155 deletions
|
@ -1634,16 +1634,7 @@ export default class Umap extends ServerStored {
|
||||||
|
|
||||||
importRaw(rawData) {
|
importRaw(rawData) {
|
||||||
const importedData = JSON.parse(rawData)
|
const importedData = JSON.parse(rawData)
|
||||||
let remoteOrigin = ''
|
|
||||||
if (importedData.uri) {
|
|
||||||
const uri = new URL(importedData.uri)
|
|
||||||
if (uri.origin !== window.location.origin) {
|
|
||||||
remoteOrigin = uri.origin
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (importedData.properties?.iconUrl?.startsWith('/')) {
|
|
||||||
importedData.properties.iconUrl = remoteOrigin + importedData.properties.iconUrl
|
|
||||||
}
|
|
||||||
this.setProperties(importedData.properties)
|
this.setProperties(importedData.properties)
|
||||||
|
|
||||||
if (importedData.geometry) {
|
if (importedData.geometry) {
|
||||||
|
@ -1655,9 +1646,6 @@ export default class Umap extends ServerStored {
|
||||||
delete geojson._storage
|
delete geojson._storage
|
||||||
}
|
}
|
||||||
delete geojson._umap_options?.id // Never trust an id at this stage
|
delete geojson._umap_options?.id // Never trust an id at this stage
|
||||||
if (geojson._umap_options?.iconUrl?.startsWith('/')) {
|
|
||||||
geojson._umap_options.iconUrl = remoteOrigin + geojson._umap_options.iconUrl
|
|
||||||
}
|
|
||||||
const dataLayer = this.createDirtyDataLayer(geojson._umap_options)
|
const dataLayer = this.createDirtyDataLayer(geojson._umap_options)
|
||||||
dataLayer.fromUmapGeoJSON(geojson)
|
dataLayer.fromUmapGeoJSON(geojson)
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,9 +257,6 @@ html[dir="rtl"] .leaflet-tooltip-pane > * {
|
||||||
.home-button:hover {
|
.home-button:hover {
|
||||||
background-color: var(--color-lighterGray);
|
background-color: var(--color-lighterGray);
|
||||||
}
|
}
|
||||||
.umap-edit-enabled .home-button {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,122 +0,0 @@
|
||||||
{
|
|
||||||
"type": "umap",
|
|
||||||
"uri": "https://umap.incubateur.anct.gouv.fr/fr/map/aires-de-covoiturage-du-departement-de-la-nievre_42",
|
|
||||||
"properties": {
|
|
||||||
"easing": false,
|
|
||||||
"embedControl": true,
|
|
||||||
"fullscreenControl": true,
|
|
||||||
"searchControl": true,
|
|
||||||
"datalayersControl": true,
|
|
||||||
"zoomControl": true,
|
|
||||||
"permanentCreditBackground": true,
|
|
||||||
"sortKey": "com_lieu",
|
|
||||||
"slideshow": {},
|
|
||||||
"captionMenus": true,
|
|
||||||
"captionBar": false,
|
|
||||||
"limitBounds": {},
|
|
||||||
"overlay": {},
|
|
||||||
"tilelayer": {
|
|
||||||
"tms": false,
|
|
||||||
"name": "OpenStreetMap",
|
|
||||||
"maxZoom": 19,
|
|
||||||
"minZoom": 0,
|
|
||||||
"attribution": "map data © [[http://osm.org/copyright|OpenStreetMap contributors]] under ODbL",
|
|
||||||
"url_template": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
||||||
},
|
|
||||||
"licence": "",
|
|
||||||
"description": "",
|
|
||||||
"name": "Aires de covoiturage du département de la Nièvre",
|
|
||||||
"defaultView": "data",
|
|
||||||
"onLoadPanel": "none",
|
|
||||||
"displayPopupFooter": false,
|
|
||||||
"miniMap": false,
|
|
||||||
"moreControl": true,
|
|
||||||
"scaleControl": true,
|
|
||||||
"scrollWheelZoom": true,
|
|
||||||
"zoom": 9
|
|
||||||
},
|
|
||||||
"geometry": {
|
|
||||||
"type": "Point",
|
|
||||||
"coordinates": [
|
|
||||||
3.4552001953125004,
|
|
||||||
47.12527904224337
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"layers": [
|
|
||||||
{
|
|
||||||
"type": "FeatureCollection",
|
|
||||||
"features": [
|
|
||||||
{
|
|
||||||
"type": "Feature",
|
|
||||||
"properties": {
|
|
||||||
"id_lieu": "58004-C-001",
|
|
||||||
"id_local": "",
|
|
||||||
"nom_lieu": "Maison du Bazois",
|
|
||||||
"ad_lieu": "Bois de Seigne",
|
|
||||||
"com_lieu": "ALLUY",
|
|
||||||
"insee": "58004",
|
|
||||||
"type": "Parking",
|
|
||||||
"date_maj": "29/08/2019",
|
|
||||||
"ouvert": "true",
|
|
||||||
"source": "225800010",
|
|
||||||
"nbre_pl": "4",
|
|
||||||
"nbre_pmr": "",
|
|
||||||
"duree": "",
|
|
||||||
"horaires": "",
|
|
||||||
"proprio": "",
|
|
||||||
"lumiere": "",
|
|
||||||
"comm": ""
|
|
||||||
},
|
|
||||||
"geometry": {
|
|
||||||
"type": "Point",
|
|
||||||
"coordinates": [
|
|
||||||
3.634832,
|
|
||||||
47.043123
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Feature",
|
|
||||||
"properties": {
|
|
||||||
"id_lieu": "58012-C-001",
|
|
||||||
"id_local": "",
|
|
||||||
"nom_lieu": "Mairie",
|
|
||||||
"ad_lieu": "28 route de Saint-Amand",
|
|
||||||
"com_lieu": "ARQUIAN",
|
|
||||||
"insee": "58012",
|
|
||||||
"type": "Auto-stop",
|
|
||||||
"date_maj": "19/05/2021",
|
|
||||||
"ouvert": "true",
|
|
||||||
"source": "810157982",
|
|
||||||
"nbre_pl": "",
|
|
||||||
"nbre_pmr": "",
|
|
||||||
"duree": "",
|
|
||||||
"horaires": "",
|
|
||||||
"proprio": "",
|
|
||||||
"lumiere": "true",
|
|
||||||
"comm": ""
|
|
||||||
},
|
|
||||||
"geometry": {
|
|
||||||
"type": "Point",
|
|
||||||
"coordinates": [
|
|
||||||
2.99163,
|
|
||||||
47.5407
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_umap_options": {
|
|
||||||
"displayOnLoad": true,
|
|
||||||
"browsable": false,
|
|
||||||
"editMode": "disabled",
|
|
||||||
"remoteData": {},
|
|
||||||
"popupContentTemplate": "# {nom_lieu}\nAdresse : {ad_lieu} {com_lieu}\nType : {type}\nNombre de places : {nbre_pl}\n",
|
|
||||||
"color": "SpringGreen",
|
|
||||||
"iconUrl": "/uploads/pictogram/car-24.png",
|
|
||||||
"labelKey": "com_lieu",
|
|
||||||
"id": 73,
|
|
||||||
"name": "Liste des aires de covoiturage"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -870,20 +870,3 @@ def test_import_from_multiple_files(live_server, page, tilelayer):
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
page.get_by_role("button", name="Import data", exact=True).click()
|
||||||
# Two in one file, one in the other
|
# Two in one file, one in the other
|
||||||
expect(markers).to_have_count(3)
|
expect(markers).to_have_count(3)
|
||||||
|
|
||||||
|
|
||||||
def test_umap_import_with_iconurl(live_server, tilelayer, page):
|
|
||||||
page.goto(f"{live_server.url}/map/new/")
|
|
||||||
page.get_by_title("Import data").click()
|
|
||||||
file_input = page.locator("input[type='file']")
|
|
||||||
with page.expect_file_chooser() as fc_info:
|
|
||||||
file_input.click()
|
|
||||||
file_chooser = fc_info.value
|
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data_with_iconurl.umap"
|
|
||||||
file_chooser.set_files(path)
|
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
|
||||||
expect(
|
|
||||||
page.locator(
|
|
||||||
'img[src="https://umap.incubateur.anct.gouv.fr/uploads/pictogram/car-24.png"]'
|
|
||||||
)
|
|
||||||
).to_have_count(2)
|
|
||||||
|
|
Loading…
Reference in a new issue