@trailstash/ultra 6.0.1 → 6.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/.gitlab-ci.yml CHANGED
@@ -7,7 +7,7 @@ pages:
7
7
  image: node:20
8
8
  script:
9
9
  - apt update && apt install -y mkdocs-material jq moreutils
10
- - npm ci
10
+ - npm i
11
11
  # Update version
12
12
  - jq ".version = \"$(git describe --tags --dirty | sed -e 's/^v//')\"" package.json | sponge package.json
13
13
  - mv pages-config.mjs config.mjs
@@ -7,6 +7,7 @@ import { version } from "../package.json";
7
7
  import { version as maplibreVersion } from "maplibre-gl/package.json";
8
8
  import { version as osmtogeojsonVersion } from "osm2geojson-ultra/package.json";
9
9
  import { version as esridumpVersion } from "esri-dump/package.json";
10
+ import { version as csv2geojsonVersion } from "csv2geojson/package.json";
10
11
 
11
12
  const help = `# Introduction
12
13
 
@@ -161,6 +162,17 @@ export class HelpModal extends HTMLElement {
161
162
  </li>`
162
163
  : ""
163
164
  }
165
+
166
+ ${
167
+ this.queryProviders.dsv
168
+ ? `<li>
169
+ CSV/TSV/DSV support powered by
170
+ <a target="_blank" href="https://github.com/mapbox/csv2geojson"
171
+ >csv2geojson</a
172
+ > <code>${csv2geojsonVersion}</code>
173
+ </li>`
174
+ : ""
175
+ }
164
176
  </ul>
165
177
  </div>
