How can I change Nominatim's reverse geocoding behaviour? - openstreetmap

I'm conducting some tests against nominatim.openstreetmap.org, looking at reverse geocoding. Based upon my observations I have two questions:
1) Given that I'm looking at data generated from a vehicle, this request and response are unexpected:
http://nominatim.openstreetmap.org/reverse?lat=52.50676&lon=-1.99523&addressdetails=1&format=xml&zoom=18
<reversegeocode timestamp="Mon, 02 Dec 13 14:47:07 +0000" attribution="Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright" querystring="lat=52.50676&lon=-1.99523&addressdetails=1&format=xml&zoom=18">
<result place_id="9146383198" osm_type="way" osm_id="60694393" ref="CLOSED for 60 weeks from Sep 2013" lat="52.506753" lon="-1.9943365">
CLOSED for 60 weeks from Sep 2013, Londonderry, Warley, Sandwell, West Midlands, England, B70 6AS, United Kingdom
</result>
<addressparts>
<footway>CLOSED for 60 weeks from Sep 2013</footway>
<neighbourhood>Londonderry</neighbourhood>
<suburb>Warley</suburb>
<city>Sandwell</city>
<county>West Midlands</county>
<state_district>West Midlands</state_district>
<state>England</state>
<postcode>B70 6AS</postcode>
<country>United Kingdom</country>
<country_code>gb</country_code>
</addressparts>
</reversegeocode>
It seems that I need Nominatim to ignore ways with highway=footway - can I achieve this?
2) Can I ask for a reverse geocoded response to include other tag values? I have been able to find the maxspeed tag value by requesting an api lookup following the reverse geocode request, for example, http://api.openstreetmap.org/api/0.6/way/144176050. This is ok but it would be far better if I could obtain the information from a single reverse geocode call as it seems reasonable to expect to be able to obtain other tag values from Nominatim. Is this possible? I note the Extra Tags shown from the Nominatim data here: http://nominatim.openstreetmap.org/details.php?place_id=9146205970
If these things are not possible then I wonder if I could better achieve it I had my own Nominatim instance? I'm prepared to get into the Nominatim coding and make changes if necessary (but obviously need to consider the impact of the change and ensure it avoids any behavioural change for other contributors).
Thanks for any advice.
Note I also asked this question here: https://help.openstreetmap.org/questions/28695/how-can-i-change-nominatims-reverse-geocoding-behaviour

You can add the extratags parameter. According to the Nominatim Wiki:
extratags=1
Include additional information in the result if available, e.g. wikipedia link, opening hours.
Your new request would be:
http://nominatim.openstreetmap.org/reverse?lat=52.50676&lon=-1.99523&addressdetails=1&format=xml&zoom=18&extratags=1
Hope it's no too late :)

Regarding the problem 2:
The solution is to set format parameter to jsonv2. Besides, to focus on roads only set zoom to 16.
This way a response should contain "highway" by category key and osm highway tag value by type key.
Example request: https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=49.83852&lon=24.00779&zoom=16

Related

Is the data behind the current osmnames.org built using latest OSM data and latest code in github.com/OSMNames/OSMNames?

Performing fresh OSMNames extracts using latest codeset from https://github.com/OSMNames/OSMNames
often omits a level in the country/state/county/city hierarchy.
For example:
Vale of Glamorgan (in Wales, UK) is type:state_district and is defined in OSM (OSM id 103776, AdminLevel 6) as an admin boundary made up of ways and relations.
https://github.com/OSMNames/OSMNames/releases/download/v2.1.1/planet-latest_geonames.tsv.gz 2019 tsv file has Dinas Powys (OSM id 8219427, AdminLevel 10) as a town within Vale of Glamorgan.
As does the online https://osmnames.org/#q=Dinas%20Powys%2C
But an OSMNames build from latest 2021 data (https://download.geofabrik.de/europe/great-britain/wales-latest.osm.pbf) omits Vale of Glamorgan from Dinas Powys info.
If we try using older data in a Wales OSM history file - https://osm-internal.download.geofabrik.de/europe/great-britain/wales-internal.osh.pbf
Using osmium-tool to extract a data snapshot which should match the 2019 date of https://github.com/OSMNames/OSMNames/releases/download/v2.1.1/planet-latest_geonames.tsv.gz
(osmium time-filter wales-internal.osh.pbf 2019-05-13T00:00:00Z -o wales_2019.osm.pbf)
When we run the OSMNames build against this filtered file which should equal the May 2019 data, it still doesn't have Dinas Powys in Vale of Glamorgan.
So we appear to have a disparity between what was achieved in https://github.com/OSMNames/OSMNames/releases/download/v2.1.1/planet-latest_geonames.tsv.gz (generated in May 2019) and what we can reproduce using the https://github.com/OSMNames/OSMNames code
set.
Apparent conclusions:
The current online https://osmnames.org/#q=Dinas%20Powys%2C is
using OSMNames data from a few years ago, laid over current maptiles.
If so, the website should make this clear.
The https://github.com/OSMNames/OSMNames/releases/download/v2.1.1/planet-latest_geonames.tsv.gz was not built using unaltered code from the git repository.
The github site, states:
"If you are a user and have questions, we're sorry that we can't give individual support. Pls. ask support questions over at Stack Overflow", but there doesn't appear to be much activity.
Can anyone confirm my conclusions, or point me to something more recent?
As another example, the UK village of Fulletby:
In the 2019 tsv file, its display_name is "Fulletby, East Lindsey, Lincolnshire, East Midlands, England, United Kingdom".
But using latest codeset and OSM data gives a display_name of only "Fulletby, Lincolnshire, England, United Kingdom".

What are LID, LE and FW in responses of here traffic API?

I am struggling to understand the response of here API traffic flow data. I went through the documentation but it seems that there are some important missing parts there.
For instance, details on returned parameters such as "LID", "LE", "FW" and "Criticality" are missing in the documentation. Also, the difference between "Original_traffic_item_id" and "traffic_item_id" in the response from incident API is completely missing. Or what is "TPEGOpenLRBase64"?
Here are links to pages which contain an example of such responses:
https://developer.here.com/documentation/traffic/dev_guide/topics_v6.1/example-flow-location-references.html
https://www.developer.here.com/documentation/traffic/dev_guide/topics/example-incidents-tmc-restrictions.html
https://www.developer.here.com/documentation/traffic/dev_guide/topics/incident-data.html
Am I missing something? Is there any other specific documentation somewhere that I have been unable to find?
Please find the description of the element name for traffic API-
TPEGOpenLRBase64 -[Binary data]Provided if TPEGOpenLRBase64 is the location referencing type for the containing RWS.
SHP/LID - [LinkID] The linkID will be in driving direction order; “F” represents travel direction FROM reference node, “T” represents travel direction TO reference node (For example 123456789T or 987654321F).
SHP/LE -Length of stretch of road defined by SHP element. The units are defined in the file header.
SHP/FW- Form of way. Possible values are Motorway (MW), Multi-digitized road which is not a motorway(MD), single digitized road (SD), Ramp/Slip (RA), Roundabout (RO), Undefined (UN).
For more acronym check this-
https://developer.here.com/documentation/traffic/dev_guide/topics/common-acronyms.html

Retrive all districts based on city name from REST query

I've searched for solution for that problem on here-api documentation but I can't really find it out ! I'm starting doubt if this even possible.
Ok so basicly what i need to know for now:
1. Is this even possible on this platform ?
2. Using exactly which 'module' (eg. PLATFORM DATA EXTENSION,BATCH GEOCODER)
There is no straight solution to get all districts in a city since district concept varies from one place to another(country-specific). Still you can try one of the below options:
administrative-areas-buildings category in places api
city-town-village category in places api
retrieveAreas mode in geocoder api (apply bbox or increase the radius of prox parameter and see if it works for your location)
Search Text in geocoder can also be used if you are search for districts which match a regex
You can check if the above 1) and 2) are applicable to your location using https://places.demo.api.here.com/places/v1/categories/places?at=41.8369%2C-87.684&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg

How can I get a list of bridges with their location (latitude and longitude) from an OSM file?

maybe this query may be a bit trivial or perhaps laborious, but for a project I need to obtain the bridges that exist in an osm file along with its location (latitude and longitude).
Reading the openstreetmap wiki, I see that there is a procedure using osmosis but I do not know if I will actually get the information as follows:
Name of the bridge | latitude | longitude
bin / osmosis.bat --rx brandenburg.osm.bz2 --bp file = "city.poly" --tf accept-ways highway=motorway_link,motorway --way-key-value keyValueList="bridge.yes" --used-node --write-xml brdg_autob.osm
Thanks in advance
Pablo
The output will be OSM XML and not plaintext.
Also, most bridges in OSM are mapped as ways. A way consists of multiple lat/lons represented as nodes. If you need a single lat,lon pair then you have to calculate the bridge center yourself.
Additionally, not all bridges are tagged as bridge=yes. See bridge in the OSM wiki for a list of commonly used tags, such as bridge=viaduct, bridge=aqueduct, bridge=boardwalk and so on.
You won't exactly get the format you described. However with some little work you can transform OSM XML into your format.

Twitter advanced search by date AND location for research purposes

I'm trying to research a topic and I need to get all tweets within 2013 and 2015 and a specific location for two keywords.
I tried to get the results via Advanced Search but I allways get no results.
I tried:
cannabis near:"España" within:15mi since:2013-10-07 until:2015-01-01
cannabis near:"Spain" within:15mi since:2013-10-07 until:2015-01-01
Basically, I have a database of scraped press articles sorted by date from a bunch of sources, and I want to know how the agenda of this news sources have an impact on the social media conversation.
I could do it over Reddit if it was the case for the US, but there's no Spanish alternative (well, we have Meneame, but the user base is very left-leaning and I think it will be very narrow).
So I wanted to either scrape the search results or get them via API, but It's not working, and AFAIK I can't do anything similar with Facebook.
One way to achieve this is by using Twitter's geocode operator. In the example below i took Madrid as a center and covered a radius of 600km around it like this:
(canabis OR cannabis) geocode:40.4381311,-3.8196196,600km since:2013-10-07 until:2015-12-31
Try it...
The syntax is as follows:
([your_boolean_search_query]) geocode:[latitude],[longitude],[radius]km since:[] until:[]
one easy way to find latitudes and longitudes of locations is to use Google Maps. Simply navigate to a place using the search box and then copy the latitude and longitude element from the URL line in the browser. Here it is for Madrid. The latitude and longitude are right after the # sign, separated by a comma:
https://www.google.com/maps/place/Madrid,+Spain/#40.4381311,-3.8196196,54451m/data=!3m2!1e3!4b1!4m5!3m4!1s0xd422997800a3c81:0xc436dec1618c2269!8m2!3d40.4167754!4d-3.7037902?hl=en
Try it...