GFDRR / thinkhazard

ThinkHazard!
http://thinkhazard.org/
GNU General Public License v3.0
33 stars 19 forks source link

Renaming Admin Units #666

Closed stufraser1 closed 7 years ago

stufraser1 commented 8 years ago

When processing version 2 updates, we need to implement updates to incorrect GAUL Admin unit names. I have made copies of the GAUL shapefiles originally implemented.

These new shp files have had ADM*_NAME updated as required using Python code, which updates the ADM0, ADM1, ADM2, consistently in each shp. It also adds three new fields to record the field that has been updated, the original field value, and the date on which these updates were made.

SF to provide developers with updated shapefiles at the appopriate time, in order to run shp2pgsql command on these updated files and update naming in TH

pgiraud commented 7 years ago

@stufraser1 while working on the translations for v2, I figured out that the names are in English in the database. In my opinion, the names for the division should be in the language chosen by the user. Do you know if the GAUL dataset also includes names in other languages than English? I don't think so.

stufraser1 commented 7 years ago

I agree names should be translated if possible, and don't think GAUL is available only in English. Can location names be added to the transifex project or not?

pgiraud commented 7 years ago

It would be better to have the translated names directly in the database so that they could be searchable. Also I think that this is relevant for country names only. I can set up a resource in transifex specifically for the country names but it will be a completely different process from the other resources. In my opinino, it would be easier to manage if the information was available in the shapefile we import.

stufraser1 commented 7 years ago

OK, noted. Are you aware of any country name translations that already exist out there? I'll have a look for some. They must exist, e.g., in places such as Geonames, so I'll check this.

stufraser1 commented 7 years ago

I've found some resources so will work on compiling a list and entering into the .shp

stufraser1 commented 7 years ago

I attach a link to g2015_2014_0_upd180117.shp: https://1drv.ms/u/s!AscqpZyKStZclI4o4YzCIom9i4F3cw

This contains FRE and ESP translations for ADM0_NAME - fields [FRE] and [ESP] This replaces g2015_2014_0_upd251116.shp

No amendments have ben made to ADM1 or ADM 2 shp files.

pgiraud commented 7 years ago

It looks like I never received any of the g2015_2014_x_upd251116 shapefiles. Did you really share them?

In order to integrate the new shapefiles in the application, it would be better if the shapefiles for the 3 levels have the same structure (ie. with the French and Spanish names even if they are similar to English name or left empty).

stufraser1 commented 7 years ago

I've update AMD1 and ADM 2 files to contain the extra columns, and provide them at these links as zipped files. All dated 180117: ADM0: https://1drv.ms/u/s!AscqpZyKStZclI4o4YzCIom9i4F3cw ADM1: https://1drv.ms/u/s!AscqpZyKStZclJIvO0n2lwC2F_-KHQ ADM2: https://1drv.ms/u/s!AscqpZyKStZclJIyEsNoriBW6f6KjA

stufraser1 commented 7 years ago

Hi - I've just been made aware that we need to make an update for Kosovo in the above links. I'll post new links this morning with that update. Sorry for any duplication of effort if you already used the above links.

stufraser1 commented 7 years ago

I've update AMD1 and ADM 2 files to contain the split of Serbia and Kosovo as required by WB determination of countries and provide them at these links as zipped files. All dated 270117: ADM0: https://1drv.ms/u/s!AscqpZyKStZclJMUlI6yPMaLTgoKaA ADM1: https://1drv.ms/u/s!AscqpZyKStZclJMWLq7G2JjfdyY1Iw ADM2: https://1drv.ms/u/s!AscqpZyKStZclJMYsoSxECTHOl7qyQ

pgiraud commented 7 years ago

Hi @stufraser1 I have problems importing the data. The ThinkHazard! tool has a unique constraint on the admin code.

stufraser1 commented 7 years ago

@pgiraud
I have updated to the following files, dated the same as previously provided. ADM0: https://1drv.ms/u/s!AscqpZyKStZclJMwHkKyqkfe5G2PAw ADM1: https://1drv.ms/u/s!AscqpZyKStZclJMxqc9psbdatCArTw ADM2: https://1drv.ms/u/s!AscqpZyKStZclJMYsoSxECTHOl7qyQ

pgiraud commented 7 years ago

I'm still having issues. It look like the admin division which code is 40781 has been completely removed from ADM0. However some of the divisions in ADM1 have this code as their parent code.

stufraser1 commented 7 years ago

Correct...I neglected to update the ADM0_CODE in ADM1 and 2 Files. Sorry for the wasted effort.

@pgiraud the uploads are now complete. Same links work.

pgiraud commented 7 years ago

Unfortunately, there's a duplicate on the code 383. It's used for Kosovo (level 0) and for Tindouf (level 1) in Algeria. I can't import the file because uniqueness is not respected. I'm sorry.

stufraser1 commented 7 years ago

So sorry - I created that ADM0_CODE = 383 to distinguish from Serbia, but didnt realise it should be unique with respect to ADM1 and ADM2 also. Please can you update the ADM0_CODE for Kosovo ADM0 only, to 264899 (this is Serbia ADM0_CODE suffixed with 99. It is unique in ADM0, AMD1, and ADM2 files). I will do the same on my copy. This should be faster than us uploading and downloading new files again.

I have edited the ADM0_CODE in one row in ADM0, five rows in ADM1, and five rows in ADM2

pgiraud commented 7 years ago

Ok. Thanks.

pgiraud commented 7 years ago

Dont' forget to also change the ADM0_code in ADM1 and ADM2 for subdivisions of Kosovo. ;-)

stufraser1 commented 7 years ago

Yes - I have edited the ADM0_CODE in one row in ADM0, five rows in ADM1, and five rows in ADM2. Thanks.

pgiraud commented 7 years ago

FYI, I also did the following modifications because of conflicts on "code" in ADM2 divisions. Some codes were duplicated so I changed some of them with a not already existing yet close value:

The updated zipped shapefiles are available at https://dev.camptocamp.com/files/thinkhazard/world/.

stufraser1 commented 7 years ago

Thanks. I'm not sure why these would be duplicates, as they are unchanged by me. These must have existed all of the time in the original GAUL data.

pgiraud commented 7 years ago

You're totally right. This was not new but I was simply removing them in a previous version of the application because I didn't know what to do. This time I decided to take a closer look and it looks like a bad code assignment so I fixed it in the shapefiles.

pgiraud commented 7 years ago

This is now fixed in 1.5.2 and master branch. Closing.