Note: this was originally a reply to https://forum.inaturalist.org/t/how-to-import-a-place-from-openstreetmap-into-inaturalist-using-qgis-and-quickosm/41014 and refers to examples from that thread.
for folks who need / want a browser-based way to do the same thing, i’ll explain the process to export a KML file for an OpenStreetMap place using Overpass Turbo, a web-based interface for the Overpass API (which is what the QuickOSM plugin also interfaces with).
Part 1
first, let’s replicate jwidness’s KML export workflow above using Overpass Turbo.
-
instead of installing QGIS and plugins, go to https://overpass-turbo.eu/ in your browser. it’ll look something like the screenshot below, with a query pane and a map pane. (if your window is wide, the panes will be side by side. if your window is tall, they will be stacked on top of each other.)
-
in the map pane, make sure your area of interest is in view. (in this case, Gertrude Street Park is a little west of Syracuse, NY, USA. so i’ll find the city and then zoom into the area a little to the west.)
-
now click the Wizard button to build your query. based on the tags from jwidness’s example’s OSM page, i’ll enter the follow query string:
name="Gertrude Street Park" and leisure=park
. (note that because the name of the park is multiple words, i encapsulated the whole name within double quotes.) -
click the build and run query button to get your results. you’ll see the generated query in the query pane and the results of the query in the map view:
-
to get the KML file, click the Export button, and then click the download button next to the KML option to save a KML file onto your machine:
-
now go through the rest of the workflow noted by jwidness above to create a place in iNat using your new KML file.
Part 2 (optional)
for those who want greater insight into the query that was generated and how to write their own queries, read on…
let’s break down the essential parts of the query that was generated in the example above:
[out:json][timeout:25];
(
node["name"="Gertrude Street Park"]["leisure"="park"]({{bbox}});
way["name"="Gertrude Street Park"]["leisure"="park"]({{bbox}});
relation["name"="Gertrude Street Park"]["leisure"="park"]({{bbox}});
);
out body;
>;
out skel qt;
[out:json]
tells the Overpass API to return data in JSON format. if you’re just interested in exporting a KML file, it doesn’t matter what format the data are returned in, and you don’t need this. (if you leave this out of your query, you’ll get results in XML by default instead of JSON.)
[timeout:25]
tells the Overpass API to stop executing if nothing was returned within 25 seconds. this is just to handle cases where your query returns too much stuff or there’s some kind of server error or connection error. as long as your query conditions are restrictive enough, you don’t really need it.
the main body of the query is looking for nodes, ways, and relations that match our search terms (["name"="Gertrude Street Park"]["leisure"="park"]
) and which fall within the view of the map (({{bbox}})
). (if you want to search for items regardless of whether they fall in the map view, then you can drop ({{bbox}})
at the end of each line.)
generally, the places that we’ll be interested in importing to iNaturalist will be defined as either ways or relations in OSM. so you don’t really need the command to find nodes. and, actually, in this case, you knew from the OSM page that Gertrude Street Park was defined as a way. so you could get the geometry for the park by searching for only ways: way["name"="Gertrude Street Park"]["leisure"="park"]
.
an alternative to searching for features by tags is to search by id. in this case, since you knew the id of the way from you OSM page, you could use the following query syntax: way(920182659);
.
note that you could get multiple ways by id using either of the following syntaxes:
-
(way(920182659);way(560355886););
(note the outer parentheses used to union the two search results) -
way(id:920182659,560355886);
(note theid:
preceding the id numbers)
the last three lines tell the API to get the results (out body
), recurse down through each feature to get the nodes (>
), and then return the simplified result (out skel qt
). out body
can be simplified as out
, and the qt
option can be ignored (although leaving it may improve speed).
…
putting all this together, the most basic query you would need to get Gertrude Street Park would be this:
way(920182659);
out;
>;
out skel;
or (since there’s only one way in OSM with this name):
way["name"="Gertrude Street Park"];
out;
>;
out skel;
if you copy and paste either of the queries above into the Overpass Turbo query window and click Run, you should get the same result as using the Wizard in Part 1 above. note that if the place is found outside of the map view, you can zoom to it on the map by clicking the button that looks like a magnifying glass in the map pane:
…
you can find more about the Overpass Query Language by clicking the Help button at the top of the Overpass Turbo page, or go directly to: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL.