* Plugins to manage Place Text and Standardized

Writing and using plugins for Version 5 and above.
Post Reply
User avatar
tatewise
Megastar
Posts: 22768
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Plugins to manage Place Text and Standardized

Post by tatewise » 28 Sep 2021 10:10

The Email forum posting Mapping errors / place name editing with search and replace plugin needs plugin enhancements to allow Place fields to be bulk converted.

I've produced the two Plugins I promised which are attached. Please give them a try, perhaps on a copy of your Project.
However, you can use Edit > Undo Plugin Updates or File > Backup/Restore > Revert to Snapshot to reverse any changes

Copy Chosen Place Names to Standardized
This allows you to select any Place records before running the plugin or it will prompt for Place records after it is run.
It copies the Place name Text field to the Standardized field as long as Standardized is not already in use.
If necessary you must delete any used Standardized field values beforehand via a Query.

Search and Replace
The Extra Filters tab, for Record Names/Titles lower right, allows Place Name (_PLAC.TEXT) and Standardized (_PLAC.STAN) to be selected separately.
Set the Major Options tab, Search Scope to Place Records (_PLAC) and Select Records subset as required.
You then have three Extra Filters tab options to filter changes:
1) Place Name only; 2) Standardized only; 3) All the Record types (which enables both);
That 3rd option only enables the Place Name and Standardized fields because the Search Scope is only Place Records.
Attachments
Copy Chosen Place Names to Standardized.fh_lua
Version 0.1 Date 27 Sep 2021
(1.59 KiB) Downloaded 52 times
Last edited by tatewise on 28 Oct 2021 10:41, edited 1 time in total.
Reason: Attachment for 'Search and Replace' deleted as V3.5 is in the Plugin Store.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
knchsi
Newbie
Posts: 4
Joined: 22 Dec 2015 14:00
Family Historian: V6

Re: Plugins to manage Place Text and Standardized

Post by knchsi » 30 Sep 2021 09:03

First test.
Plugin "Copy names to standardized". Works great, selects and copies ok.

Plugin "Search and Replace". Confusion.
The Extra Filters tab - When and why should I select Place record or Standarized record? Is it which data to search or which data that gets replaced?
The Major Options tab - Only Place records to choose. So I can only search in Place records and not in Standardized records? I want to search in Standardized reords and replace data in that record.
The Select Place records works ok.
The Three Extra Filters tab option - where are they?? Both tabs look exactly the same as before.

User avatar
tatewise
Megastar
Posts: 22768
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Plugins to manage Place Text and Standardized

Post by tatewise » 30 Sep 2021 09:47

You are making a common mistake of confusing records and subsidiary fields.
There are only 10 record types: Individual, Family, Note, Source, Repository, Submitter, Submission, Media, Place & Header.
Each one has a separate tab in the Records Window (hence its name) but you may not use all of them.

So when you set the Search Scope and Select Records for Place Records (_PLAC) you are focussing on Place records.

Each Place record has many subsidiary fields: Place Name, Standardized, Lat/Long, Media, Note, etc.
Place Name (_PLAC.TEXT) holds the name that appears in fact Place fields.
Standardized (_PLAC.STAN), if it exists, is the name used for geocoding to set the Lat/Long field.

Search and Replace operates on whatever fields are chosen on the Extra Filters tab providing they are in the Search Scope.
In this case, we are discussing the Record Names/Titles setting that has three relevant options:
  1. Choose Place Name (_PLAC.TEXT) and only the Place name fields will be searched and replaced.
  2. Choose Standardized (_PLAC.STAN) and only the Standardized fields will be searched and replaced.
  3. Choose All the Record types and both Place name and Standardized fields will be searched and replaced.
Hopefully, that is clearer.

Search and Replace has many alternative option settings depending on what you want to search and replace.
However, the Search box & Replace box only operate on one field at a time, but then repeats on the next matching field.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
knchsi
Newbie
Posts: 4
Joined: 22 Dec 2015 14:00
Family Historian: V6

Re: Plugins to manage Place Text and Standardized

Post by knchsi » 02 Oct 2021 17:17

Had to think twice before a got it. The procedure is:
1. Run plugin "Copy place names to standardized names" and select those places I want to correct geocoding
2. Run plugin "Search and replace" and select Search scope Place records with extra filter for standardized names. Then enter placename to search for and what to replace with.
That will give me a change of one part of place name only.

I have to change the whole name with a new standardized name too.
Example - this is what I have as placename variants for one and same place:

[P232] Östermark
[P26] Östermark ( Teuva ) Finland
[P349] Östermark ( Teuva ) Finland
[P241] Östermark, Lansi-Suomen Laani, Finland
[P251] Östermark, Teuva, Finland
[P246] Östermark, Teuva, Lansi-Suomen Laani, Finland
[P244] Östermark, Teuva, Vaasa, Lansi-Suomen Laani, Finland
[P252] Östermark, Teuva, Vasa, Finland
[P256] Østermark, Östermark, Lansi-Suomen Laani, Finland
[P292] Östermark,( Teuva ) Finland
[P236] Östermark,,Teuva,Finland

I want to replace the standardized name for all those name variants with :

Teuva/Östermark, Södra Österbotten, Finland

This will give me correct geocoding for all name variants.

So I would need a search criteria "Replace whatever is in the place name" with the text in the Replace box.

Made myself clear?

User avatar
tatewise
Megastar
Posts: 22768
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Plugins to manage Place Text and Standardized

Post by tatewise » 03 Oct 2021 10:49

You must select those records in the Search Scope Select Records so only those ones are affected.

Then below select Lua Pattern Mode and enter Search .*
That matches everything.
In Replace enter the desired Standardized place.

Ensure only Standardized is chosen in the Extra Filters tab.

Check the Result Set afterwards and if not correct use Edit >Undo Plugin Changes.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
knchsi
Newbie
Posts: 4
Joined: 22 Dec 2015 14:00
Family Historian: V6

Re: Plugins to manage Place Text and Standardized

Post by knchsi » 04 Oct 2021 11:59

Thank you - Works exactly as needed.

User avatar
tatewise
Megastar
Posts: 22768
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Plugins to manage Place Text and Standardized

Post by tatewise » 04 Oct 2021 15:46

May I say that several of those 11 Place records look like they could be merged into one record.
Several only differ by minor punctuation or spelling variations that could become one record.
e.g.
[P26] Östermark ( Teuva ) Finland
[P349] Östermark ( Teuva ) Finland
[P251] Östermark, Teuva, Finland
[P292] Östermark,( Teuva ) Finland
[P236] Östermark,,Teuva,Finland

They could all be merged into:
[P251] Östermark, Teuva, Finland

Is there any good reason why they cannot all be merged into one Place record?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
knchsi
Newbie
Posts: 4
Joined: 22 Dec 2015 14:00
Family Historian: V6

Re: Plugins to manage Place Text and Standardized

Post by knchsi » 31 Oct 2021 10:10

Sorry for late reply.
There is a good point into merging those to one but I have to start with correct lat/long for my research.
I do want to save some that could be merged but I want to keep old spelling and original wording in some cases so it will take a long time.

Post Reply