Get practical maxspeed for openstreetmap - openstreetmap

I'm trying to get the practical maxspeed for all ways in a bounding box:
Documentation for maxspeed practical:
https://taginfo.openstreetmap.org/keys/maxspeed%3Apractical#overview
https://wiki.openstreetmap.org/wiki/Key:maxspeed:practical
res = api.query("""
way[highway](around:500,52.52,13.40)["maxspeed"]
;(._;>;);
out meta;
""")
replacing ["maxspeed"] with ["maxspeed:practical"] doesn't seem to work.
What am I missing?

replacing ["maxspeed"] with ["maxspeed:practical"] doesn't seem to
work. What am I missing?
Nothing is wrong with your query. The roads in your area just don't have a maxspeed:practical tag. See this example where maxspeed:practical tags are present.
Currently there are over 11 million ways in OSM with a maxspeed tag but only 22 thousand are tagged with maxspeed:practical. Many of them don't need this tag since their practical speed limit is probably above the legal limit. For others this tag just hasn't been added yet.
OpenStreetMap is mainly improved by volunteers. Feel free to join and add this information yourself.

Related

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 to break up large document into smaller answer units on Retrieve and Rank?

I am still very new to Retrieve and Rank, and Document Conversion services, so I have been playing around with that lately.
I encountered a problem where when I upload a large document (100+ pages) - Retrieve and Rank would help me automatically break it up into answer units, which is great and helpful.
However, some questions only require ONE small line in the big chunks of answer units, is there a way that I can manually break further down the answer units that Retrieve and Rank service has provided me?
I heard that you can do it through JavaScript, but is there a way to do it through the UI?
I am contemplating to manually break up the huge doc into multiple smaller documents, but that could potentially lead to 100s of them - which is probably the last option that I'd resort to.
Any help or suggestions is greatly appreciated!
Thank you all!
First off, one clarification:
Retrieve and Rank does not break up your documents into answer units. That is something that the Document Conversion Service does when your conversion target is ANSWER_UNITS.
Regarding your question:
I don't fully understand exactly what you're trying to do, but if the answer units that are produced by default don't meet your requirements, you can customize different steps of the conversion process to adjust the produced answer units. Take a look at the documentation here.
Specifically, you want to make sure that the heading levels (for Word, PDF or HTML, depending on your document type) are defined in a way that
they detect the start of each answer unit. Then, make sure that the heading levels that you defined (h1, h2, h3, etc.) are included in the selector_tags list within the answer_units section.
Once your custom Document Conversion Service configuration produces the answer units you are looking for, you will be ready to send them to Retrieve and Rank to be indexed.

Get administrative borders with Overpass QL

I try to download the state borders of France (a few dozen states, not big data). Indeed I look for borders I can upload in my postgres database to localize POIs. OpenstreetMap seemed to be the good data source so I have tried to learn Overpass QL but it seems harder than I thought to do so... After some wiki reading I came to this:
way["name:en"="France"];
way["type"="boundary"];
way["boundary"="administrative"];
way["admin_level"="4"];
But the query endless runs... I am not sure about the query I made, is this the good syntax ? Thanks
There are several issues with your query:
Administrative boundaries are frequently modeled as relations, rather than ways in OSM. So querying for ways way[...] will not return the result you're looking for.
To fetch elements which have have several tags, you need to combine them like [key1=value1][key2=value2]. You current query would query ALL ways WORLDWIDE with type=boundary and then again WORLDWIDE all ways with admin_level=4. Obviously this is both very expensive and not what you're looking for.
out statement is mandatory to return some result. In your case, the query would in fact run, but it would never return anything.
My recommendation is to use the following query instead:
rel["ISO3166-2"~"^FR"]
[admin_level=4]
[type=boundary]
[boundary=administrative];
out geom;
Try it in overpass turbo: http://overpass-turbo.eu/s/lnv

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.

How to get nearby locations from latitude/longitude?

I have store various latitude and longitude in database(Sqlite3) for various location. Now I have current latitude and longitude. How can I know nearest locations from current position.
Please suggest.
I assume you're talking about Reverse Geocoding. There's an Apple class provided for that, MKReverseGeocoder. There are also plenty of how-to discussions about that, such as here, here, etc.
The syntax will likely need to change, but take a look at this question that uses MySQL. Essentially you want to create a rectangle with the current point at the center (most likely). Using the bounds of this new box, you can run your SQL query.
I dare say #Kongress answer is the best here - but I'm just going to chuck this one into the ring as the concept itself is one that I've dealt with before.
I can't tell you how to build one in objective-c, but for our lat/long reverse lookup I built a K-DTree from the lat longs in our database ( > 250,000) and it gives us sub-100-nanosecond lookups on desktop hardware. On an iphone it's still likely to be pretty fast - memory might be a concern though as you really need to be able to cache the instance in memory, to be really useful; it takes a little while to build it (ours builds in about 1.5 seconds).
Just an idea.