Ohjeita paikkojen CSV-tuontiin

57 views
Skip to first unread message

Pekka Valta

unread,
Oct 16, 2016, 5:09:16 PM10/16/16
to Gramps Finland
Monet ovat kamppailleet sen kanssa, miten Grampsiin voisi tuoda Excelistä csc-muotoista dataan. Alla on erään käyttäjän antamat ohjeet. Kokeilkaa. Pekka

Message: 2
Date: Sun, 16 Oct 2016 21:59:58 +0200
From: "Michael Stockhausen" <michael.sto...@web.de>
Subject: Re: [Gramps-users] csv import
To: <gramps...@lists.sourceforge.net>
Message-ID: <0483B03B477A4EB5BC7F6E76748CF2D3@MichaelPC>
Content-Type: text/plain; charset="utf-8"

Thanks everybody, the csv place import is now working.

Just in case anyone is interested, here is what I did (using Excel on Windows10).
There may be better/easier ways to do this, but at least it worked for me.

1) I have updated the code, as suggested by Paul, in my <importcsv.py> file on
C:\Program Files\GrampsAIO64-4.2.4\lib\python3.5\site-packages\gramps\plugins\importer

with this code:
https://raw.githubusercontent.com/gramps-project/gramps/master/gramps/plugins/importer/importcsv.py

2) I have capitalized the column headers to Place, Name, Type, etc. (I am not sure if this is necessary, though. It also worked with ?place?)

3) Attention: the IDs used in my Excel file were not adopted. Gramps creates new IDs in the order of the rows.
So if you create a country e.g. in one row and a state in one of the next, you cannot use the ID in your Excel file for the ?enclosed_by? field. Either you count the rows and try to figure out the ID that Gramps will define, or you create the various levels one by one, entering the IDs of the higher level, that are already in Gramps, manually in ?Enclosed_by?.

4) In Excel
Save under..., choose ?Unicode-Text (*.txt)?

5) Open file in Editor
Copy the tab (the empty space) between two words 
Edit, search/replace
in the search field: paste the tab that was copied above
in the replace field enter a comma (?,?)
Save; Set ?Encoding? from ?Unicode? to ?UTF-8?

6) In the Windows Explorer: change the ?.txt? to ?.csv?

7) Import in Gramps

matti.u.niemela

unread,
Oct 19, 2016, 5:17:08 AM10/19/16
to Gramps Finland
Testasin (Gramp 5.0.0 versiolla) tiedoston toimivuuttaa paikkojen siirtoon .csv tiedostolla joka oli luotu toisesta sukutietokannasta. Tarkoitus oli hyödyntää jo olemassa olevia paikkatietoja tosessa sukutiedostossa. Tämä kuitenkin epäonnistui, koska siirto sotki paikkojen linkitykset ja kirjoitti "ehkä" uudet paikkatiedot vanhojen päälle (liitteenä kuvat ennen ja jälkeen siirron).

En tiedä onko kyseessä virhe vai kuuluuko siirron toimia näin? Tämä sama virhe syntyy myös alkuperäisellä siirto-ohjelmalla. Varsinaisesti Excelissä tuotettua dataa en ole testannut, mutta kyse lienee osittain samasta asiasta.

En ole testannut siirtoa Gramps 4.2.3 versiolla. Jos joku on testannut, olisi mielnkiintoista kuulla tuloksista.


before.png
after.png

Pekka Valta

unread,
Oct 19, 2016, 2:33:03 PM10/19/16
to Gramps Finland
Outoa. Kuvittelisin, että kuviesi osoittama päällekirjoitus on seurausta vain, jos toit päivitysaineistosi paikat siten, että paikoissa oli ID:t hakasuluissa. Silloin Gramps olettaa, että viittaat kannassa jo olevaan paikkaan ja päivität sitä. Uudet paikat paikat tuodaan aina ilman hakasulkuja. Miltä näyttää päivittävä csv-tiedostosi? 


On Monday, October 17, 2016 at 12:09:16 AM UTC+3, Pekka Valta wrote:
Monet ovat kamppailleet sen kanssa, miten Grampsiin voisi tuoda Excelistä csc-muotoista dataan. Alla on erään käyttäjän antamat ohjeet. Kokeilkaa. Pekka

Message: 2
Date: Sun, 16 Oct 2016 21:59:58 +0200
From: "Michael Stockhausen" <michael.sto...@web.de
>
Subject: Re: [Gramps-users] csv import
To: <gramps-users@lists.sourceforge.net>
Message-ID: <0483B03B477A4EB5BC7F6E76748CF2D3@MichaelPC>
Content-Type: text/plain; charset="utf-8"

Thanks everybody, the csv place import is now working.

