How to format structured addresses correctly for North America?
First, thank you for DAVdroid! It works well, and I appreciate your support of f-droid and Free software.
Problem: Structured addresses in contacts synced by DAVdroid are formatted incorrectly for North America.
123 Street Ave
Anytown, ST 12345
123 Street Ave
Or, more succinctly, I’d expect:
Street POBox Extended \n City, Region Postcode \n Country
But I get:
Streed POBox Extended \n Postcode City \n Region \n Country
It’s my understanding is that this is because my canonical address book, at FastMail, only supports structured address entry and does not set a separate
ADR LABELfield. Therefore,
vcard4androidtakes it upon itself to generate a formatted address, and selects a formatting that’s great for much of Europe, but non-conforming for the US and Canada.
Last year, you mentioned that DAVdroid could either generate its own formatted address or leave it up to Android, but that Android’s own generated addresses looked “very strange.” Do they, by chance, match the expected format above?
If I edit the formatted address on my device using the stock Android contacts application, then the structured data is lost and replaced with a single Street field containing the entire formatted address.
I appreciate that there are no perfect solutions here, but what are some possible ways for my addresses to end up formatted correctly on my device? Off the top of my head, it seems like one of the follow paths may be fruitful:
- Give up on structured data, manually enter all of my addresses, formatted, into the Street field in FastMail.
- Allow users to opt-out of DAVdroid generating its own formatted addresses.
- Allow users to specify their own formatted address template.
- Have DAVdroid switch address formats based on Country.
- Attempt to auto-detect US / Canadian addresses and format them accordingly.
- Fork DAVdroid, make an American version that formats addresses as above. Probably OK, since we generally ignore the rest of the world’s standards and conventions anyways.
- Something else entirely?
Any thoughts on what path would be most reasonable?
Edit: Also, Mapzen has a good blog post on using libpostal and address-formatting to do this sort of thing.