osm-search / Nominatim

Open Source search based on OpenStreetMap data
https://nominatim.org
GNU General Public License v3.0
2.98k stars 701 forks source link

House address not returning after setting style service tag to always. The driveways around this area are labled as service roads. #3402

Closed dmurtha closed 2 months ago

dmurtha commented 2 months ago

What did you search for?

localhost/reverse.php?lat=36.04682&lon=-79.02518&zoom=18&format=jsonv2

What result did you get?

Local server returns just the State.

//House call local should return the house that is close by. The point is the service road that I would have called it a driveway. FROM placex WHERE ST_DWithin(placex.geometry, ST_GeomFromText(POINT(- 79.02518 36.04682), 4326), 0.001) AND placex.parent_place_id = 54760332::BIGINT AND ( placex.rank_address = 30 AND ( placex.housenumber IS NOT NULL OR placex.name ? 'addr:housename' ) ) AND placex.indexed_status = 0::SMALLINT AND placex.linked_place_id IS NULL ORDER BY distance LIMIT 1::INTEGER

https://nominatim.openstreetmap.org/reverse.php?format=jsonv2&addressdetails=1&lat=38.9616587&lon=-94.69911872009547&zoom=16&extratags=1 Returns what I want from getting the main road and than finding the house number, but if you had set turn style service tag to named it pulls the driveway and the second find house call does not return a result from the service street.

What result did you expect?

I would expect it to find the house number from the driveway/service road just as it does from the main street.

Like this returns //Returns what I had expected above. FROM placex WHERE ST_DWithin(placex.geometry, ST_GeomFromText(POINT(- 79.02518 36.04682), 4326), 0.001) AND placex.parent_place_id = 3359285::BIGINT AND ( placex.rank_address = 30 AND ( placex.housenumber IS NOT NULL OR placex.name ? 'addr:housename' ) ) AND placex.indexed_status = 0::SMALLINT AND placex.linked_place_id IS NULL ORDER BY distance LIMIT 1::INTEGER

When the result in the right place and just named wrongly:

When the result missing completely:

Further details

Thanks for your service.

mtmail commented 2 months ago

https://nominatim.openstreetmap.org/ui/reverse.html?lat=36.04682&lon=-79.02518&zoom=18

If 36.04682,-79.02518 returns only the state then I'd say something is wrong with your import. Did the import finish without errors? Can you give us more information on Nominatim version, when it was imported and what was imported?

Nominatim only imports named features. Driveway vs service roads makes no difference here because both have no names in OSM data.

https://nominatim.openstreetmap.org/ui/reverse.html?lat=38.9616587&lon=-94.69911872009547&zoom=18

The house with house number at 38.9616587, -94.69911872009547 is in OSM data so it should also return the house number in your local installation.

but if you had set turn style service tag to named it pulls the driveway and the second find house call

Nominatim has no turn style feature. Are you talking about a different software?

mtmail commented 2 months ago

Ah sorry, in the title you said you changed the style file. Can you post the changes (only the relevant lines). Were the changes made before or after the import?

dmurtha commented 2 months ago

From file import-extratags.lua under highway original service = 'named', updated service = 'always',

Import works fine worked to completion, database check lists OK for all aspects and test lookup values work and all other aspects of the site runs as expected.

dmurtha commented 2 months ago

Version nominatim 4.4 postgres 14 ubuntu 22 new UI website 3.5.2. Imported North America from 4/21/2024, using the python web process with apach2. No additional software is installed and it's a fresh install.

mtmail commented 2 months ago

Satelliate imagery suggests there's a house at https://nominatim.openstreetmap.org/ui/reverse.html?lat=36.04682&lon=-79.02518&zoom=18 but the address is not in OpenStreetMap data yet.

With default installation Nominatim returns the house with number 4301 about 40m away. When you set service = 'always', in the import style then it returns the unnamed service road.

I can't reproduce that only the state is returned. I see "display_name": "Orange County, 27705, United States", but that's because I only imported the nearby area, not the whole state.

An address with house number is a better result than an unnamed road but that road happens to be closer to the search point. Are you suggesting the road should be ignored in this case?


Local test import:

cd ~/Nominatim
git checkout v4.4.0

cd ~/nominatim-project
nominatim --version
Nominatim version 4.4.0-0 (e5a5f026)

wget https://download.geofabrik.de/north-america/us/north-carolina-latest.osm.pbf
# https://www.openstreetmap.org/relation/2528730
osmium getid  --add-referenced --output orange-county-boundary.osm north-carolina-latest.osm.pbf r2528730
cp ~/Nominatim/settings/import-extratags.lua ~/nominatim-project/import-extratags2.lua 
vi import-extratags2.lua 
# now change service = 'named', to  service = 'always', and save file
cat .env
NOMINATIM_DATABASE_DSN='pgsql:dbname=nominatim_orange_county'
NOMINATIM_IMPORT_STYLE=import-extratags2.lua
nominatim import --osm-file orange-county.osm.pbf --no-partitions --reverse-only --no-updates
nominatim reverse --lat 36.04682 --lon -79.02518 --format jsonv2
{
    "place_id": 180710,
    "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
    "osm_type": "way",
    "osm_id": 844934264,
    "lat": "36.046770492246075",
    "lon": "-79.02509969760324",
    "category": "highway",
    "type": "service",
    "place_rank": 27,
    "importance": 0.04000999999999999,
    "addresstype": "road",
    "name": "",
    "display_name": "Orange County, 27705, United States",
    "boundingbox": [
        "36.0466405",
        "36.0470292",
        "-79.0251487",
        "-79.0249402"
    ]
}
dmurtha commented 2 months ago

The starting point lat\lon is the service road not the main road. The live version snaps to the main road than the house. The service "always" version searches from the original point of the service road (as it should) looking for a house number and returns no results. I felt it should return the house number as it's so close to the house. I have a lot of other service points that are doing this action in the area.

//second House search call local should return the house that is close by. The point is from the service road that I would have called a driveway. FROM placex WHERE ST_DWithin(placex.geometry, ST_GeomFromText(POINT(- 79.02518 36.04682), 4326), 0.001) AND placex.parent_place_id = 54760332::BIGINT AND ( placex.rank_address = 30 AND ( placex.housenumber IS NOT NULL OR placex.name ? 'addr:housename' ) ) AND placex.indexed_status = 0::SMALLINT AND placex.linked_place_id IS NULL ORDER BY distance LIMIT 1::INTEGER