[OSM-talk] Semi-automated edits - postal code database
Svavar Kjarrval
svavar at kjarrval.is
Tue Nov 6 17:20:49 GMT 2012
Hi.
This is an update to an e-mail I sent at the beginning of October to the
talk at osm list regarding updating postal codes in Iceland semi-automatically.
I wanted to let you know I have written the script, which is for Python
3.2. I have not yet submitted data made by the script but I haven't
detected any problems thus far. I have performed some random manual
checks on the output and see nothing wrong with the XML. JOSM didn't
complain when I opened the .osc file.
The input is any valid .osm file and the output is an .osc file (
https://wiki.openstreetmap.org/wiki/Osc) which lists any changes made.
The output can be loaded into an editor and submitted to the OSM server
from there.
You're free to adapt the script to suit your purpose but I recommend
that you always check the proposed changes before uploading. The code is
commented enough so anybody who knows Python should be able to know
what's going on there.
Minimum requirements:
- Enough computer memory. The larger the .osm file, the more memory the
script needs.
- Python 3.
- A working installation of the Osmosis program (
https://wiki.openstreetmap.org/wiki/Osmosis).
- Svavar Kjarrval
On 04/10/12 23:48, Martin Guttesen wrote:
> I have imported all the addresses for Faroe Islands
> and updating them from time to time when there is new data available
> see http://wiki.openstreetmap.org/wiki/Import/Catalogue/usfo
> i keep an Id tag (us.fo:Adressutal) so i can Create/Update or Delete
> address nodes
>
>
> -----Original Message----- From: Jochen Topf
> Sent: Thursday, October 04, 2012 7:39 AM
> To: Svavar Kjarrval
> Cc: talk at openstreetmap.org
> Subject: Re: [OSM-talk] Semi-automated edits - postal code database
>
> Hi!
>
> On Wed, Oct 03, 2012 at 11:10:05AM +0000, Svavar Kjarrval wrote:
>> I'm trying to find a good method to maintain data from outside sources.
>> The data in question is the Icelandic postal code database (which they
>> say we may use freely). My searches on the OSM wiki have been fruitless
>> so far.
>>
>> The idea is to maintain the data in associatedStreet relations. Each
>> relation has a tag called 'götuskrá:id' which value is a direct
>> reference to the row ID in the files we retrieve from the postal
>> company's website. The file formats available are CVS and XML 1.0. The
>> script would presumably go ever each associatedStreet relation and make
>> any changes (if appropriate) when a götuskrá:id tag is found. The output
>> could be an OSM change file loaded into an editor like JOSM to be
>> uploaded manually. Maybe an automated process later when we're confident
>> that everything is done correctly, and of course after submitting the
>> script(s) for review by the local community.
>
> It is not a good idea to add some random ID of your favourite database to
> OSM, because nobody except you can understand this ID and do useful
> things
> with it. It just confuses mappers and make it more difficult to edit the
> data. For every change somebody does to the data they have to know
> what this
> tag means so that they can properly do their edit. And if they don't,
> people
> will just mess up your data and you will not be able to use this ID for
> syncing the data anyways.
>
> And in this case I don't even see why you need it. You have street
> names and
> postal codes in both OSM and the Icelandic postal code database. If
> something
> changes you can find out which combinations changed and apply those
> changes
> to OSM easily just based on the postal code and street name. There is no
> need for those IDs.
>
> And, btw, you should not use the associatedStreet relation. It solves
> the same
> problem as the addr:street tags on nodes and buildings but in a much more
> complicated way. The overwhelming majority of all addresses are tagged
> with
> addr:street (there are nearly 15 million addr:street tags vs. only 18.000
> associatedStreet relations).
>
> Jochen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20121106/b2229f6f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filter-postal-codes.py
Type: text/x-python
Size: 5336 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20121106/b2229f6f/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20121106/b2229f6f/attachment.pgp>
More information about the talk
mailing list