Just in case anyone is interested, here is what I did (using Excel on Windows10).
There may be better/easier ways to do this, but at least it worked for me.

1) I have updated the code, as suggested by Paul, in my <importcsv.py> file on
C:\Program Files\GrampsAIO64-4.2.4\lib\python3.5\site-packages\gramps\plugins\importer

with this code:

matti.u.niemela

unread,
Oct 19, 2016, 2:53:14 PM10/19/16
to Gramps Finland
Nättää olevan ID hakasuluissa. Tein tiedoston Grampsin vientitoiminnolla ja oletin että palautus onnistuu ilman ongelmia. Näin ei näytä olevan. Pitää poistaa hakasulkeet ja kokeilla uudelleen.

Place Title Name Type Latitude Longitude Code Enclosed_by Date
[P0002]
USA Valtio tai Liittovaltio 38° 53′ 0″ N 77° 1′ 0″ W


[P0099]
Meksikko Valtio tai Liittovaltio 19° 26′ 0″ N 99° 8′ 0″ W


[P0134]
Kanta-Häme Maakunta N 60° 59.755' E 24° 27.867'


[P0139]
Etelä-Karjala Maakunta 61° 4′ 0″ N 28° 11′ 0″ E


[P0145]
Kymenlaakso Maakunta N 60° 52.572' E 26° 41.417'


[P0146]
Lappi Maakunta N 66° 29.948' E 25° 41.892'


[P0147]
Päijät-Häme Maakunta 60° 59.795'N 25° 37.282'E


[P0149]
Pohjanmaa Maakunta 63° 5.545' N 21° 36.954' E


[P0150]
Pohjois-Karjala Maakunta 62° 35.543'N 29° 43.111'E


[P0151]
Pohjois-Pohjanmaa Maakunta 65° 0.749'N 25° 28.092'E


[P0152]
Pohjois-Savo Maakunta 62° 53.569'N 27° 41.339'E


[P0153]
Satakunta Maakunta 61° 28.942'N 21° 49.307'E


[P0154]
Uusimaa Maakunta 60° 9.943'N 24° 59.344'E


[P0156]
Michigan Lääni tai Osavaltio 43.8028144836 -84.90234375


[P0157]
Dickinson Maakunta 46° 0′ 0″N 87° 52′ 12″W
[P0156]
[P0158]
California Lääni tai Osavaltio 38° 33′ 20″ N 121° 28′ 8″ W
[P0002]


keskiviikko 19. lokakuuta 2016 21.33.03 UTC+3 Pekka Valta kirjoitti:
Outoa. Kuvittelisin, että kuviesi osoittama päällekirjoitus on seurausta vain, jos toit päivitysaineistosi paikat siten, että paikoissa oli ID:t hakasuluissa. Silloin Gramps olettaa, että viittaat kannassa jo olevaan paikkaan ja päivität sitä. Uudet paikat paikat tuodaan aina ilman hakasulkuja. Miltä näyttää päivittävä csv-tiedostosi? 

On Monday, October 17, 2016 at 12:09:16 AM UTC+3, Pekka Valta wrote:
Monet ovat kamppailleet sen kanssa, miten Grampsiin voisi tuoda Excelistä csc-muotoista dataan. Alla on erään käyttäjän antamat ohjeet. Kokeilkaa. Pekka

Message: 2
Date: Sun, 16 Oct 2016 21:59:58 +0200
From: "Michael Stockhausen" <michael.sto...@web.de
>
Subject: Re: [Gramps-users] csv import
To: <gramps...@lists.sourceforge.net>
Message-ID: <0483B03B477A4EB5BC7F6E76748CF2D3@MichaelPC>
Content-Type: text/plain; charset="utf-8"

Thanks everybody, the csv place import is now working.

Just in case anyone is interested, here is what I did (using Excel on Windows10).
There may be better/easier ways to do this, but at least it worked for me.

1) I have updated the code, as suggested by Paul, in my <importcsv.py> file on
C:\Program Files\GrampsAIO64-4.2.4\lib\python3.5\site-packages\gramps\plugins\importer

with this code:

matti.u.niemela

unread,
Oct 19, 2016, 3:24:23 PM10/19/16
to Gramps Finland
Kokeilin siirtoa uudelleen Gramps 5.0.0 versiolla ja hakasulkeiden poiston jälkeen (LibreOfficella) siirto onnistui ongelmitta.
Ilmeisesti siirtotiedosto on päivitetty Gramps 5.0.0 versioon.

Pekka Valta

unread,
Dec 20, 2016, 6:19:48 AM12/20/16
to Gramps Finland
Siirtotiedosto on päivitetty myös 4.2.5 versioon.
Reply all
Reply to author
Forward
0 new messages