166
178
  `,
package/docs/yaml.md CHANGED
@@ -74,6 +74,7 @@ Automatically detects and chooses the right query provider out of the following:
74
74
  - `osmWebsite`
75
75
  - `osmWiki`
76
76
  - `taginfo`
77
+ - `dsv`
77
78
 
78
79
  See each provider for how it is auto-detected
79
80
 
@@ -249,6 +250,12 @@ Detected if
249
250
 
250
251
  - A JSON document or URL to a JSON document containing a `tilejson` key and a `format` key equal to `pbf`.
251
252
 
253
+ ### `dsv`
254
+
255
+ `,`, `\t`, `;`, or `|` delimited values. Can only represent points. Header must include columns
256
+ matching the the regexes `/(lat)(itude)?/` and `/l(on|ng)(gitude)?`. The delmiter is automatically
257
+ detected.
258
+
252
259
  ### `postpass`
253
260
 
254
261
  An SQL query to be executed on a [Postpass](https://github.com/woodpeck/postpass) server. Server
@@ -0,0 +1,71 @@
1
+ import { fetchIfHTTP } from "./util.js";
2
+ import { csv2geojson } from "csv2geojson";
3
+
4
+ const layers = (source) => [
5
+ {
6
+ id: `${source}-dsv-point`,
7
+ type: "symbol",
8
+ source,
9
+ filter: ["==", ["geometry-type"], "Point"],
10
+ layout: {
11
+ "icon-overlap": "always",
12
+ "icon-size": [
13
+ "case",
14
+ ["==", ["get", "marker-size"], "large"],
15
+ 1.5,
16
+ ["==", ["get", "marker-size"], "medium"],
17
+ 1,
18
+ ["==", ["get", "marker-size"], "small"],
19
+ 0.75,
20
+ 1,
21
+ ],
22
+ "icon-anchor": [
23
+ "case",
24
+ ["!", ["has", "marker-symbol"]],
25
+ "bottom",
26
+ ["==", ["get", "marker-symbol"], "marker"],
27
+ "bottom",
28
+ ["==", ["get", "marker-symbol"], "marker-stroked"],
29
+ "bottom",
30
+ "center",
31
+ ],
32
+ "icon-image": [
33
+ "coalesce",
34
+ ["image", ["concat", "maki:", ["get", "marker-symbol"]]],
35
+ ["image", "maki:marker"],
36
+ ],
37
+ },
38
+ paint: {
39
+ "icon-color": ["coalesce", ["get", "marker-color"], "#555"],
40
+ "icon-halo-color": ["coalesce", ["get", "stroke-color"], "#fff"],
41
+ "icon-halo-width": [
42
+ "coalesce",
43
+ ["get", "stroke-width"],
44
+ [
45
+ "case",
46
+ ["==", ["get", "marker-size"], "large"],
47
+ 3,
48
+ ["==", ["get", "marker-size"], "medium"],
49
+ 1.5,
50
+ ["==", ["get", "marker-size"], "small"],
51
+ 1,
52
+ 1.5,
53
+ ],
54
+ ],
55
+ },
56
+ },
57
+ ];
58
+
59
+ export default {
60
+ source: async function (query) {
61
+ query = await fetchIfHTTP(query);
62
+ const data = await new Promise((resolve, reject) =>
63
+ csv2geojson(query, { delimiter: "auto" }, (error, result) =>
64
+ error ? reject(error.message) : resolve(result),
65
+ ),
66
+ );
67
+ return { type: "geojson", data, generateId: true };
68
+ },
69
+ layers,
70
+ fitBounds: true,
71
+ };
@@ -24,7 +24,7 @@ const layers = (source) => [
24
24
  },
25
25
  },
26
26
  {
27
- id: `${source}-geojson-line-2`,
27
+ id: `${source}-geojson-line`,
28
28
  type: "line",
29
29
  source,
30
30
  filter: ["==", ["geometry-type"], "LineString"],
@@ -13,6 +13,7 @@ import tcx from "./tcx.js";
13
13
  import raw from "./raw.js";
14
14
  import esri from "./esri.js";
15
15
  import javascript from "./javascript.js";
16
+ import dsv from "./dsv.js";
16
17
 
17
18
  export const all = {
18
19
  overpass,
@@ -35,6 +36,7 @@ export const all = {
35
36
  osmWiki,
36
37
  taginfo,
37
38
  javascript,
39
+ dsv,
38
40
  };
39
41
 
40
42
  export default { auto: new AutoProvider(all), ...all };
@@ -3,7 +3,7 @@ import { kml } from "@tmcw/togeojson";
3
3
 
4
4
  const layers = (source) => [
5
5
  {
6
- id: `${source}-geojson-fill`,
6
+ id: `${source}-kml-fill`,
7
7
  type: "fill",
8
8
  source,
9
9
  filter: ["==", ["geometry-type"], "Polygon"],
@@ -13,7 +13,7 @@ const layers = (source) => [
13
13
  },
14
14
  },
15
15
  {
16
- id: `${source}-geojson-fill-outline`,
16
+ id: `${source}-kml-fill-outline`,
17
17
  type: "line",
18
18
  source,
19
19
  filter: ["==", ["geometry-type"], "Polygon"],
@@ -28,7 +28,7 @@ const layers = (source) => [
28
28
  },
29
29
  },
30
30
  {
31
- id: `${source}-geojson-line-2`,
31
+ id: `${source}-kml-line`,
32
32
  type: "line",
33
33
  source,
34
34
  filter: ["==", ["geometry-type"], "LineString"],
@@ -43,7 +43,7 @@ const layers = (source) => [
43
43
  },
44
44
  },
45
45
  {
46
- id: `${source}-geojson-point`,
46
+ id: `${source}-kml-point`,
47
47
  type: "symbol",
48
48
  source,
49
49
  filter: ["==", ["geometry-type"], "Point"],
@@ -68,7 +68,7 @@ export const popupContextBuilder = ({ properties, geometry }) => {
68
68
  };
69
69
  export const layers = (source) => [
70
70
  {
71
- id: `${source}-polygons`,
71
+ id: `${source}-osm-polygons`,
72
72
  type: "fill",
73
73
  source,
74
74
  filter: ["all", ["==", ["geometry-type"], "Polygon"]],
@@ -77,7 +77,7 @@ export const layers = (source) => [
77
77
  },
78
78
  },
79
79
  {
80
- id: `${source}-polygons-stroke`,
80
+ id: `${source}-osm-polygons-stroke`,
81
81
  type: "line",
82
82
  source,
83
83
  filter: ["all", ["==", ["geometry-type"], "Polygon"]],
@@ -85,7 +85,7 @@ export const layers = (source) => [
85
85
  paint: { "line-width": 2, "line-color": "rgba(0, 51, 255, 0.6)" },
86
86
  },
87
87
  {
88
- id: `${source}-lines`,
88
+ id: `${source}-osm-lines`,
89
89
  type: "line",
90
90
  source,
91
91
  filter: ["all", ["==", ["geometry-type"], "LineString"]],
@@ -96,7 +96,7 @@ export const layers = (source) => [
96
96
  layout: { "line-join": "round", "line-cap": "round" },
97
97
  },
98
98
  {
99
- id: `${source}-points`,
99
+ id: `${source}-osm-points`,
100
100
  type: "circle",
101
101
  source,
102
102
  filter: ["all", ["==", ["geometry-type"], "Point"]],
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "6.0.1",
6
+ "version": "6.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": {
@@ -63,6 +63,7 @@
63
63
  "@trailstash/maplibre-component": "^1.0.1",
64
64
  "@turf/bbox": "^7.1.0",
65
65
  "buffer": "^6.0.3",
66
+ "csv2geojson": "^5.1.2",
66
67
  "deep-equal": "^2.2.3",
67
68
  "dompurify": "^3.1.7",
68
69
  "esbuild": "^0.24.0",