@trailstash/ultra 3.9.2 → 4.1.0

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.
@@ -0,0 +1,26 @@
1
+ ---
2
+ title: map=yes
3
+ description: A recreation of [Stamen Design's map=yes project](http://mapequalsyes.stamen.com/)
4
+ options:
5
+ zoom: 12.79
6
+ center: [-77.4511, 37.5515]
7
+ style:
8
+ version: 8
9
+ layers:
10
+ - type: background
11
+ - type: fill
12
+ filter: [==, [get, leisure], park]
13
+ fill-color: rgb(0, 102, 153)
14
+ - type: fill
15
+ filter: [has, building]
16
+ fill-color: white
17
+ - type: line
18
+ filter: [==, [geometry-type], LineString]
19
+ line-color: white
20
+ ---
21
+ (
22
+ nwr[building][building!=no]({{bbox}});
23
+ nwr[leisure=park]({{bbox}});
24
+ way[highway=motorway_link]({{bbox}});
25
+ );
26
+ out geom;
@@ -0,0 +1,18 @@
1
+ ---
2
+ title: Replace a basemap layer with query data
3
+ description: This requires knowing the layer IDs in the style you want to replace. Use [Maputnik](https://maplibre.org/maputnik) to inspect styles.
4
+ options:
5
+ zoom: 14
6
+ center: [-77.46829, 37.53255]
7
+ style:
8
+ extends: https://styles.trailsta.sh/openmaptiles-osm.json
9
+ layers:
10
+ - id: water
11
+ visiblity: none
12
+ - type: fill
13
+ beforeLayerId: water
14
+ fill-color: lightblue
15
+ ---
16
+ [bbox:{{bbox}}];
17
+ nwr[natural=water];
18
+ out geom;
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Display a globe with a vector map
3
+ description: Display a globe with a vector map.
4
+ options:
5
+ zoom: 0
6
+ center: [137.9150899566626, 36.25956997955441]
7
+ style:
8
+ extends: https://tiles.openfreemap.org/styles/liberty
9
+ projection:
10
+ type: globe
11
+ ---
@@ -98,7 +98,7 @@ function generateExamplesFolder(examplesFolder) {
98
98
  }
99
99
 
100
100
  // !!Main flow start here!!
101
- generateExamplesFolder(process.argv["2"] || "examples");
101
+ generateExamplesFolder(process.argv["2"] || "Examples");
102
102
  console.log(
103
103
  "Docs generation completed, to see it in action run\n npm run start:docs",
104
104
  );
@@ -35,7 +35,7 @@ async function createImage(exampleName) {
35
35
  // Wait for map to load, then wait two more seconds for images, etc. to load.
36
36
  try {
37
37
  //await page.waitForFunction('map.loaded()');
38
- const waitTime = 5000;
38
+ const waitTime = 10000;
39
39
  console.log(`waiting for ${waitTime} ms`);
40
40
  await new Promise((resolve) => setTimeout(resolve, waitTime));
41
41
  } catch (err) {
package/cli/build.js CHANGED
@@ -46,6 +46,7 @@ export const buildOptions = (config, watch = false) => ({
46
46
  },
47
47
  alias: {
48
48
  "ultra-config": config,
49
+ "node:events": "node-events", // esri-dump support
49
50
  },
50
51
  plugins: [
51
52
  copy({
@@ -5,10 +5,25 @@ import { normalizeCSS } from "../lib/normalize.js";
5
5
  const style = `margin: 10px 0; display: block; width: 100%; text-align: left;`;
6
6
 
7
7
  const styles = [
8
+ [
9
+ "OpenFreeMap Liberty",
10
+ "https://tiles.openfreemap.org/styles/liberty",
11
+ `<a href="https://openfreemap.org/">OpenFreeMap</a>`,
12
+ ],
13
+ [
14
+ "OpenFreeMap Bright",
15
+ "https://tiles.openfreemap.org/styles/bright",
16
+ `<a href="https://openfreemap.org/">OpenFreeMap</a>`,
17
+ ],
18
+ [
19
+ "OpenFreeMap Positron",
20
+ "https://tiles.openfreemap.org/styles/positron",
21
+ `<a href="https://openfreemap.org/">OpenFreeMap</a>`,
22
+ ],
8
23
  [
9
24
  "Natural Earth Vector",
10
25
  "https://trailstash.github.io/naturalearthtiles/maps/natural_earth.vector.json",
11
- `<a href="https://github.com/trailstash/naturalearthtiles">TrailStash</a>`,
26
+ `<a href="https://github.com/trailstash/naturalearthtiles">Natural Earth</a>`,
12
27
  ],
13
28
  [
14
29
  "MapLibre Demo Tiles",
@@ -43,8 +43,7 @@ export class UltraMap extends HTMLElement {
43
43
  type: "auto",
44
44
  query: "",
45
45
  server: null,
46
- mapStyle:
47
- "https://trailstash.github.io/naturalearthtiles/maps/natural_earth.vector.json",
46
+ mapStyle: "https://tiles.openfreemap.org/styles/liberty",
48
47
  popupTemplate: null,
49
48
  popupOnHover: false,
50
49
  querySources: ["ultra"],
Binary file
package/docs/resources.md CHANGED
@@ -78,6 +78,12 @@ appropriate headers yourself.
78
78
  The [Overture foundation](https://overturemaps.org/) makes map data derived from various sources
79
79
  available. It needs to be processed and hosted before use with Ultra.
80
80
 
81
+ ### Esri
82
+
83
+ mappingsupport.com maintains an excellent list of ArcGIS REST servers:
84
+
85
+ https://mappingsupport.com/p/surf_gis/list-federal-state-county-city-GIS-servers.pdf
86
+
81
87
  ## Base Style resources
82
88
 
83
89
  ### TrailStash Style Server
package/index.js CHANGED
@@ -22,6 +22,9 @@ import { FontAwesomeIcon } from "./components/fontawesome-icon.js";
22
22
  import { ButtonModal } from "./components/button-modal.js";
23
23
  import { MapPopup } from "./components/map-popup.js";
24
24
 
25
+ // esri dump expects to be running in a node env, so add global process.env
26
+ window.process = { env: {} };
27
+
25
28
  // Allow pages in new windows securely
26
29
  DOMPurify.addHook("afterSanitizeAttributes", function (node) {
27
30
  // set all elements owning target to target=_blank
@@ -0,0 +1,88 @@
1
+ import EsriDump from "esri-dump";
2
+
3
+ const layers = (source) => [
4
+ {
5
+ id: `${source}-geojson-fill`,
6
+ type: "fill",
7
+ source,
8
+ filter: ["==", ["geometry-type"], "Polygon"],
9
+ paint: {
10
+ "fill-color": "#555",
11
+ "fill-opacity": 0.3,
12
+ },
13
+ },
14
+ {
15
+ id: `${source}-geojson-fill-outline`,
16
+ type: "line",
17
+ source,
18
+ filter: ["==", ["geometry-type"], "Polygon"],
19
+ layout: { "line-cap": "round" },
20
+ paint: {
21
+ "line-color": "#555",
22
+ "line-width": 2,
23
+ "line-opacity": 1,
24
+ },
25
+ },
26
+ {
27
+ id: `${source}-geojson-line-2`,
28
+ type: "line",
29
+ source,
30
+ filter: ["==", ["geometry-type"], "LineString"],
31
+ layout: { "line-cap": "round" },
32
+ paint: {
33
+ "line-color": "#555",
34
+ "line-width": 2,
35
+ "line-opacity": 1,
36
+ },
37
+ },
38
+ {
39
+ id: `${source}-geojson-point`,
40
+ type: "circle",
41
+ source,
42
+ filter: ["==", ["geometry-type"], "Point"],
43
+ paint: {
44
+ "circle-stroke-width": 2,
45
+ "circle-stroke-color": "#555",
46
+ "circle-color": "rgba(85, 85, 85, 0.3)",
47
+ },
48
+ },
49
+ ];
50
+
51
+ async function detect(query) {
52
+ return !!query.match(/\/(Map|Feature)Server\/\d+$/);
53
+ }
54
+
55
+ export default {
56
+ source: function geojson(query, controller) {
57
+ return new Promise((resolve, reject) => {
58
+ const esri = new EsriDump(query);
59
+
60
+ const data = {
61
+ type: "FeatureCollection",
62
+ features: [],
63
+ };
64
+
65
+ esri.fetch();
66
+
67
+ esri.on("type", (type) => {
68
+ //Emitted before any data events
69
+ //emits one of
70
+ // - `MapServer'
71
+ // - `FeatureServer'
72
+ });
73
+
74
+ esri.on("feature", (feature) => {
75
+ data.features.push(feature);
76
+ });
77
+
78
+ esri.on("done", () => {
79
+ resolve({ type: "geojson", data, generateId: true });
80
+ });
81
+
82
+ esri.on("error", reject);
83
+ });
84
+ },
85
+ fitBounds: true,
86
+ layers,
87
+ detect,
88
+ };
@@ -10,6 +10,7 @@ import kml from "./kml.js";
10
10
  import gpx from "./gpx.js";
11
11
  import tcx from "./tcx.js";
12
12
  import raw from "./raw.js";
13
+ import esri from "./esri.js";
13
14
 
14
15
  export const all = {
15
16
  overpass,
@@ -21,6 +22,7 @@ export const all = {
21
22
  tcx,
22
23
  osmxml,
23
24
  osmjson,
25
+ esri,
24
26
  raster,
25
27
  vector,
26
28
  raw,
package/lib/style.js CHANGED
@@ -169,7 +169,7 @@ export function ensureSourceAndLayers(style, source) {
169
169
  url: new URL("sprites/temaki", window.location).toString(),
170
170
  });
171
171
  }
172
- if (source && !style.sources.ultra) {
172
+ if (source) {
173
173
  let foundAttribution = false;
174
174
  for (const sourceName in style.sources) {
175
175
  if (
@@ -182,7 +182,7 @@ export function ensureSourceAndLayers(style, source) {
182
182
  }
183
183
  }
184
184
  style.sources.ultra = source.source;
185
- if (foundAttribution) {
185
+ if (foundAttribution && style.sources.ultra.attribution) {
186
186
  style.sources.ultra.attribution = "";
187
187
  }
188
188
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.9.2",
6
+ "version": "4.1.0",
7
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": {
@@ -64,12 +64,14 @@
64
64
  "dompurify": "^3.1.7",
65
65
  "esbuild": "^0.24.0",
66
66
  "esbuild-plugin-copy": "^2.1.1",
67
+ "esri-dump": "^5.4.0",
67
68
  "fast-deep-equal": "^3.1.3",
68
69
  "liquidjs": "^10.17.0",
69
70
  "lodash.pick": "^4.4.0",
70
71
  "lz-string": "^1.5.0",
71
- "maplibre-gl": "^4.7.1",
72
+ "maplibre-gl": "^5.0.1",
72
73
  "marked": "^14.1.2",
74
+ "node-events": "^0.0.2",
73
75
  "normalize.css": "^8.0.1",
74
76
  "osmtogeojson": "^3.0.0-beta.5",
75
77
  "pmtiles": "^3.2.0",
@@ -77,7 +79,7 @@
77
79
  "yaml": "^2.5.1"
78
80
  },
79
81
  "peerDependencies": {
80
- "@maplibre/maplibre-gl-style-spec": "20.x"
82
+ "@maplibre/maplibre-gl-style-spec": "*"
81
83
  },
82
84
  "bin": {
83
85
  "ultra": "./bin/run.js"