Template:OTUP/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

This is a documentation subpage for Template:OTUP.
It contains usage information, categories and other content or metadata that is not part of the original template.

Overpass Turbo Ultra Postpass

Usage

  • Highlights all syntax (Overpass QL, Postpass, MapCSS, YAML)
  • Links with usable parts into both Turbo (no YAML) and Ultra (no OT settings)
  • Has titles
  • Collapsible
  • Features most syntaxhighlight capabilities
    • Has a copy button
    • Number lines
    • Highlight lines
    • Link to lines

Notes

  • Some parts have to be converted yourself
    • Some settings (eg data:sql ) vs type: postpass  ; or you can add both parts, which will be converted to use only the service-appropriate one correctly)
    • Shortcuts (eg bbox vs wsen )
  • Single-line view has code preview on hover
    • No copy button
    • Some encoding are wrong

Syntax

loc works the same. endpoint is unified into server for convenience.

Parameters

Examples

Overpass only

{{OTUP|id=simpleexample|
Overpass=
[out:json][timeout:25];
{{((}}geocodeArea:Iceland{{))}}->.searchArea;
nwr["natural"="glacier"](area.searchArea);
out geom;
}}
[[#simpleexample_B-2|Jump to and highlight line 2 of part B (Overpass/Postpass)]]
try it yourself in overpass-turbo Load query in Overpass Ultra Query
[out:json][timeout:25];
{{geocodeArea:Iceland}}->.searchArea;
nwr["natural"="glacier"](area.searchArea);
out geom;

Jump to and highlight line 2 of part B (Overpass/Postpass)

{{OTUP|mode=inline|
Overpass=
[out:json][timeout:25];
{{((}}geocodeArea:Iceland{{))}}->.searchArea;
nwr["natural"="glacier"](area.searchArea);
out geom;
}}

Querytry it yourself in overpass-turbo Load query in Overpass Ultra

Cross-service setting workaround

{{OTUP|title=Hulls, projections, buffers
|Turbo={{((}}data:sql,server=https://postpass.geofabrik.de/api/{{))}}
|YAML=
---
type: postpass
---
|Postpass=
WITH London AS
(
  SELECT osm_id, osm_type, tags, ST_ConvexHull(geom) AS geom
  FROM postpass_line
  WHERE 
  "osm_type"='R' AND "osm_id" IN ('106164', '3929584')
)
SELECT stations.osm_id, stations.osm_type, stations.tags, ST_Transform(ST_Buffer(ST_Transform(stations.geom,27700),805.67),4326)
FROM postpass_pointpolygon AS stations, London
WHERE
  ST_Intersects(stations.geom,London.geom) AND
  stations.tags->>'railway'='station'
|caption=Needs to be projected to get the distance correct (otherwise gets an ellipse from different lat and lon lengths), then reprojected back to be displayed in the tool. Some impreciseness along the M25 border from how convex hulls work.
}}


try it yourself in overpass-turbo Load query in Overpass Ultra Hulls, projections, buffers
---
type: postpass
---
{{data:sql,server=https://postpass.geofabrik.de/api/}}
WITH London AS
(
  SELECT osm_id, osm_type, tags, ST_ConvexHull(geom) AS geom
  FROM postpass_line
  WHERE 
  "osm_type"='R' AND "osm_id" IN ('106164', '3929584')
)
SELECT stations.osm_id, stations.osm_type, stations.tags, ST_Transform(ST_Buffer(ST_Transform(stations.geom,27700),805.67),4326)
FROM postpass_pointpolygon AS stations, London
WHERE
  ST_Intersects(stations.geom,London.geom) AND
  stations.tags->>'railway'='station'

Needs to be projected to get the distance correct (otherwise gets an ellipse from different lat and lon lengths), then reprojected back to be displayed in the tool. Some impreciseness along the M25 border from how convex hulls work.

Overpass Turbo Turbo

{{OTUP|mode=collapsed|caption=Now you see me?|
Turbo=
{{((}}style:
node, way, relation 
{{(}}
  text: eval("tag('name') . ' (' . tag('wikidata') . ')'");
{{)}}
{{))}}
|
Overpass=
[out:json][timeout:25];
{{((}}geocodeArea:Iceland{{))}}->.searchArea;
nwr["natural"="glacier"](area.searchArea);
out geom;
}}
try it yourself in overpass-turbo Load query in Overpass Ultra Query
{{style:
node, way, relation 
{
  text: eval("tag('name') . ' (' . tag('wikidata') . ')'");
}
}}
[out:json][timeout:25];
{{geocodeArea:Iceland}}->.searchArea;
nwr["natural"="glacier"](area.searchArea);
out geom;

Now you see me?

Querytry it yourself in overpass-turbo Load query in Overpass Ultra

Overpass Ultra MapLibre YAML Postpass

{{OTUP|title=Representative points|highlightpart=YAML|highlightlines=6-8,14|
YAML=
---
type: postpass
style:  
  layers:
    - type: fill
      filter: [==, [get, osm_type], W]
      fill-color: gray
      fill-opacity: 0.5
    - type: fill
      filter: [==, [get, osm_type], R]
      fill-color: black
      fill-opacity: 0.5
    - type: line
      filter: [==, [geometry-type], LineString]
      line-width: 10
---
|
Postpass=
SELECT osm_type, osm_id, tags, ST_Collect(ARRAY[geom, ST_MakeLine(ARRAY[ST_Centroid(geom), ST_PointOnSurface(geom), (MIC).center]::geometry[]), ST_Buffer((MIC).center,(MIC).radius)])
  FROM
  (
    SELECT osm_type, osm_id, tags, geom, ST_MaximumInscribedCircle(geom) AS MIC
      FROM postpass_pointpolygon
      WHERE 
        geom && ST_MakeEnvelope({{((}}wsen{{))}},4326) AND 
        tags->>'landuse'='residential' AND tags->>'residential'='apartments' 
  ) 
}}
try it yourself in overpass-turbo Load query in Overpass Ultra Representative points
---
type: postpass
style:  
  layers:
    - type: fill
      filter: [==, [get, osm_type], W]
      fill-color: gray
      fill-opacity: 0.5
    - type: fill
      filter: [==, [get, osm_type], R]
      fill-color: black
      fill-opacity: 0.5
    - type: line
      filter: [==, [geometry-type], LineString]
      line-width: 10
---
SELECT osm_type, osm_id, tags, ST_Collect(ARRAY[geom, ST_MakeLine(ARRAY[ST_Centroid(geom), ST_PointOnSurface(geom), (MIC).center]::geometry[]), ST_Buffer((MIC).center,(MIC).radius)])
  FROM
  (
    SELECT osm_type, osm_id, tags, geom, ST_MaximumInscribedCircle(geom) AS MIC
      FROM postpass_pointpolygon
      WHERE 
        geom && ST_MakeEnvelope({{wsen}},4326) AND 
        tags->>'landuse'='residential' AND tags->>'residential'='apartments' 
  )

Representative pointstry it yourself in overpass-turbo Load query in Overpass Ultra

See also

  • {{[[Template:|]]}}