@trailstash/ultra 3.9.1 → 4.0.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) {
@@ -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/lib/queryMap.js CHANGED
@@ -45,7 +45,7 @@ export const handleMouseClick = (
45
45
  for (const f of features) {
46
46
  distinctFeatures[f.id] = f;
47
47
  }
48
- if (equal(currentFeatures, distinctFeatures) && currentPopup) {
48
+ if (equal(currentFeatures, distinctFeatures) && currentPopup && e.type !== "click") {
49
49
  currentPopup.setLngLat(e.lngLat);
50
50
  return;
51
51
  }
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.1",
6
+ "version": "4.0.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": {
@@ -68,7 +68,7 @@
68
68
  "liquidjs": "^10.17.0",
69
69
  "lodash.pick": "^4.4.0",
70
70
  "lz-string": "^1.5.0",
71
- "maplibre-gl": "^4.7.1",
71
+ "maplibre-gl": "^5.0.1",
72
72
  "marked": "^14.1.2",
73
73
  "normalize.css": "^8.0.1",
74
74
  "osmtogeojson": "^3.0.0-beta.5",
@@ -77,7 +77,7 @@
77
77
  "yaml": "^2.5.1"
78
78
  },
79
79
  "peerDependencies": {
80
- "@maplibre/maplibre-gl-style-spec": "20.x"
80
+ "@maplibre/maplibre-gl-style-spec": "*"
81
81
  },
82
82
  "bin": {
83
83
  "ultra": "./bin/run.js"