## QuickOSM

QuickOSM allows you to get quickly with OSM datas in QGIS thanks to Overpass API.

- Write some queries for you by providing a key/value
- Choose to run the query on an area or an extent
- Configure the query : which layers, which columns ...
- Save your queries in categories and run them later
- Open a local OSM (.osm or .pbf) with a specific osmconf in QGIS
- Build some models with QGIS Processing

There are some usefull tips, like automatic colours on lines (if the tag is present) or some actions (right-click in the attribute table) for each entities (edit in JOSM for instance).

### Menu

- Generalities
- Overpass Turbo
- My queries
- Quick query
- Query
- OSM file
- Processing

### Generalities

The plugin will keep all columns availables in OSM's datas. You can filter the columns you want by writing col1,col2,col3 with commas.
If no styling file is defined, QuickOSM will check if a "colour" field is present in a line vector layer. This is usefull for route=bus/tram.

Some actions are enabled by default. You can open in openstreetmap.org or with JOSM each entities. Some actions may be added if some fields are presents :

- url, website
- wikipedia
- ref:UAI for French's schools
- network and ref will open the sketchline from Overpass

### Overpass Turbo

Overpass Turbo is another front-end for OverpassAPI.
Be careful with some queries which come from Overpass Turbo :

- some shortcuts are not available today in this plugin. We only support :
  - {{geocodeArea:}}
  - {{nominatimArea:}}>
  - {{center}}
  - {{geocodeCoords:}}
  - {{bbox}}
- the order in the result have to be like this : node, then way and finally relation. With the default wizard of Overpass Turbo, you may get the reverse order. Our parser, OGR, can not work with this. You have to modify the print statement at the end.

For instance, this query is good :

    					<osm-script output="xml" timeout="25">
    					     <id-query {{nominatimArea:montpellier}} into="area"/>
    					     <union>
    					          <query type="node">
    					               <has-kv k="route" v="tram"/>
    					               <area-query from="area"/>
    					          </query>
    					          <query type="way">
    					               <has-kv k="route" v="tram"/>
    					               <area-query from="area"/>
    					          </query>
    					          <query type="relation">
    					               <has-kv k="route" v="tram"/>
    					               <area-query from="area"/>
    					          </query>
    					     </union>
    					     <union>
    					          <item />
    					          <recurse type="down"/>
    					     </union>
    					     <print mode="body" />
    					</osm-script>

### My queries

"My queries" shows you all predefined queries.
A query is composed of two files in the user's folder (~/.qgis2/QuickOSM on Linux) :

- .ini with all metadata
- .xml or .oql with the query in XML or OQL

So as to add your queries, you have to go to "Query".
If you want to delete a query, you have to right-click on it.
A ini file is composed with many blocks :

- metadata
  - name : compulsory
  - category : compulsory
- points|lines|multilinestrings|multipolygons : each blocks about these layers are compulsory.
  - load : compulsory, boolean True or False. If this layer should be load.
  - nameLayer : optional, string with the name of the layer
  - columns : optional, list of columns seperated by a comma. If empty, all columns will be keep
  - style : optional, name of the QML style to apply

### Quick query

Quickquery allows you to query on one key=value. You can choose between the extent of the map canvas or in a city. The city is searched by Nominatim, you can avoid strange result by writting the relation OSM's ID.
If you check "Nominatim" but if you let the field empty, it will make a attribute query.
You can let the value empty.
You can choose which OSM objects you want to query on :

- Node
- Way
- Relation

You can choose which geometries you want at the end :

- Points
- Lines
- Multilinestrings
- Multipolygons

If you want to specify which columns you want, you must click on "Show query".

### Query

This panel allows you to write your own query manually (in XML or OQL).
For each layers provided by OGR, you can specify the outputs you want and which fields you want to get.
From this panel, you can save your query. The outputs and each whitelists will be saved.

- as template : this will save the query which is written above. The query won't be change. If you want to change the city, change it in the XML.
- as finale query : the query will be generated before. This is usefull if you don't want to save {{bbox}} but the actual extent.

For more informations about XML or OQL.

### OSM file

OGR can open an OSM file with the help of a special file configuration called osmconf. This file is used to describe each key you want for a column. You can specify these fields for each layer.
You can copy/paste the default osmconf.ini so as to modify it.
For more informations about OSM in OGR, read the documentation

### Processing

QuickOSM brings a lot of new processing algorithms. You should have a look to these algos. Some models are available in the models's folder of the plugin.
Be carefull, Processing has some bugs, particularly with version 2.2.0-2.
In processing, it's required to parse all layers (points, lines, multilinestrings and multipolygons). To improve performance on layers you don't want, you can put a single comma in the field about columns. This comma avoids a loop in the parser.
For each algorithm, some helps are provided.
Let your imagination take off with processing !