-- Leo's gemini proxy

-- Connecting to siiky.srht.site:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Overpass

siiky

2022/03/26

2022/12/28

en


Overpass is an interface used to query OSM data. Overpass Turbo is an Overpass web client you can use to query OSM data, export it, &c.


Overpass Turbo

Overpass Turbo (OSM Wiki)

Overpass Query Language

Overpass API


Useful Queries


This is a list of useful queries I've learned over time.


Features last modified by an user


Nodes, ways, or relations last modified by "user name":


nwr(user:"user name")({{bbox}});
out body;

Features modified between two dates


Node, way, or relation amenities modified between 2022-02-04T00:00:00Z and "to-date":


// to-date is optional and defaults to now
[diff:"2022-02-04T00:00:00Z","to-date"];
nwr["amenity"]({{bbox}});
out body;

Features around other features


Picnic sites within a 1km radius of restaurants with takeaway:


node[amenity=restaurant][takeaway=yes]({{bbox}});
node(around:1000)[tourism=picnic_site];
out body;

Features inside some area object


Libraries in Portugal:


nwr["amenity"="library"](area:3600295480);
out body;

// Or:

area(3600295480)->.searchArea;
(nwr["amenity"="library"](area.searchArea););
out body;
>;
out skel qt;

I don't understand the difference between the two yet, but the latter is supposed to be more correct. All I know is that >; makes the query recursive (whatever that means).


Found on StackOverflow an explanation of the area:XXX:


> If the polygon you want to query inside of is an OSM feature, you can also query using an area ID.

>

> Area IDs are generated by the Overpass server to make querying data within existing polygons easier. You can determine the area ID for a way by adding 2400000000 to the way ID and the area ID for a relation by adding 3600000000 to the relation ID (assuming that the way or relation is a valid area feature).


https://stackoverflow.com/a/65982945


I found Portugal's relation object, which is the relation 295480, and 3600000000+295480=3600295480.


https://www.openstreetmap.org/relation/295480


Color-coding OSM data by age


Based on this diary entry by SK53:


Colour-coding OSM data by age in OverpassTurbo


[out:json][timeout:2500];
(
  nwr["highway"]({{bbox}});
  nwr["building"]({{bbox}});
);
(._;>;);
out meta;

{{style:

node {
  color: #00000000;
  fill-color: #00000000;
}

way[@timestamp=~/2022.*/] {
  color: #313695;
  fill-color: #313695;
}
way[@timestamp=~/2021.*/] {
  color: #4575B4;
  fill-color: #4575B4;
}
way[@timestamp=~/2020.*/] {
  color: #74ADD1;
  fill-color: #74ADD1;
}
way[@timestamp=~/2019.*/] {
  color: #ABD9E9;
  fill-color: #ABD9E9;
}
way[@timestamp=~/2018.*/] {
  color: #E0F3F8;
  fill-color #E0F3F8;
}
way[@timestamp=~/2017.*/] {
  color: #FFFFBF;
  fill-color: #FFFFBF;
}
way[@timestamp=~/2016.*/] {
  color: #FEE090;
  fill-color: #FEE090;
}
way[@timestamp=~/2015.*/] {
  color: #FDAE61;
  fill-color: #FDAE61;
}
way[@timestamp=~/2014.*/] {
  color: #F46D43;
  fill-color: #F46D43;
}
way[@timestamp=~/2013.*/] {
  color: #D73027;
  fill-color: #D73027;
}
way[@timestamp=~/2012.*/] {
  color: #A50026;
  fill-color: #A50026;
}
way[@timestamp=~/2011.*/] {
  color: #A50026;
  fill-color: #A50026;
}
way[@timestamp=~/2010.*/] {
  color: #A50026;
  fill-color: #A50026;
}
way[@timestamp=~/200.*/] {
  color: #A50026;
  fill-color: #A50026;
}
}}

-- Response ended

-- Page fetched on Mon May 13 04:02:52 2024