Print addresses the way the post lays them out
A label needs the street line and the postcode line in the order the post reads them, spelled the way the address data spells them. A line that cannot be confirmed should not reach a label at all.
New Mail and payments Command line Retail, e-commerce Public sector
What you have
A members list, one address per row; the last one names a house that does not exist:
id,address m1,"Jungfernstieg 1, 20095 Hamburg" m2,"Römerberg 23, Frankfurt am Main" m3,"Hauptstrasse 999999, Musterstadt"
Steps
1. One line, in the layout of the country:
$ gridpin format germany.bin "Jungfernstieg 1, 20095 Hamburg" Jungfernstieg 1 20095 Hamburg
2. A line the file cannot confirm prints nothing and says why:
$ gridpin format germany.bin "Hauptstrasse 999999, Musterstadt" Error: no confirmed address for "Hauptstrasse 999999, Musterstadt" in this sheet: the best answer is a guess ( Hauptstraße, Achim, Stadt); `gridpin query` shows it
3. The whole list: each row gets gp_postal, the label text:
$ gridpin batch germany.bin members.csv labels.csv --with postal
$ cat labels.csv id,address,gp_lat,gp_lon,gp_precision,gp_confidence,gp_weak,gp_street,gp_housenumber,gp_postcode,gp_commune,gp_region,gp_match_level,gp_match_status,gp_postal m1,"Jungfernstieg 1, 20095 Hamburg",53.5516677,9.9941644,house,0.95,false,Jungfernstieg,1,20095,Hamburg,,PointAddress,M,"Jungfernstieg 1 20095 Hamburg" m2,"Römerberg 23, Frankfurt am Main",50.1106797,8.6818637,house,0.94,false,Römerberg,23,,Frankfurt am Main,,PointAddress,M,"Römerberg 23 Frankfurt am Main" m3,"Hauptstrasse 999999, Musterstadt",53.0324195,9.0317701,street,0.09,true,Hauptstraße,,,"Achim, Stadt",,StreetName,T,
4. Other countries keep their own order:
$ gridpin format france.bin "8 boulevard du port, amiens" 8 Boulevard du Port 80000 Amiens
What you get
Print the rows whose gp_postal is filled. In the batch above the third row is weak (gp_weak = true, a street in another town): it keeps its answer, and its gp_postal stays empty so it cannot reach a label.
Why it works
The lines come from the house the file found: the street spelled as the registry spells it (Hauptstraße, not Hauptstrasse), the number, the postcode and the town, in the order of the country's post.
Limits
- The town line is the municipality of the address data: Berlin gives the district (Mitte), Paris the arrondissement; the post reads it, but it is not always the town people write.
- A house without a postcode in the data gets none (the Frankfurt row above): check before printing.
- Australia: the data licence does not allow compiling addresses for mail without checking each against a second source.
All its keys: format, batch. The function: print an address the way the post writes it.