Difference between revisions of "Addon:Place completion tool"

From Gramps
Jump to: navigation, search
(New page: A tool to bring the places in your GRAMPS database in accordance with the GRAMPS requirements: batch add country, county; look-up latitude-longitude; set description; ... [[Category:Propo...)
 
Line 1: Line 1:
A tool to bring the places in your GRAMPS database in accordance with the GRAMPS requirements: batch add country, county; look-up latitude-longitude; set description; ...
+
A tool to bring the places in your GRAMPS database in accordance with the GRAMPS requirements: batch add country, county; look-up latitude-longitude; set description (title); ...
  
 
[[Category:Proposed Tool Specifications]]
 
[[Category:Proposed Tool Specifications]]
  
 +
== Place Completion tool ==
 +
This tool helps you fill in the place attributes like county, country, ..., by allowing you to select the places you work on, and do changes on all these places with one button click.
 +
 +
The general aims are:
 +
*Place/Location is a newer concept in GRAMPS. Many older databases only have a Place title field which is a descriptive text containing city, state, country. This should be parsed to insert the values in the correct attribute fields.
 +
*Latitude and longitude are important to show data on a map. However, doing a look-up of this data on the internet is slow and time consuming. The tool allows to search in the free resources on the net.
 +
*Setting of an attribute of a set of places in one go. Eg you give a
 +
*Conversion of latitude and longitude to a fixed data format. On import one might obtain latitude and longitude in several different formats. A conversion tool to store them all in the same format is usefull.
 +
*Construction of a uniform title/description field, from the data in the place object
 +
 +
== Troubleshooting ==
 +
=== Non UTF-8 latitude/longitude file ===
 +
The place completion tool expects the input files for location lookup to be in unicode (utf-8). In the occation this is not the case, you will get the error:
 +
 
 +
<code><nowiki>File "/home/benny/programms/gramps/gramps2/src/plugins/PlaceCompletion.py", line 851, in load_latlon_file
 +
    self.latlonfile_datastr = infile.read()
 +
  File "/usr/lib/python2.4/codecs.py", line 481, in read
 +
    return self.reader.read(size)
 +
  File "/usr/lib/python2.4/codecs.py", line 293, in read
 +
    newchars, decodedbytes = self.decode(data, self.errors)
 +
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1610092-1610094: invalid data</nowiki></code>
 +
 +
In the above example it is clear the problem is in two bytes, so you can correct this manually: open the file with eg <code>KHexEdit Binary Editor</code>, go to the specified position (offset 1610092), and change the two bytes with a space.
 +
 +
In the case the file is completely non-unicode, you will have to convert it to unicode with a tool, before using it in the placecompletion tool.
 +
 +
 +
= Old Tool =
 
== Place Completion Tool==
 
== Place Completion Tool==
  

Revision as of 19:12, 31 March 2007

A tool to bring the places in your GRAMPS database in accordance with the GRAMPS requirements: batch add country, county; look-up latitude-longitude; set description (title); ...

Place Completion tool

This tool helps you fill in the place attributes like county, country, ..., by allowing you to select the places you work on, and do changes on all these places with one button click.

The general aims are:

  • Place/Location is a newer concept in GRAMPS. Many older databases only have a Place title field which is a descriptive text containing city, state, country. This should be parsed to insert the values in the correct attribute fields.
  • Latitude and longitude are important to show data on a map. However, doing a look-up of this data on the internet is slow and time consuming. The tool allows to search in the free resources on the net.
  • Setting of an attribute of a set of places in one go. Eg you give a
  • Conversion of latitude and longitude to a fixed data format. On import one might obtain latitude and longitude in several different formats. A conversion tool to store them all in the same format is usefull.
  • Construction of a uniform title/description field, from the data in the place object

Troubleshooting

Non UTF-8 latitude/longitude file

The place completion tool expects the input files for location lookup to be in unicode (utf-8). In the occation this is not the case, you will get the error:

File "/home/benny/programms/gramps/gramps2/src/plugins/PlaceCompletion.py", line 851, in load_latlon_file
    self.latlonfile_datastr = infile.read()
  File "/usr/lib/python2.4/codecs.py", line 481, in read
    return self.reader.read(size)
  File "/usr/lib/python2.4/codecs.py", line 293, in read
    newchars, decodedbytes = self.decode(data, self.errors)
 UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1610092-1610094: invalid data 

In the above example it is clear the problem is in two bytes, so you can correct this manually: open the file with eg KHexEdit Binary Editor, go to the specified position (offset 1610092), and change the two bytes with a space.

In the case the file is completely non-unicode, you will have to convert it to unicode with a tool, before using it in the placecompletion tool.


Old Tool

Place Completion Tool

The place completion tool has grown out of a desirement to output places as used in events to maps. For this to work, people must have correct place information in GRAMPS. However, for many users, entering places is neglected: a short description and the city is added, and that's it.

A tool to help you fill in the data needed for places is hence usefull.

The general aims are:

  • Place/Location is a newer concept in GRAMPS. Many older databases only have a Place title field with a descriptive text containing city, state, country. This should be parsed to insert the values in the correct attribute fields.
  • Latitude and longitude are important to show data on a map. However, doing a lookup of this data on the internet is slow and time consuming. The tool allows to search in the free resources on the net.
  • Conversion of latitude and longitude to a fixed data format. On import one might obtain latitude and longitude in several different formats. A conversion tool to store them all in the same format is usefull.
  • Construction of a uniform title/description field, from the data in the place object

Design Specification

See Place completion tool specification

Manual

The place completion tool gives a lot of functionality. This manual should help you to understand how it works.

Download resources

The place completion tool can look up for you latitude/longitude, add county information (USA), ... For some of this functionality, you must download datafiles of the countries you are interested in. Right now you have three options:

  1. Download geonames country files. You can do this here freely. Geonames parses fastest, so is the advised format to use
  2. Download geonames USA state files. You can do this here freely. This is advised for USA searches, as the data in the USA country contains many doubles, which can be avoided by searching state per state. State info also contains county information.
  3. download GNS Geonet country files (not available for usa). You can do this here freely with ftp.

Watch out, some of these downloads are VERY large, especially USA data. Only download what you need.

Note: The geonames data of popular places is in English, so eg municipalities in Italy will be found, but Roma not, as this is Rome in English. To find data with these you need to search in the localised variants of the name (see below)

DO NOT BETA TEST WITH YOUR RESEARCH DATA. EXPORT DATA FIRST TO HAVE A BACKUP

Starting the tool

The placecheck tool is in the tools menu, option tools, under place completion

Gramps-notes.png
This page has good information but needs a cleanup. Please make the Gramps Wiki more useful by re‑organizing this page and linking introductory material. Consider also updating the screenshots.

This is for the present version, the version in development will be different, manual will have to be adapted then. You have to consider 5 actions:

Set filter

Set a place filter which determines which places will be considered. You can set a general filter (standard is All Places). To avoid the need for different filters for every country, state, these can be set in two separate entry fields.

Parse title

Determine if the title must be parsed. Lookup op lat/lon happens with the city field normally. Older grdb/gedcom do not have this fields. Therefore you can parse this field with a regex. This is a comboentry field. Some common options are provided in the dropdown. You can however construct your own regex. Leave this field blank to do no parsing of the title

Look-up latitude/longitude

Search latitude and longitude in data files. A comboentry field is given. You can give your own regex, or you can choose from the dropdown common possibilities. Geonames is fastest. In the file dialog you must select the file you downloaded. The dropdown has the following entries:

  • geonames, city search: search populated places with the data in the city search
  • geonames, city localised variants : same as before, but now the city is searched in the non-english list. Only well known places (eg Roma, Antwerpen, ...) are listed under the English name (Rome, Antwerp, ...). When English is identical to localized variant, this list is empty and no match can be found with this search
  • geonames, title begin general search: searches with what is in the title field before the first ',' in a general fashion: populated places, parks, mountains, ... are returned. Eg: title = Piazza Navona, Rome; will return lat/lon of this famous place in Rome by searching the IT.txt geonames file
  • geonames, USA state city search: search in a USA state file, with city. Only populated places are searched
  • geonet, city search: search a geonet file, with the city data. Only populated places, and the search is the local variant with accents!
  • geonet, title begin geenral search: same as the geonames analog, but on a geonet file

Convert latitude/longitude

Convert lat/lon. Some general conversion on lat/lon are possible, to make sure all data is in the same format. This search also catches mistyped lat/lon and gives a warning. It is possible to correct degree notation with - to correct degree notation.

Set title/description field

Some possibilities to set the title field automatically from the data in the place object are offered.

Do the changes 1: what would change

Now, by clicking find, a list with all places is made, and the changes that can be proposed. These are presented in a tree view with two levels: the general level with placename, and the details with suggested changes. Data overwriting previous data is shown with orange background. You can perform several actions:

  • press delete: the entry disappears from the tree view
  • press tab : your preferred browser opens a page on google maps. If a lat/lon is suggested, you see this place, otherwise google maps is searched with the place data (city or title)
  • select an entry and click on Google Maps: this does the same as pressing tab.
  • double-click an entry: the place editor opens, with the data preentered. On the place, all suggested changes are preentered. On a detail, only this specific suggestion is preentered

Do the changes 2: change it

Click Apply: all suggested changes in the treeview are consecutively done. Check for doubles and overwrites before clicking on Apply

The changes cannot be undone. Take a backup if unsure!

DO NOT BETA TEST WITH YOUR RESEARCH DATA. EXPORT DATA FIRST TO HAVE A BACKUP

Download

You can download the developers version. You find it at placetool0_9.tar.gz. Put the .glade and .py file both in the plugins directory of GRAMPS 2.2.x.

'DO NOT BETA TEST WITH YOUR RESEARCH DATA. EXPORT DATA FIRST TO HAVE A BACKUP