@trailstash/ultra 3.0.0 → 3.1.0-beta0
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.
- package/.swp +0 -0
- package/cli/.build.js.swo +0 -0
- package/cli/build.js +30 -11
- package/cli/serve.js +14 -3
- package/components/code-editor.js +2 -2
- package/docs/.index.md.swo +0 -0
- package/docs/further-reading.md +1 -1
- package/docs/index.md +7 -9
- package/docs/style.md +6 -6
- package/docs/url-parameters.md +1 -1
- package/docs/yaml.md +4 -4
- package/{static/index.html → index.html} +9 -5
- package/lib/queryProviders/gpx.js +1 -1
- package/lib/queryProviders/kml.js +2 -1
- package/lib/queryProviders/osm.js +1 -1
- package/package.json +4 -3
- package/configs/overpass-ultra.js +0 -181
- package/static/minimal.js +0 -9
- package/static/minimal.json +0 -7
- /package/{configs/minimal.js → config.js} +0 -0
package/.swp
ADDED
|
Binary file
|
|
Binary file
|
package/cli/build.js
CHANGED
|
@@ -3,15 +3,26 @@ import path from "path";
|
|
|
3
3
|
import process from "process";
|
|
4
4
|
import { build } from "esbuild";
|
|
5
5
|
import { Command, Flags } from "@oclif/core";
|
|
6
|
+
import { copy } from "esbuild-plugin-copy";
|
|
7
|
+
import { Liquid } from "liquidjs";
|
|
8
|
+
|
|
9
|
+
const engine = new Liquid();
|
|
10
|
+
export const getHTMLContext = async (configFile) => {
|
|
11
|
+
const config = await import(configFile);
|
|
12
|
+
const {
|
|
13
|
+
settings: { title, description, url, mastodon },
|
|
14
|
+
} = config.modes[config.defaultMode];
|
|
15
|
+
return { title, description, url, mastodon };
|
|
16
|
+
};
|
|
6
17
|
|
|
7
18
|
export const ultraRoot = path.dirname(
|
|
8
19
|
path.dirname(new URL(import.meta.url).pathname),
|
|
9
20
|
);
|
|
10
|
-
export const buildOptions = (config) => ({
|
|
21
|
+
export const buildOptions = (config, watch = false) => ({
|
|
11
22
|
entryPoints: [path.join(ultraRoot, "index.js")],
|
|
12
23
|
bundle: true,
|
|
13
24
|
format: "esm",
|
|
14
|
-
outdir:
|
|
25
|
+
outdir: "dist",
|
|
15
26
|
loader: {
|
|
16
27
|
".md": "text",
|
|
17
28
|
".css": "text",
|
|
@@ -22,6 +33,15 @@ export const buildOptions = (config) => ({
|
|
|
22
33
|
alias: {
|
|
23
34
|
"ultra-config": config,
|
|
24
35
|
},
|
|
36
|
+
plugins: [
|
|
37
|
+
copy({
|
|
38
|
+
assets: {
|
|
39
|
+
from: [path.join(ultraRoot, "static/*")],
|
|
40
|
+
to: [path.join(process.cwd(), "./dist")],
|
|
41
|
+
},
|
|
42
|
+
watch,
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
25
45
|
});
|
|
26
46
|
|
|
27
47
|
export default class Build extends Command {
|
|
@@ -29,7 +49,7 @@ export default class Build extends Command {
|
|
|
29
49
|
config: Flags.string({
|
|
30
50
|
char: "c",
|
|
31
51
|
description: "configuration to use",
|
|
32
|
-
default: path.join(
|
|
52
|
+
default: path.join(process.cwd(), "/config.js"),
|
|
33
53
|
}),
|
|
34
54
|
};
|
|
35
55
|
|
|
@@ -40,14 +60,13 @@ export default class Build extends Command {
|
|
|
40
60
|
flags: { config },
|
|
41
61
|
} = await this.parse(Build);
|
|
42
62
|
|
|
43
|
-
|
|
63
|
+
const html = engine.parseAndRenderSync(
|
|
64
|
+
fs.readFileSync(path.join(ultraRoot, "index.html")),
|
|
65
|
+
await getHTMLContext(config),
|
|
66
|
+
);
|
|
67
|
+
fs.mkdirSync("dist", { recursive: true});
|
|
68
|
+
fs.writeFileSync("dist/index.html", html);
|
|
44
69
|
|
|
45
|
-
|
|
46
|
-
fs.cpSync(
|
|
47
|
-
path.join(ultraRoot, "static"),
|
|
48
|
-
path.join(process.cwd(), "static"),
|
|
49
|
-
{ recursive: true },
|
|
50
|
-
);
|
|
51
|
-
}
|
|
70
|
+
await build(buildOptions(config));
|
|
52
71
|
}
|
|
53
72
|
}
|
package/cli/serve.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import fs from "fs";
|
|
1
2
|
import path from "path";
|
|
2
3
|
import { context } from "esbuild";
|
|
3
4
|
import { Command, Flags } from "@oclif/core";
|
|
4
|
-
import Build, { buildOptions, ultraRoot } from "./build.js";
|
|
5
|
+
import Build, { buildOptions, getHTMLContext, ultraRoot } from "./build.js";
|
|
6
|
+
import { Liquid } from "liquidjs";
|
|
7
|
+
|
|
8
|
+
const engine = new Liquid();
|
|
5
9
|
|
|
6
10
|
export default class Serve extends Command {
|
|
7
11
|
static flags = {
|
|
@@ -27,8 +31,15 @@ export default class Serve extends Command {
|
|
|
27
31
|
flags: { config, host, port },
|
|
28
32
|
} = await this.parse(Serve);
|
|
29
33
|
|
|
30
|
-
const
|
|
34
|
+
const html = engine.parseAndRenderSync(
|
|
35
|
+
fs.readFileSync(path.join(ultraRoot, "index.html")),
|
|
36
|
+
await getHTMLContext(config),
|
|
37
|
+
);
|
|
38
|
+
fs.mkdirSync("dist", { recursive: true});
|
|
39
|
+
fs.writeFileSync("dist/index.html", html);
|
|
40
|
+
|
|
41
|
+
const ctx = await context(buildOptions(config, true));
|
|
31
42
|
console.log(`Starting dev server on http://${host}:${port}`);
|
|
32
|
-
await ctx.serve({ host, port, servedir:
|
|
43
|
+
await ctx.serve({ host, port, servedir: "dist" });
|
|
33
44
|
}
|
|
34
45
|
}
|
|
@@ -54,10 +54,10 @@ export class CodeEditor extends HTMLElement {
|
|
|
54
54
|
textarea.addEventListener("drop", async (e) => {
|
|
55
55
|
e.preventDefault();
|
|
56
56
|
const item = e.dataTransfer.items[0];
|
|
57
|
-
if (item.kind === "file"){
|
|
57
|
+
if (item.kind === "file") {
|
|
58
58
|
this.source = await item.getAsFile().text();
|
|
59
59
|
} else {
|
|
60
|
-
this.source = e.dataTransfer.getData(
|
|
60
|
+
this.source = e.dataTransfer.getData("text/plain");
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
textarea.addEventListener("keydown", (e) => {
|
|
Binary file
|
package/docs/further-reading.md
CHANGED
package/docs/index.md
CHANGED
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
<img alt="powered by Overpass API" style="float: right" src="https://wiki.openstreetmap.org/w/images/b/b3/Powered_by_Overpass_API.png">
|
|
4
4
|
|
|
5
|
-
[
|
|
6
|
-
JS](https://maplibre.org) and [OpenStreetMap](https://openstreetmap.org) data
|
|
7
|
-
[Overpass API](https://overpass-api.de/) and
|
|
8
|
-
[`osmtogeojson`](https://github.com/tyrasd/osmtogeojson)
|
|
5
|
+
[Ultra](https://overpass-ultra.us) is a web-application made to simplify making maps with [MapLibre GL
|
|
6
|
+
JS](https://maplibre.org) and [OpenStreetMap](https://openstreetmap.org) data.
|
|
9
7
|
|
|
10
8
|
The customization of the map complies with an [extended](https://overpass-ultra.us/docs/style#ultra-maplibre-styles) version
|
|
11
9
|
of the the [MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/).
|
|
12
10
|
|
|
13
11
|
## Documentation
|
|
14
12
|
|
|
15
|
-
The documentation for
|
|
13
|
+
The documentation for Ultra is available at <a target="_blank" href="https://overpass-ultra.us/docs/">overpass-ultra.us/docs</a>
|
|
16
14
|
|
|
17
15
|
## Overpass Queries
|
|
18
16
|
|
|
@@ -25,25 +23,25 @@ coordinates of the current map view.
|
|
|
25
23
|
|
|
26
24
|
## Configuration
|
|
27
25
|
|
|
28
|
-
Various aspects of
|
|
26
|
+
Various aspects of Ultra, such as styling and the Overpass API server to use, can be
|
|
29
27
|
configured via [YAML front-matter](https://overpass-ultra.us/docs/yaml).
|
|
30
28
|
|
|
31
29
|
## Styling
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
Ultra supports styling using the [MapLibre Style
|
|
34
32
|
Specification](https://maplibre.org/maplibre-style-spec/).
|
|
35
33
|
|
|
36
34
|
See the [Styling](https://overpass-ultra.us/docs/style) section for more information.
|
|
37
35
|
|
|
38
36
|
## About
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
Ultra is built by Daniel Schep.
|
|
41
39
|
|
|
42
40
|
You can contact me on [Mastodon](https://mapstodon.space/@trailstash).
|
|
43
41
|
|
|
44
42
|
## Feedback, Bug Reports, Feature Requests
|
|
45
43
|
|
|
46
|
-
While
|
|
44
|
+
While Ultra has been in development for a while, it should still be considered
|
|
47
45
|
experimental.
|
|
48
46
|
|
|
49
47
|
If you would like to report a bug or provide other feedback, please do so in the project's
|
package/docs/style.md
CHANGED
|
@@ -18,11 +18,11 @@ The value of the style: key can contain:
|
|
|
18
18
|
|
|
19
19
|
## Ultra MapLibre styles
|
|
20
20
|
|
|
21
|
-
In order to simplify the use of MapLibre styles,
|
|
21
|
+
In order to simplify the use of MapLibre styles, Ultra implements a number of features.
|
|
22
22
|
|
|
23
23
|
### Query result styling
|
|
24
24
|
|
|
25
|
-
In order to allow for easy styling of the query results,
|
|
25
|
+
In order to allow for easy styling of the query results, Ultra allows you to specify a
|
|
26
26
|
style with only the layer for your query results.
|
|
27
27
|
|
|
28
28
|
For example, to render query results with a purple MapLibre
|
|
@@ -66,7 +66,7 @@ source containting the query results.
|
|
|
66
66
|
### Automatic `paint` and `layer` keys
|
|
67
67
|
In order to reduce the mental overhead of remember what keys are
|
|
68
68
|
[`paint`](https://maplibre.org/maplibre-style-spec/layers/#paint) options and which are
|
|
69
|
-
[`layout`](https://maplibre.org/maplibre-style-spec/layers/#layout) options,
|
|
69
|
+
[`layout`](https://maplibre.org/maplibre-style-spec/layers/#layout) options, Ultra will
|
|
70
70
|
automatically move them from the layer object into the appropriate options object.
|
|
71
71
|
|
|
72
72
|
For example, the above purple circle layer can be implemented as:
|
|
@@ -89,13 +89,13 @@ In order to place your layers below existing style layers, you can use the `befo
|
|
|
89
89
|
## PNG sprites via HTTPS
|
|
90
90
|
In order to facilitate adding icons to the map that don't exist in the basemap's
|
|
91
91
|
[sprites](),
|
|
92
|
-
if `icon-image` is set to an HTTPS URL to a PNG image,
|
|
92
|
+
if `icon-image` is set to an HTTPS URL to a PNG image, Ultra will automatically download
|
|
93
93
|
it and add it to the Map's images.
|
|
94
94
|
|
|
95
95
|
[Example](./MapLibre-Examples/add-image.md)
|
|
96
96
|
|
|
97
97
|
## Bundled Sprites
|
|
98
|
-
In order to simplify the creation of POI maps,
|
|
98
|
+
In order to simplify the creation of POI maps, Ultra bundles the
|
|
99
99
|
[Maki](https://github.com/mapbox/maki) and [Temaki](https://github.com/rapideditor/temaki) sprites
|
|
100
100
|
and adds them to your style as [SDFs](https://docs.mapbox.com/help/troubleshooting/using-recolorable-images-in-mapbox-maps/)
|
|
101
101
|
allowing for easy styling of icons.
|
|
@@ -116,5 +116,5 @@ style:
|
|
|
116
116
|
|
|
117
117
|
## Fallback fontstack
|
|
118
118
|
Since not all MapLibre styles have the same
|
|
119
|
-
[glyphs](https://maplibre.org/maplibre-style-spec/glyphs/),
|
|
119
|
+
[glyphs](https://maplibre.org/maplibre-style-spec/glyphs/), Ultra will default to using
|
|
120
120
|
Noto Sans Regular if the speficied(or default) fontstack is not available.
|
package/docs/url-parameters.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# URL Hash Parameters
|
|
2
2
|
|
|
3
|
-
You use the following query string parameters as a hash to instruct
|
|
3
|
+
You use the following query string parameters as a hash to instruct Ultra to set certain properties on startup (such as the query or the map location).
|
|
4
4
|
|
|
5
5
|
## `query` <small>(URL-encoded string)</small>
|
|
6
6
|
|
package/docs/yaml.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# YAML front-matter config
|
|
2
2
|
|
|
3
|
-
The real power of
|
|
3
|
+
The real power of Ultra lies in it's easy configuration of MapLibre with the a query's
|
|
4
4
|
[YAML front-matter](https://jekyllrb.com/docs/front-matter/).
|
|
5
5
|
|
|
6
6
|
## `style`
|
|
7
7
|
|
|
8
|
-
Customize the MapLibre style. See [Styling](./
|
|
8
|
+
Customize the MapLibre style. See [Styling](./style.md) for more information.
|
|
9
9
|
|
|
10
10
|
Example:
|
|
11
11
|
```
|
|
@@ -74,7 +74,7 @@ url](https://maplibre.org/maplibre-style-spec/sources/#url_2)
|
|
|
74
74
|
|
|
75
75
|
## `options`
|
|
76
76
|
|
|
77
|
-
When an
|
|
77
|
+
When an Ultra query is run in "interactive map" mode, you can specify the
|
|
78
78
|
[`MapOptions`](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapOptions/)
|
|
79
79
|
that are passed to the MapLibre constructor.
|
|
80
80
|
|
|
@@ -89,7 +89,7 @@ options:
|
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
## `controls`
|
|
92
|
-
When an
|
|
92
|
+
When an Ultra query is run in "interactive map" mode, you can specify controls to be added to the map with the `controls` key
|
|
93
93
|
in the YAML-front matter. The key should contain a list of objects. Each object must specify a `type` key containing the
|
|
94
94
|
name of a control present in MapLibre. It can optionally contain an `options` key who's contents are passed to the
|
|
95
95
|
control's constructor and a `position` key that is passed to
|
|
@@ -4,15 +4,19 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<link rel="icon" href="./logo.png" />
|
|
7
|
-
|
|
7
|
+
{% if mastodon %}
|
|
8
|
+
<link rel="me" href="{{ mastodon }}" />
|
|
9
|
+
{% endif %}
|
|
8
10
|
|
|
9
|
-
<title>Ultra</title>
|
|
11
|
+
<title>{{ title | default: "Ultra"}}</title>
|
|
10
12
|
|
|
11
13
|
<!-- Meta tags for SEO and social sharing -->
|
|
12
|
-
|
|
14
|
+
{% if url %}
|
|
15
|
+
<link rel="canonical" href="{{ url }}" />
|
|
16
|
+
{% endif %}
|
|
13
17
|
<meta
|
|
14
18
|
name="description"
|
|
15
|
-
content="A web based
|
|
19
|
+
content="{{ description | default: "A web based tool for making MapLibre GL maps with data from sources such as Overpass, GeoJSON, GPX, KML, TCX, etc" }}"
|
|
16
20
|
/>
|
|
17
21
|
<meta name="robots" content="index,follow" />
|
|
18
22
|
|
|
@@ -28,7 +32,7 @@
|
|
|
28
32
|
: (window.sa_event.q = [a]);
|
|
29
33
|
};
|
|
30
34
|
</script>
|
|
31
|
-
<script src="./
|
|
35
|
+
<script src="./index.js" type="module"></script>
|
|
32
36
|
</head>
|
|
33
37
|
<body>
|
|
34
38
|
<ultra-loader></ultra-loader>
|
|
@@ -76,7 +76,7 @@ const detect = async (query) => {
|
|
|
76
76
|
const doc = new window.DOMParser().parseFromString(query, "text/xml");
|
|
77
77
|
if (
|
|
78
78
|
!doc.querySelector("parsererror") &&
|
|
79
|
-
doc.childNodes
|
|
79
|
+
Array.from(doc.childNodes).some((x) => x.nodeName === "gpx")
|
|
80
80
|
) {
|
|
81
81
|
return query;
|
|
82
82
|
}
|
|
@@ -91,7 +91,8 @@ const detect = async (query) => {
|
|
|
91
91
|
}
|
|
92
92
|
const doc = new window.DOMParser().parseFromString(query, "text/xml");
|
|
93
93
|
return (
|
|
94
|
-
!doc.querySelector("parsererror") &&
|
|
94
|
+
!doc.querySelector("parsererror") &&
|
|
95
|
+
Array.from(doc.childNodes).some((x) => x.nodeName === "kml")
|
|
95
96
|
);
|
|
96
97
|
};
|
|
97
98
|
|
|
@@ -153,7 +153,7 @@ const detectXML = (query) => {
|
|
|
153
153
|
const doc = new window.DOMParser().parseFromString(query, "text/xml");
|
|
154
154
|
if (
|
|
155
155
|
!doc.querySelector("parsererror") &&
|
|
156
|
-
doc.childNodes
|
|
156
|
+
Array.from(doc.childNodes).some((x) => x.nodeName === "osm")
|
|
157
157
|
) {
|
|
158
158
|
return query;
|
|
159
159
|
}
|
package/package.json
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "3.
|
|
7
|
-
"description": "A web based tool for making MapLibre GL maps with data from
|
|
6
|
+
"version": "3.1.0-beta0",
|
|
7
|
+
"description": "A web based tool for making MapLibre GL maps with data from sources such as Overpass, GeoJSON, GPX, KML, TCX, etc",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "node ./bin/run.js build",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"start:docs": "mkdocs serve",
|
|
17
17
|
"build:pages": "mkdir -p public && cp -Lr static/* public/.",
|
|
18
18
|
"start": "node ./bin/run.js serve",
|
|
19
|
-
"format": "prettier --print-width=80 --write '
|
|
19
|
+
"format": "prettier --print-width=80 --write '**/*.js' '**/*.json' README.md '**/*.css'",
|
|
20
20
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
21
21
|
},
|
|
22
22
|
"type": "module",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@types/node": "^22.5.4",
|
|
42
42
|
"@unvt/sprite-one": "^0.1.1",
|
|
43
43
|
"esbuild": "^0.23.1",
|
|
44
|
+
"esbuild-plugin-copy": "^2.1.1",
|
|
44
45
|
"prettier": "^3.3.3",
|
|
45
46
|
"puppeteer": "^23.3.0",
|
|
46
47
|
"svg2png": "^4.1.1",
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import help from "../docs/index.md";
|
|
2
|
-
|
|
3
|
-
const queryUrl = () => {
|
|
4
|
-
const params = new URLSearchParams(window.location.hash.slice(1));
|
|
5
|
-
params.delete("map");
|
|
6
|
-
return new URL("#" + params.toString(), window.location).toString();
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
let mapStyle = "https://styles.trailsta.sh/openmaptiles-osm.json";
|
|
10
|
-
let server = "https://overpass-api.de/api";
|
|
11
|
-
let query = `/*
|
|
12
|
-
This is an example Overpass query.
|
|
13
|
-
Try it out by pressing the Run button above!
|
|
14
|
-
*/
|
|
15
|
-
[bbox:{{bbox}}];
|
|
16
|
-
(
|
|
17
|
-
way[highway=path];
|
|
18
|
-
way[highway=footway];
|
|
19
|
-
way[highway=cycleway];
|
|
20
|
-
way[highway=steps];
|
|
21
|
-
);
|
|
22
|
-
out geom;`;
|
|
23
|
-
let popupTemplate;
|
|
24
|
-
|
|
25
|
-
let styles = [
|
|
26
|
-
[
|
|
27
|
-
"OSM OpenMapTiles",
|
|
28
|
-
"https://styles.trailsta.sh/openmaptiles-osm.json",
|
|
29
|
-
"OpenMapTiles",
|
|
30
|
-
],
|
|
31
|
-
[
|
|
32
|
-
"OSM Liberty",
|
|
33
|
-
"https://styles.trailsta.sh/osm-liberty.json",
|
|
34
|
-
"OpenMapTiles",
|
|
35
|
-
],
|
|
36
|
-
["OSM Bright", "https://styles.trailsta.sh/osm-bright.json", "OpenMapTiles"],
|
|
37
|
-
["Positron", "https://styles.trailsta.sh/positron.json", "OpenMapTiles"],
|
|
38
|
-
[
|
|
39
|
-
"Dark Matter",
|
|
40
|
-
"https://styles.trailsta.sh/dark-matter.json",
|
|
41
|
-
"OpenMapTiles",
|
|
42
|
-
],
|
|
43
|
-
[
|
|
44
|
-
"MapTiler Basic",
|
|
45
|
-
"https://styles.trailsta.sh/maptiler-basic.json",
|
|
46
|
-
"OpenMapTiles",
|
|
47
|
-
],
|
|
48
|
-
[
|
|
49
|
-
"Fiord Color",
|
|
50
|
-
"https://styles.trailsta.sh/fiord-color.json",
|
|
51
|
-
"OpenMapTiles",
|
|
52
|
-
],
|
|
53
|
-
[
|
|
54
|
-
"Protomaps Light",
|
|
55
|
-
"https://styles.trailsta.sh/protomaps-light.json",
|
|
56
|
-
"Protomaps",
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
"Protomaps Dark",
|
|
60
|
-
"https://styles.trailsta.sh/protomaps-dark.json",
|
|
61
|
-
"Protomaps",
|
|
62
|
-
],
|
|
63
|
-
[
|
|
64
|
-
"Protomaps Data Viz (white)",
|
|
65
|
-
"https://styles.trailsta.sh/protomaps-white.json",
|
|
66
|
-
"Protomaps",
|
|
67
|
-
],
|
|
68
|
-
[
|
|
69
|
-
"Protomaps Data Viz (grayscale)",
|
|
70
|
-
"https://styles.trailsta.sh/protomaps-grayscale.json",
|
|
71
|
-
"Protomaps",
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
"Protomaps Data Viz (black)",
|
|
75
|
-
"https://styles.trailsta.sh/protomaps-black.json",
|
|
76
|
-
"Protomaps",
|
|
77
|
-
],
|
|
78
|
-
["Basic", "https://styles.trailsta.sh/protomaps-contrast.json", "Protomaps"],
|
|
79
|
-
["OpenTrailStash", "https://open.trailsta.sh/style.json", "OpenTrailStash"],
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
if (window.location.host === "ohm.overpass-ultra.us") {
|
|
83
|
-
// TODO: customize help
|
|
84
|
-
styles = [];
|
|
85
|
-
query = `/*
|
|
86
|
-
This is an example Overpass query.
|
|
87
|
-
Try it out by pressing the Run button above!
|
|
88
|
-
*/
|
|
89
|
-
nwr["amenity"="theatre"]["start_date"](if:
|
|
90
|
-
t["start_date"] < "1976" &&
|
|
91
|
-
(!is_tag("end_date") || t["end_date"] >= "1975"));
|
|
92
|
-
|
|
93
|
-
out geom;`;
|
|
94
|
-
server = "https://overpass-api.openhistoricalmap.org/api/";
|
|
95
|
-
mapStyle = "https://www.openhistoricalmap.org/map-styles/main/main.json";
|
|
96
|
-
popupTemplate = `
|
|
97
|
-
<h2>
|
|
98
|
-
{{ type }}
|
|
99
|
-
<a href="https://openhistoricalmap.org/{{ type }}/{{ id }}" target="_blank">{{ id }}</a>
|
|
100
|
-
<a href="https://openhistoricalmap.org/edit?{{ type }}={{ id }}" target="_blank">✏️</a>
|
|
101
|
-
</h2>
|
|
102
|
-
<h3>Tags</h3>
|
|
103
|
-
{%- for tag in tags %}
|
|
104
|
-
{%- if tag[0] contains "website" %}
|
|
105
|
-
<code>{{ tag[0] }} = <a href="{{ tag[1] }}" target="_blank">{{ tag[1] }}</a></code>
|
|
106
|
-
{%- elsif tag[0] contains "wikidata" %}
|
|
107
|
-
<code>{{ tag[0] }} = <a href="https://wikidata.org/wiki/{{ tag[1] }}" target="_blank">{{ tag[1] }}</a></code>
|
|
108
|
-
{%- elsif tag[0] contains "wikipedia" %}
|
|
109
|
-
{% assign lang = tag[1] | split: ":" | first %}
|
|
110
|
-
<code>{{ tag[0] }} = <a href="https://{{ lang }}.wikipedia.org/wiki/{{ tag[1] | replace_first: lang, "" | replace_first: ":", "" }}" target="_blank">{{ tag[1] }}</a></code>
|
|
111
|
-
{%- else %}
|
|
112
|
-
<code>{{ tag[0] }} = {{ tag[1] }}</code>
|
|
113
|
-
{%- endif %}
|
|
114
|
-
<br>
|
|
115
|
-
{%- endfor %}
|
|
116
|
-
{%- if meta %}
|
|
117
|
-
<h3>Meta</h3>
|
|
118
|
-
{%- for tag in meta %}
|
|
119
|
-
{%- if tag[0] == "changeset" %}
|
|
120
|
-
<code>{{ tag[0] }} = <a href="https://openhistoricalmap.org/changeset/{{ tag[1] }}" target="_blank">{{ tag[1] }}</a></code>
|
|
121
|
-
{%- elsif tag[0] == "user" %}
|
|
122
|
-
<code>{{ tag[0] }} = <a href="https://openhistoricalmap.org/user/{{ tag[1] }}" target="_blank">{{ tag[1] }}</a></code>
|
|
123
|
-
{%- else %}
|
|
124
|
-
<code>{{ tag[0] }} = {{ tag[1] }}</code>
|
|
125
|
-
{%- endif %}
|
|
126
|
-
<br>
|
|
127
|
-
{%- endfor %}
|
|
128
|
-
{%- endif %}
|
|
129
|
-
{%- if coordinates %}
|
|
130
|
-
<h3>Coordinates</h3>
|
|
131
|
-
<a href="geo://{{coordinates[1]}},{{coordinates[0]}}">{{coordinates[1] | round: 6 }} / {{coordinates[0] | round: 6 }}</a> <small>(lat/lon)</small>
|
|
132
|
-
{%- endif %}
|
|
133
|
-
`;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const settings = {
|
|
137
|
-
type: "overpass",
|
|
138
|
-
server,
|
|
139
|
-
mapStyle,
|
|
140
|
-
popupTemplate,
|
|
141
|
-
options: {},
|
|
142
|
-
controls: [],
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export const defaultMode = "ide";
|
|
146
|
-
export const modes = {
|
|
147
|
-
ide: {
|
|
148
|
-
query,
|
|
149
|
-
styles,
|
|
150
|
-
help,
|
|
151
|
-
title: "Overpass Ultra",
|
|
152
|
-
icon: "/logo.png",
|
|
153
|
-
settings: {
|
|
154
|
-
...settings,
|
|
155
|
-
zoom: 16,
|
|
156
|
-
center: [-77.4515, 37.5287],
|
|
157
|
-
options: {
|
|
158
|
-
attributionControl: {
|
|
159
|
-
customAttribution: "",
|
|
160
|
-
},
|
|
161
|
-
maxBounds: [
|
|
162
|
-
[-179.999999999, -85.051129],
|
|
163
|
-
[179.999999999, 85.051129],
|
|
164
|
-
],
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
map: {
|
|
169
|
-
settings: {
|
|
170
|
-
...settings,
|
|
171
|
-
loadSettingsFromQueryParams: true,
|
|
172
|
-
options: {
|
|
173
|
-
attributionControl: {
|
|
174
|
-
compact: true,
|
|
175
|
-
customAttribution: `<a href=".">Overpass Ultra</a>
|
|
176
|
-
(<a href="${queryUrl()}">View Query</a>)`,
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
};
|
package/static/minimal.js
DELETED
package/static/minimal.json
DELETED
|
File without changes
|