[NUUG fiksgatami] [patch] First draft for importing area unions into MapIt

Matthew Somerville matthew at mysociety.org
Tue Apr 19 14:03:43 CEST 2011


On 15/04/2011 22:16, Petter Reinholdtsen wrote:
> How are the IDs automatically generated for UK?

When you insert a row into the database but don't assign to the primary 
key, a new ID is assigned by the sequence set up by the schema. If 
you're both manually inserting IDs and relying upon the sequence, this 
might lead to an issue when the sequence gets to the same number and 
tries to insert an ID that already exists - but this can be worked around.

As you say, all IDs in the Norwegian mapit are manually assigned anyway, 
you are not using the sequence.

> I suspect it would be good if the road authority IDs were easy to
> guess, for example using IDs 10000001 - 10000005, and start at
> different offsets for different type of regions and make sure the IDs
> are way above the fylke and kommune IDs.

Yes, that sounds fine to me. Probably don't need to be that high :)

> I decided against such approach because I want my region import script
> to handle other kind of regions too without code changes.  I already
> see the need for regions for power grid distributors covering several
> municipalities (kommune), and expect to run into other similar regions
> later.  The best migth be if mapit genericly handled areas defined as
> the union of other areas internally, but that code is currently
> missing.  I suspect it would require quite a lot of code changes and
> database schema changes in mapit.

I don't think it's that much code/schema really, but it would certainly 
be more than none, yes. I have ticketed it here:
     https://github.com/mysociety/mapit/issues/7

ATB,
Matthew


More information about the fiksgatami mailing list