openstreetmapnominatim

How to filter house numbers of a city in OSM map


Does anyone have any documentation or know how to get all the house numbers of a city available on OpenStreetMap or Nominatim?

I've searched some documentation but it doesn't seem to work.

Or anyone have api documentation that can do it please help me.

Thanks,


Solution

  • There's no direct API for this that would just spit out all the addresses, or even just all the house numbers, for a specific city, at least not that I'd know off.

    If you can import an OSM planet extract containing your city of choice into an osm2pgsql database it would be easy to run:

    SELECT DISTINCT "addr:housenumber" 
      FROM planet_osm_point 
     WHERE "addr:city=..."
    UNION 
    SELECT DISTINCT "addr:housenumber" 
      FROM planet_osm_polygon
     WHERE "addr:city=..."
    

    Overpass API could also be used, esp. with the OverPass Turbo frontend it can be given queries like "addr:housenumber=* in City_name", but by default it will return full object data and not just a single field like house number.

    Raw Overpass API queries can probably do just that, but I'm not that deep into its query syntax. Maybe the examples can give you a hint towards what may work.

    But the Overpass API query language is not necessarily for those faint at heart ... :O