User:Rtnf/Overpass Queries

From OpenStreetMap Wiki
Jump to navigation Jump to search

Filter by relation area

[timeout:180][out:csv(::id,wikidata,wikipedia,admin_level,boundary,name,"name:en";true;',')];
area(id:3600000000)->.a;
(
rel[boundary=administrative][admin_level~"^7|8|9$"](area.a);
);
out;

Overpass area ID = 3600000000 + OSM relation ID

Filter by last touched

[out:json][bbox:{{bbox}}][timeout:800];

// get objects
(
  nw[~"^demolished:.*$"~"."];
  nw[~"^razed:.*$"~"."];
  nw[~"^removed:.*$"~"."];
  nw[~"^destroyed:.*$"~"."];
)->.gone;

//subtract newly edited object
(.gone; - nwr.gone(newer:"{{date:1year}}"););
out geom;

Time machine

[date:"2021-08-02T20:53:58.000Z"];
(
  node({{bbox}});
  way({{bbox}});
  relation({{bbox}});
);
out meta;
>;
out meta qt;

Someone's contribution

nwr({{bbox}})(user_touched:"target_username");
out geom;