@trailstash/ultra 4.2.3 → 4.2.5
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/Examples/postpass.ultra +4 -3
- package/docs/yaml.md +7 -0
- package/lib/queryProviders/postpass.js +10 -23
- package/mkdocs.yml +4 -0
- package/package.json +1 -1
package/Examples/postpass.ultra
CHANGED
|
@@ -6,6 +6,7 @@ options:
|
|
|
6
6
|
zoom: 15
|
|
7
7
|
type: postpass
|
|
8
8
|
---
|
|
9
|
-
SELECT osm_id,
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
SELECT osm_id, osm_type, tags, geom
|
|
10
|
+
FROM postpass_point
|
|
11
|
+
WHERE tags->>'amenity'='fast_food'
|
|
12
|
+
AND geom && ST_MakeEnvelope({{wsen}},4326)
|
package/docs/yaml.md
CHANGED
|
@@ -254,6 +254,13 @@ Detected if
|
|
|
254
254
|
An SQL query to be executed on a [Postpass](https://github.com/woodpeck/postpass) server. Server
|
|
255
255
|
results are modified to have the same structure as [overpass](#overpass)
|
|
256
256
|
|
|
257
|
+
!!! warning
|
|
258
|
+
|
|
259
|
+
Postpass is in very early stages of development, so Ultra may lag behind as new versions of the
|
|
260
|
+
API are released. This provider defaults to the version 0.2 of the [GeoFabrik Postpass
|
|
261
|
+
API](https://github.com/woodpeck/postpass-ops) &
|
|
262
|
+
[Schema](https://github.com/woodpeck/postpass-ops/blob/main/SCHEMA.md)
|
|
263
|
+
|
|
257
264
|
## `options`
|
|
258
265
|
|
|
259
266
|
When an Ultra query is run in "interactive map" mode, you can specify the
|
|
@@ -3,38 +3,25 @@ import { setQueryBounds } from "../bounds.js";
|
|
|
3
3
|
|
|
4
4
|
import { layers, popupTemplate, popupContextBuilder } from "./osm.js";
|
|
5
5
|
|
|
6
|
-
const nonTags = {
|
|
7
|
-
osm_id: true,
|
|
8
|
-
tags: true,
|
|
9
|
-
way_area: true,
|
|
10
|
-
z_order: true,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
6
|
const flattenPropertiesAndInferIdAndType = (geoJSON) => {
|
|
14
7
|
// prety major assumption basked into this as Postpass executes arbitrary SQL so the returned
|
|
15
8
|
// data could be anything. This assumes that the query returns un-renamed columns.
|
|
16
|
-
geoJSON.features = geoJSON.features.map((
|
|
9
|
+
geoJSON.features = geoJSON.features.map((f) => {
|
|
17
10
|
const properties = {};
|
|
18
|
-
if (
|
|
19
|
-
properties["@
|
|
20
|
-
properties["@
|
|
21
|
-
if (properties["@id"] < 0) {
|
|
22
|
-
properties["@id"] = -properties["@id"];
|
|
23
|
-
properties["@type"] = "relation";
|
|
24
|
-
}
|
|
11
|
+
if (f.properties.osm_id) {
|
|
12
|
+
properties["@id"] = f.properties.osm_id;
|
|
13
|
+
properties["@type"] = f.properties.osm_type;
|
|
25
14
|
}
|
|
26
|
-
if (
|
|
27
|
-
for (const [k, v] of Object.entries(
|
|
15
|
+
if (f.properties.tags) {
|
|
16
|
+
for (const [k, v] of Object.entries(f.properties.tags)) {
|
|
28
17
|
properties[k] = v;
|
|
29
18
|
}
|
|
30
19
|
}
|
|
31
|
-
for (const [
|
|
32
|
-
|
|
33
|
-
properties.tags[key] = value;
|
|
34
|
-
}
|
|
20
|
+
for (const [k, v] of Object.entries(f.properties)) {
|
|
21
|
+
properties[k] = v;
|
|
35
22
|
}
|
|
36
23
|
return {
|
|
37
|
-
...
|
|
24
|
+
...f,
|
|
38
25
|
properties,
|
|
39
26
|
};
|
|
40
27
|
});
|
|
@@ -44,7 +31,7 @@ const flattenPropertiesAndInferIdAndType = (geoJSON) => {
|
|
|
44
31
|
const postpass = {
|
|
45
32
|
source: async function (query, controller, { server, bounds }) {
|
|
46
33
|
if (!server) {
|
|
47
|
-
server = "https://postpass.geofabrik.de/api/0.
|
|
34
|
+
server = "https://postpass.geofabrik.de/api/0.2/interpreter";
|
|
48
35
|
}
|
|
49
36
|
const resp = await fetch(server, {
|
|
50
37
|
method: "POST",
|
package/mkdocs.yml
CHANGED
package/package.json
CHANGED