openstreetmap overpass api and osmosis to get beach data not getting polygons - openstreetmap

I tried to collect beach data in a certain region. I used both overpass api and osmosis to extract beach from a pbf. Both worked. But from overpass api, i can get beach polygons (closed ways) and points (nodes), however, from osmosis, I can just get points (nodes). When I search in osmosis, I did include the ways and relations. Still, I didn't get beach polygons as i got from overpass.
Anyone may have some solutions or explanation? Many thanks!

Unfortunately osmosis doesn't support using --node-key-value and --way-key-value together. You have to make multiple runs and then use --merge to merge the results. See https://wiki.openstreetmap.org/wiki/Osmosis for examples.

Related

Is there a way to look at all OSM tags in one geographical location?

I would like to filter locations by a specific OSM tag but I am not sure what OSM tags exist to describe this location. It consists of places where aggregate (sand, gravel) is stored. I looked at tagFinder and taginfo listed here https://wiki.openstreetmap.org/wiki/Tags
Basically I know which geographical point I want to look at and I want to know how OSM tags that place. I will then use overpass turbo to create the query.
Thanks in advance for your help.
EDIT: I have found a solution but there are no features/tags for aggregates and gravel industries. Is there another data source where I could find such information, preferably worldwide? Something like OSM tags?
I have found that you can query features, by right-clicking on the button with the arrow and question mark, then clicking on a place and select "query features".
https://www.openstreetmap.org/
It will return nearby features and enclosing features in the panel on the left.

How to clean up *.osm.pbf files (Removing unwanted nodes, relationships, ways) with osmosis or osmium

I've recently began to dig deeper into manipulation raw osm data and later convert them to *.mbtiles to serve vector tiles to my web application. As the map only needs to be of low detail (is mainly used for displaying aviation data), I don't need buildings but want to keep some details (parks, airports, waterways etc. for aesthetic reasons).
So far I've tried using osmium and osmosis with okayish results. It still takes forever processing just one country (I'd need the whole of europe for now).
Removing buildings in osmosis produces a smaller file than in osmium? Probably my settings are wrong. Maybe there's even an other tool which might be better for the job?
Can you please point me in the right direction? I think having streets, water, airports placelabels and parks/forests present would be sufficient for now.
So far I've tried it with the commands below which still takes forever to import with openmaptiler in a c4.large instance on aws.
osmosis --read-pbf germany.osm.pbf --tf reject-ways building=* --used-node --write-pbf germany-wo-buildings.osm.pbf
My second approach was using osmium
osmium tags-filter -i germany.osm.pbf nrw/building=* -o germany-wo-buildingsg.osm.pbf
I'd really appreciate some help here to get a better understanding of working with osm data.
Thanks a lot!

How to plot a JSON file generated by osrm for route optimization into an OSM map

I am a complete newbie to computation of gps, gis and all these geoinformatical stuff. First I describe my lessons learned to arrive at gps data. You can skip this and go to the last two paragraphs where I explain my problem with osrm and how to map a route onto an OSM map via qgis or similar tools.
I tried to do some route optimization for a bunch of addresses to support my son's paper deliverer job. I was able to generate a list of gps data by using the Nomatim engine that is available via geopy.geocoders. It's kind of a Travelling Salesman problem (TSP).
By using geopy's distance calculator and the or-tools from Google to Generate a shortest list recommendation. That worked well but it was only a TSP solution for air line :-(.
Then I was looking for route optimization toolkits but i struggled to get one for free. I thought osrm could be the right tool. I followed the descriptions given at Github, see here. I was able to generate a JSON file - at least I supposed that it's kind of a JSON file. But I was unable to project this back onto a map in QGis or any online tool from OSM. Can anyone help me?
The file with such JSON-like formatting:
{"code":"Ok","waypoints":[{"hint":"Jh4BgEUzI4BhAAAACwAAAKIAAABZAAAAkLAjQgpyikBay4dCWsuHQmEAAAALAAAAogAAAFkAAAArAAAAxwB4AARI3AI3AXgAWEbcAgIADwXVhXd1","location":...
Due to privacy issues I cannot post it here with any locations. Sorry for this. But does anyone have kind of a recipe / step-by-step guide what I need to do to plot it? I even have no idea how to "open" a map within qgis. You need to do this as kind of a database but this is totally new for me. I would prefer to work with an easier method to plot it.
Thanks in advance for any help.
Please follow the API documentation here. From that documentation
hint Unique internal identifier of the segment (ephemeral, not
constant over data updates) This can be used on subsequent request to
significantly speed up the query and to connect multiple services.
E.g. you can use the hint value obtained by the nearest query as hint
values for route inputs.
You can get the geometry in many ways. Widely GeoJSON is being used by developers. OSRM returns a very clean GeoJSON which can easily be used with Leaflet, Mapbox or other Map APIs. You need to send steps parameter true to get the full step by step direction. You can get the each segments of steps in legs. So call the GeoJSON within the geometries of every legs with loop. You can also get the geometry without passing the steps parameter true. For that you will get full geometry in a single GeoJSON within the routes property.

How can i find certain types of buildings in OpenStreetMap?

i'm trying to make a list of all the police stations that are in OpenStreetMap.org so i can compare it with mine (a full one with all the police stations in the country) and add the ones that are not there. at the moment i'm doing it one by one, searching from my list and if it is not in the map i add it. but i want to now if there is a way to make the map show me all the police stations that are in a country or a region. if someone who knows about OSM could help me that would be great
To find the policestations you can use e.g. OverPass-API (I recommend TURBO). The more complex way is to use the planet.osm dump / extracts and process it using filterers (e.g. osmosis). Last one is more complex, but allows you to controll the area more precise.
Please be aware that building is the wrong feature. Some mappers prefer to map the amenity / usage as a seperate POI and some policestations are mapped as are for the whole site of the station. Be also aware that the community is skeptical about imports and quality of external datasets.
You can use e.g. Overpass to query OpenStreetMap for features. Here is the query that you need to retrieve all police stations.
/*
This has been generated by the overpass-turbo wizard.
The original search was:
“amenity=police”
*/
[out:json][timeout:25];
// gather results
(
// query part for: “amenity=police”
node["amenity"="police"]({{bbox}});
way["amenity"="police"]({{bbox}});
relation["amenity"="police"]({{bbox}});
);
// print results
out body;
>;
out skel qt;
You can run the query with Overpass Turbo, here. First position the map over the area you are interested in, then press "Run".
You can use any of the export options to download the results, instead of viewing them on the map
I forgot to mention that a police station is not really a building type in OpenStreetMap, it is considered an amenity. More information about the correct tagging can be found on the OpenStreetMap wiki, but this system does not allow me to post more links to help you further.

Get all information about a street in OpenStreetMap

I've been playing around with API, XAPI and Overpass of OSM. But I can not get some info a need: to get all information nodes of a street.
Here a example:
http://www.openstreetmap.org/browse/way/5671291
This gives information of a way called "Watts Street" (in NYC), but it's not all the street, just a part of it.
The other part:
http://www.openstreetmap.org/browse/way/46116390
This happens with some streets, that are split in different OSM "ways"
Is there a way to get all the nodes of a same street having more than "one way" to get all the coordinates across that street ?
Thank you
You could try to query the street name and get all ways with the same name. Then you could take all individual nodes and you should have what you want. I know Nominatim does that mapping but I'm not familiar with the api's you mentioned.
Another (maybe more cumbersome) method is to look at the nodes of your way and see in what ways they are involved. If you take your example, the node 42426060 is part of both ways you're looking for. If you could query the ways for that node and match them (according to name), you could merge them yourself.