mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
wip: rename and document UMAP_IMPORTERS
This commit is contained in:
parent
4127ffb891
commit
d928195a5b
4 changed files with 43 additions and 13 deletions
|
@ -211,6 +211,46 @@ Which feed to display on the home page. Three valid values:
|
||||||
- `"highlighted"`, which shows the maps that have been starred by a staff member
|
- `"highlighted"`, which shows the maps that have been starred by a staff member
|
||||||
- `None`, which does not show any map on the home page
|
- `None`, which does not show any map on the home page
|
||||||
|
|
||||||
|
#### UMAP_IMPORTERS
|
||||||
|
|
||||||
|
Activate preset importers to connect uMap with external sources.
|
||||||
|
|
||||||
|
Must be a dict in the form: `{"importer_name": {"option1": "value"}}`.
|
||||||
|
|
||||||
|
Only the key is mandatory to activate an importer (eg. `{"overpass": {}}`).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
UMAP_IMPORTERS = {
|
||||||
|
"geodatamine": {"name": "my custom name"},
|
||||||
|
"overpass": {"url": "https://overpass-api.de/api/interpreter"},
|
||||||
|
"communesfr": {"name": "Communes françaises"},
|
||||||
|
"datasets": {
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"label": "Régions",
|
||||||
|
"url": "https://domain.org/path/to/file.geojson",
|
||||||
|
"format": "geojson",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Départements",
|
||||||
|
"url": "https://domain.org/path/to/other/file.csv",
|
||||||
|
"format": "csv",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Available importers:
|
||||||
|
|
||||||
|
- `overpass`: very lite form to build a URL retrieving data from Overpass API.
|
||||||
|
- `geodatamine`: allow to interact with [GéoDataMine](https://geodatamine.fr/) API
|
||||||
|
- `communesfr`: download French communes boundaries, from https://geo.api.gouv.fr/
|
||||||
|
- `datasets`: define URLs you want to promote to users, with a `name` and a `format`
|
||||||
|
|
||||||
#### UMAP_MAPS_PER_PAGE
|
#### UMAP_MAPS_PER_PAGE
|
||||||
|
|
||||||
How many maps to show in maps list, like search or home page.
|
How many maps to show in maps list, like search or home page.
|
||||||
|
|
|
@ -259,17 +259,7 @@ UMAP_DEFAULT_SHARE_STATUS = None
|
||||||
UMAP_DEFAULT_EDIT_STATUS = None
|
UMAP_DEFAULT_EDIT_STATUS = None
|
||||||
UMAP_DEFAULT_FEATURES_HAVE_OWNERS = False
|
UMAP_DEFAULT_FEATURES_HAVE_OWNERS = False
|
||||||
UMAP_HOME_FEED = "latest"
|
UMAP_HOME_FEED = "latest"
|
||||||
UMAP_EXPERIMENTAL_IMPORTERS = {
|
UMAP_IMPORTERS = {}
|
||||||
# "overpass": {"url": "https://overpass-api.de/api/interpreter"},
|
|
||||||
# "geodatamine": {},
|
|
||||||
# "communesfr": {},
|
|
||||||
# "presets": {
|
|
||||||
# "choices": [
|
|
||||||
# {"label": "Régions", "url": "https://france-geojson.gregoiredavid.fr/repo/regions.geojson", "format": "geojson"},
|
|
||||||
# {"label": "Départements", "url": "https://france-geojson.gregoiredavid.fr/repo/departements.geojson", "format": "geojson"},
|
|
||||||
# ]
|
|
||||||
# }
|
|
||||||
}
|
|
||||||
|
|
||||||
UMAP_READONLY = env("UMAP_READONLY", default=False)
|
UMAP_READONLY = env("UMAP_READONLY", default=False)
|
||||||
UMAP_GZIP = True
|
UMAP_GZIP = True
|
||||||
|
|
|
@ -527,7 +527,7 @@ def test_import_geojson_from_url(page, live_server, tilelayer):
|
||||||
|
|
||||||
|
|
||||||
def test_overpass_import_with_bbox(page, live_server, tilelayer, settings):
|
def test_overpass_import_with_bbox(page, live_server, tilelayer, settings):
|
||||||
settings.UMAP_EXPERIMENTAL_IMPORTERS = {
|
settings.UMAP_IMPORTERS = {
|
||||||
"overpass": {"url": "https://my.overpass.io/interpreter"}
|
"overpass": {"url": "https://my.overpass.io/interpreter"}
|
||||||
}
|
}
|
||||||
page.goto(f"{live_server.url}/map/new/")
|
page.goto(f"{live_server.url}/map/new/")
|
||||||
|
|
|
@ -505,7 +505,7 @@ class MapDetailMixin:
|
||||||
"featuresHaveOwner": settings.UMAP_DEFAULT_FEATURES_HAVE_OWNERS,
|
"featuresHaveOwner": settings.UMAP_DEFAULT_FEATURES_HAVE_OWNERS,
|
||||||
"websocketEnabled": settings.WEBSOCKET_ENABLED,
|
"websocketEnabled": settings.WEBSOCKET_ENABLED,
|
||||||
"websocketURI": settings.WEBSOCKET_FRONT_URI,
|
"websocketURI": settings.WEBSOCKET_FRONT_URI,
|
||||||
"importers": settings.UMAP_EXPERIMENTAL_IMPORTERS,
|
"importers": settings.UMAP_IMPORTERS,
|
||||||
}
|
}
|
||||||
created = bool(getattr(self, "object", None))
|
created = bool(getattr(self, "object", None))
|
||||||
if (created and self.object.owner) or (not created and not user.is_anonymous):
|
if (created and self.object.owner) or (not created and not user.is_anonymous):
|
||||||
|
|
Loading…
Reference in a new issue