Osmosis - get all Nodes/Ways/Relations with the same tags
<p>I want to get all nodes, ways and relations containing certain tags and the output file must also contain the dependent ways and nodes. </p>

<p>So for example I want to search for all relations with amenities and get not only the relations itself but also the dependent ways and nodes. Same for all ways with the same tags and their related nodes and finally all nodes. </p>

<p>Currently I found a working solution but this script takes a long time to process because it effectively reads the world map file 3 times and merges the data afterwards. <strong>I hope someone could point me to a more "straightforward" solution to increase speed</strong>. </p>

<p>btw. I have set the java options to "-Xmx14G -server" but the script only uses 8G of memory (the machine has 32G RAM) according to the task manager (Windows - sorry folks ;-) )</p>

<p>So this is the script:</p>

<pre><code>set readfile=--read-pbf-fast file=planet-latest.osm.pbf workers=4
set logprogress=--log-progress interval=10

set acceptlorestags=^
place=country,state,region,province,district,county,municipality,island,islet ^
natural=sea,water,wetland,beach,coastline,marsh ^
admin_level=1,2,3,4 ^
water=* ^
wetland=*

call bin\osmosis.bat ^
%readfile% ^
--tf accept-relations ^
%acceptlorestags% ^
--used-way ^
--used-node ^
%logprogress% label="lores_rel" ^
 ^
%readfile% ^
--tf reject-relations ^
--tf accept-ways ^
%acceptlorestags% ^
--used-node ^
%logprogress% label="lores_way" ^
 ^
%readfile% ^
--tf reject-relations ^
--tf reject-ways ^
--tf accept-nodes ^
%acceptlorestags% ^
%logprogress% label="lores_node" ^
 ^
--merge ^
--merge ^
%logprogress% label="map_lores" ^
--mapfile-writer file=map_lores.map type=ram
</code></pre>