@trailstash/ultra 4.2.2 → 4.2.4

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.
@@ -6,35 +6,37 @@ import { layers, popupTemplate, popupContextBuilder } from "./osm.js";
6
6
  const nonTags = {
7
7
  osm_id: true,
8
8
  tags: true,
9
- way_area: true,
10
- z_order: true,
9
+ // yes... these are not tags... but they are useful! so we're keeping them.
10
+ // way_area: true,
11
+ // z_order: true,
11
12
  };
12
13
 
13
14
  const flattenPropertiesAndInferIdAndType = (geoJSON) => {
14
15
  // prety major assumption basked into this as Postpass executes arbitrary SQL so the returned
15
16
  // data could be anything. This assumes that the query returns un-renamed columns.
16
- geoJSON.features = geoJSON.features.map((x) => {
17
+ geoJSON.features = geoJSON.features.map((f) => {
17
18
  const properties = {};
18
- if (x.properties.osm_id) {
19
- properties["@type"] = x.geometry.type === "Point" ? "node" : "way";
20
- properties["@id"] = x.properties.osm_id;
19
+ if (f.properties.osm_id) {
20
+ properties["@id"] = f.properties.osm_id;
21
21
  if (properties["@id"] < 0) {
22
22
  properties["@id"] = -properties["@id"];
23
23
  properties["@type"] = "relation";
24
+ } else {
25
+ properties["@type"] = f.geometry.type === "Point" ? "node" : "way";
24
26
  }
25
27
  }
26
- if (x.properties.tags) {
27
- for (const [k, v] of Object.entries(x.properties.tags)) {
28
+ if (f.properties.tags) {
29
+ for (const [k, v] of Object.entries(f.properties.tags)) {
28
30
  properties[k] = v;
29
31
  }
30
32
  }
31
- for (const [key, value] of Object.entries(x.properties)) {
32
- if (!nonTags[key]) {
33
- properties.tags[key] = value;
33
+ for (const [k, v] of Object.entries(f.properties)) {
34
+ if (!nonTags[k]) {
35
+ properties[k] = v;
34
36
  }
35
37
  }
36
38
  return {
37
- ...x,
39
+ ...f,
38
40
  properties,
39
41
  };
40
42
  });
@@ -44,7 +46,7 @@ const flattenPropertiesAndInferIdAndType = (geoJSON) => {
44
46
  const postpass = {
45
47
  source: async function (query, controller, { server, bounds }) {
46
48
  if (!server) {
47
- server = "http://postpass.geofabrik.de/api/0.1/interpreter";
49
+ server = "https://postpass.geofabrik.de/api/0.1/interpreter";
48
50
  }
49
51
  const resp = await fetch(server, {
50
52
  method: "POST",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "4.2.2",
6
+ "version": "4.2.4",
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": {