@trailstash/ultra 4.0.0 → 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.
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({
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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "4.0.0",
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
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",