NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I would like to show OSM POIs like shops on a map, and display their tag details when clicking on a POI. I would like to remove the addr:* address tags from the details, and instead display them as “full address” on one line.

This would turn e.g.

addr:street       5th Avenue
addr:housenumber  390
addr:unit         411
addr:city         New York
addr:postcode     10018
addr:state        NY

into

390, 5th Avenue, Unit 411, New York, NY, 10018

I’m fully aware that

a) Addressing systems around the world are different and complicated: Some places use blocks or suburbs instead of streets, you need unit or apartment numbers, addresses can be multilingual, and so on.
b) Conventions how to order address parts differ locally, e.g. putting the housenumber before or after the street, or putting the postcode before or after the city.
c) Address information in OSM can be incomplete, addresses for POIs would need to be taken from a surrounding building, etc.

Is there some description of rules how to put the address parts together? Maybe different rules per region?

Alternatively, is there a universal rule that could be applied and results in addresses that are mostly understood worldwide? Something like “Use addr:* in this order: housenumber, street, block, …; omit any missing tag; comma-separate them”

Is there even some code or library which implements something like this?

asked 04 Dec '19, 09:35

hfs's gravatar image

hfs
85151525
accept rate: 17%


Have a look at the address format project from OpenCageData. This is a project that collects the different formats for all countries around the world and also provides scripts for formatting.

permanent link

answered 07 Dec '19, 08:46

lonvia's gravatar image

lonvia
6.2k25789
accept rate: 40%

There are so many different address formats. See (for example) this site. I am not aware of an existing OSM tool to format an address based on country, although that doesn't mean there isn't one.

permanent link

answered 04 Dec '19, 11:28

EdLoach's gravatar image

EdLoach ♦
19.5k16156280
accept rate: 22%

1

That site is wrong, there are villages in the UK, Switzerland and France where the roads do not have names (there may be quarters/viertel or hamlets with names which may be useful for addressing. Specific examples Scuol, Ftan, Ardez in the Engadin, Plounevezel in Finistere. Additionally, in some villages in the UK, there may be street names but these are not conventionally part of the address (e.g., Caio).

(04 Dec '19, 11:39) SK53 ♦
1

I was using it more to illustrate there are lots of formats rather than it being an exhaustive list. I've just checked a postcode from a house in a local hamlet on an unnamed road, and the Postcode Finder on the Royal Mail website has them as house name, hamlet name, parish name, postal town, postcode.

(04 Dec '19, 12:00) EdLoach ♦

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×202
×181
×30
×1

question asked: 04 Dec '19, 09:35

question was seen: 1,829 times

last updated: 07 Dec '19, 08:46

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum