User:Sarchittuorg/Query

From OpenStreetMap Wiki
Jump to navigation Jump to search

All municipalities in region

[out:json][timeout:25];
{{geocodeArea:Sardinia}}->.searchArea;
(rel(area.searchArea)->.relations);
(node(r.relations:"admin_centre"));
out meta;

For csv instead of [out:json] use [out:csv(::id,"name",::lat,::lon;true)]

Find nuraghe without correct schema

<osm-script output="xml">
  <union>
    <query type="node">
      <has-kv k="name" regv="[Nn]uraghe"/>
      <has-kv k="name" modv="not" regv="Tresnuraghes"/>
      <has-kv k="megalith_type" modv="not" regv="."/>
      <has-kv k="amenity" modv="not" regv="."/>
      <has-kv k="highway" modv="not" regv="."/>
      <has-kv k="place" modv="not" regv="hamlet"/>
      <bbox-query {{bbox}}/>
    </query>
    <query type="way">
      <has-kv k="name" regv="[Nn]uraghe"/>
      <has-kv k="megalith_type" modv="not" regv="."/>
      <has-kv k="name" modv="not" regv="Tresnuraghes"/>
      <has-kv k="amenity" modv="not" regv="."/>
      <has-kv k="highway" modv="not" regv="."/>
      <has-kv k="place" modv="not" regv="hamlet"/>      
      <bbox-query {{bbox}}/>
    </query>
    <query type="relation">
      <has-kv k="name" regv="[Nn]uraghe"/>
      <has-kv k="name" modv="not" regv="Tresnuraghes"/>
      <has-kv k="megalith_type" modv="not" regv="."/>
      <has-kv k="amenity" modv="not" regv="."/>
      <has-kv k="highway" modv="not" regv="."/>
      <has-kv k="place" modv="not" regv="hamlet"/>      
      <bbox-query {{bbox}}/>
    </query>
  </union>
  <print mode="meta"/>
  <recurse type="down"/>
  <print mode="meta"/>
</osm-script>

A cui applico

historic=archaeological_site
site_type=megalith
megalith_type=nuraghe
historic:civilization=nuragic
historic:period=nuragic

Entrance with housenumber

{{mArea=Genova}}

[timeout:600];
area["name"="{{mArea}}"];
(  
  node    (area)    
  ["barrier"="entrance"] ["addr:housenumber"];
);
(  ._;  >;);out meta qt;

Entrance on building

(
  node
    ["barrier"="entrance"]
    ({{bbox}})
)->.a;
.a < ->.b;
 way.b["building"]-> .c;

.c > ->.d;
node.d["barrier"="entrance"]-> .e;

(._;>;);

.e out;

Ferries

{{value=}}
{{mArea=Italia}}

[timeout:600];
area["name"="{{mArea}}"];
(  way    (area)     ["route"="ferry"] ["duration"!~"."] ;
   node    (area)     ["route"="ferry"] ["duration"!~"."] ;
   relation    (area) ["route"="ferry"]  ["duration"!~"."] ;
);
(  ._;  >;);out meta qt;
{{key=name}}

Botteghe storiche

  <union>
    <query type="node">
      <has-kv k="historic" v="yes"/>
      <has-kv k="shop"/>
      <bbox-query {{bbox}}/>
    </query>
    <query type="node">
      <has-kv k="historic" v="yes"/>
      <has-kv k="amenity"/>
      <bbox-query {{bbox}}/>
    </query>
  </union>
  <print mode="body"/>
  <recurse type="down"/>
  <print mode="skeleton"/>
</osm-script>

Search places by population

Wizard regex

population~/[1-9][0-9]{2,}/

First figure must be greater than zero, then the next figures can be 0<x<9 (from 0 occurrences and beyond). In this case search for population greater than 100.