Google Maps - More Place Levels Mod

From TNG_Wiki
Jump to: navigation, search


Ambox notice.png The latest version of this mod uses the guidelines for TNG v12+ cust_text.php files. If you are using TNGv12+, and any cust_text.php file in this mod is marked with a Bad Target error, you need to update your cust_text.php files before you can install this mod. [Show instructions]

If you upgraded to TNGv12+, and did not update your cust_text.php files as instructed in the upgrade readme script, then you must use the TNG Mod Manager to update them. To do so:

  1. Go to Mod Manager, and select its "Recommended Updates" tab.
    (If the "Recommended Updates" tab is not visible, then go to the Mod Manager Options tab, select "Display Settings", and turn on the "Recommended Updates" tab.)
  2. Click the "Update" button in the "Recommended Updates" tab.
    Installed mods do not interfere with the update, and if you already have (or think you may have) run this update, it will not hurt for you to run it again.

[See details in the TNGv12 Change Impacts Article][Hide the instructions]

TNG 13.0
TNG 12.0


More Place Levels Mod
Summary Adds 4 more placelevels to the Google maps that show on person and place maps
Validation This mod is XHTML compliant.Valid-xhtml10.png
Mod Updated 2 Oct 2020
Download link TNG Google maps More Pins TNG 10.1 for
TNG 12.0
TNG 13.0

TNG Google maps More Pins TNG 10.1 for
TNG 10.1.0
TNG 11.0

TNG Google maps More Pins TNG 9 for
TNG 10.0
TNG 9.0

TNG Google maps More Pins TNG 8 for
TNG 8.0

TNG Google maps More Pins TNG 7 for
TNG 7.0
Download stats Roger's Download Stats
Author(s) Roger Moffat
Homepage Google Maps - More Place Levels Mod
Mod Support TNG Community Forums
Contact Developer
Latest Mod 10.1.0.1 for TNG 10.1, 11, 12, and 13
9.0.0.1 for TNG 9 and 10
8.2.0 for TNG 8
1.1 for TNG 7
Min TNG V 7.0.0
Max TNG V 13+
Files modified
Related Mods
Notes
You can NOT have both this Mod and the Google Maps - Change Pin Legend Mod installed at the same time.



Purpose of the mod

This mod adds 4 more placelevels to the Google maps that show on getperson.php and places pages, including a new "Region" category for places that are bigger than a country - eg "Europe" or "Africa" or "Pacific Ocean" or "At Sea"

Developer

This mod was developed by Roger Moffat

Requirements

  • A working TNG installation. Automated installation has been tested on TNG Version 7.1.x and TNG 8.0.0 and above to TNG 13
  • A backup of the TNG modules involved - see below.
  • An installed current version of the Mod Manager (note this is built into TNG 8 and later).

Automated Installation

TNG 7

TNG version: 7.0
  1. Download the file from TNG Google maps More Pins TNG 7
  2. Extract the downloaded .zip file into your admin/mod_folder folder. You should end up with 6 files (google_maps_add_4_placelevels.cfg and 5 new pin images) and a folder (LiberationSans-Regular) that contains a font needed for this mod.
  3. If you are not using TNG's Config Path, go to the next step. If you are using TNG's Config Path to store your config files outside of the TNG root directory, you will need to edit line 117 of the config file to point to this location before you attempt the install. The config file contains some examples of what you might have to use. See Pre-installation Updates for help with this step.
  4. If you installed the Google Maps - Change Pin Legend Mod you need to Remove and Delete it.
  5. Follow the normal automated installation for Mod Manager, as shown in the example Mod Manager - Installing Config Files to install the google_maps_add_4_placelevels.cfg config file.


TNG 8 and above

TNG version: 8.0
  1. Download the file from the appropriate link in the Mod Summary section in the upper right hand corner
  2. Extract the downloaded config file into your mods folder. You should end up with 1 file - gmaps_add_4_placelevels_Vxxxx.cfg and a folder containg 5 new pin images and a TrueType font needed for this mod.
  3. If you are not using TNG's Config Path, go to the next step. If you are using TNG's Config Path to store your config files outside of the TNG root directory, you will need to edit line 140 of the config file to point to this location before you attempt the install. The config file contains some examples of what you might have to use. See Pre-installation Updates for help with this step.
  4. If you installed the Google Maps - Change Pin Legend Mod you need to Remove and Delete it before attempting to install this Mod.
  5. Follow the normal automated installation for Mod Manager, as shown in the example Mod Manager - Installing Config Files to install the gmaps_add_4_placelevels.cfg config file.

Note that the config file only includes the English language changes. If you support multiple languages, you will need to either modify the config file to add the custom text for your other languages, or copy the changes that are made to English/cust_text.php to the cust_text.php file(s) of the language(s) that you support and provide the appropriate translations for them. Update Version 12.0.0.2 for TNG 12 and above includes translations for French, Spanish, Italian, and German. These are added to the UTF-8 folder of the site. If you are NOT using UTF-8 you will need to copy these changes to the cust_text.php files in the non-UTF-8 language folders.

TNG version: 8.1.3
Note that step 3 above only pertains to TNG V8. The Mod Manager code was fixed in TNG V9 to handle the Config Path.

After Installation (for TNG 7)

TNG version: 7.1.3
This section is NOT applicable to Mod Version 8.2.0 or Mod Version 9.0.0.0. There is a separate Mod to install this functionality described Google_Maps_-_Update_Place_Levels_Mod

Click the Show Details link below to expand this section.

You can click on the [Expand] link on the right to view the instructions on Changing Place Levels or [Collapse] to hide them again.

Changing Place Levels

• Mostly Automatic

Go to TNG Admin ------> Utilities and make a backup of your Places table (while you're there why not back up all the tables?).

Because this mod adds 4 new place levels to the series used by TNG, you will want to re-align the place levels assigned to your places. The new default sequence this mod creates is

Address, Cemetery, Farm, Town, Parish, City, County/Shire, State/Province, Country, Region, Not Set

and so if you have up until now used the default TNG sequence of

Address, Location, City/Town, County/Shire, State/Province, Country, Not Set

If you are happy with this new series, you can achieve this realignment for many of your places by clicking the link in the "To update your current place levels automatically click this link" part of the notes on the Mod Manager page. This will run a script that will edit the placelevel number for County/Shire, State/Province and Country to their new values.

UpdatePlaceLevels.png

You will need to decide how to split up the places you currently have assigned placelevel2 and placelevel3 (Location and City/Town) to the new placelevel2, placelevel3, placelevel4 and placelevel5, and either apply these changes manually through the TNG Admin ------> Places interface, or perhaps using phpMyAdmin to edit the tng_places table directly as described in the Mass_Updates_of_Place_Level_and_Zoom article.

• Automatic and Manual

If you have already used a different sequence of place levels, or want to now switch to using a different sequence of place levels, there are several things you will need to do.

  1. Go to English/cust_text.php and find the block of place level lines that have been added at the end of the file, and edit the various entries there to define the new sequence of placelevels that you want to use. Note that if you do make changes directly in cust_text.php after the Mod is installed, it will cause the Mod Manager to say that the Mod is not properly installed. There are 2 possible work arounds for this:
    1. Copy the lines that you want to change and then paste them into cust_text.php again after the block of lines added by the Mod. Then make your changes there, in the second instance of the lines you want changed
    2. Edit the .cfg file and make the changes in the .cfg file prior to installing the Mod. This will then let the Mod control what goes in cust_text.php without creating the errors
  2. If you support other languages, copy this block of text to the cust_text.php file for your other languages and provide translations of the words/phrases
    1. Note that 1.2 and 2 above here can both be accomplished if you create another Mod that writes the text you want to display into the cust_text.php file for any/all languages. As long as you create this Mod so that it will write the new lines AFTER the lines added by this Mod, your changes will be in effect. Should you remove and reinstall this Mod, you would then need to remove and reinstall your Mod for writing just the lines to cust_text.php AFTER you install this Mod.
  3. Decide if any of your previous place levels align directly to the new ones - note that place levels are defined by the number you see on each line in the cust_text.ph file - Country used to be Level 6 and is now Level 9 for example.
  4. If your old sequence of place levels 4, 5 and 6 equate directly to the new levels 7, 8 and 9 you can update these automatically by using the step described above to update the place levels automatically.
  5. If you have a different alignment of old and new placelevels you can use the capability built into the Mod Manager file to change your place levels 1 at a time. After the Mod is installed,
    • Make sure the file update_ChangePlaceLevels.php placed into your TNG folder by this mod is writeable - permissions should be 666.
    • click the Edit button that appears in the right most column. By default it will open a window that lets you change current place level 6 (Country) to new place level 9 (Country).
    • Click the Confirm Edit button, and this will update the database update script,
    • Click this link which will open a new window and run the database update script and update your tng_places table.
You can then repeat the steps above and change level 5 to 8, then 4 to 7, or any other realignments that suit how you have used the Place Levels in the past and how you might want to use them with the new capabilities. This method is shown in the image below.
You can also run the Auto Place level update script to change place levels 4,5, and 6 and then Edit the parameters for the individual place level script to change level 3 to level
  • 4, as shown in the image on the right, if the predominate number of your Town/City places are Towns, or to level
  • 6 if the predominance are Cities.

You will still need to update the exceptions manually within TNG, or using a procedure similar to the one described in the Mass_Updates_of_Place_Level_and_Zoom article, where you

  • export the Places table to an Excel spreadsheet and then
  • make your updates and
  • re-import the table.
Add Place Levels edit place level.jpg

Security

When you have finished updating the place levels, it is recommended that you delete the 2 update_ files that were added by the Mod. These are update_ChangePlaceLevels.php and update_ChangePlaceLevelsAuto.php. Doing this will prevent you from accidentally upgrading all your place levels again when you didn't want to. The Mod Manager in TNG 8 is set to ignore these 2 files if they're missing, so won't generate error messages. The Mod Manager Add-On for TNG 7 will give errors when the 2 files admin/dbupdateChangePlaceLevels.php and admin/dbupdateChangePlaceLevelsAuto.php are deleted.

Even More Pins

If you want to change the pin colours, a complete set of pins, and a handy contact sheet that gives the number and colour matches for all 216 pins can be downloaded here TNG Map Pins - Complete Set

Changing the Place Level Descriptions - Method 1

NOTE - this Mod as supplied, only supports UTF-8 languages, plus English. If your site is NOT running as UTF-8, then you will need to save the .cfg file as Windows (Latin 1) (this is what BBEdit on Mac OS calls it) before uploading it to your site.

The TNG v12 and upwards version of this Mod includes translations provided by Pierre Landry into French, Spanish, Italian and German. You might want to make changes to the provided Place Level Descriptions. One easy way to do this is to do it before installing the Mod on your site:

  1. Open the file - gmaps_add_4_placelevels_v12.0.0.2.cfg - with a text editor - eg Notepad++ on Windows, or BBEdit on Mac OS.
  2. Modify the captions by changing ONLY, the text between the quotes.
    // For extra map pins
    $admtext['level1'] = "Address";
    $admtext['level2'] = "Cemetery";
    $admtext['level3'] = "Farm";
    $admtext['level4'] = "Town";
    $admtext['level5'] = "Parish";
    $admtext['level6'] = "City";
    $admtext['level7'] = "County/Shire";
    $admtext['level8'] = "State/Province";
    $admtext['level9'] = "Country";
    $admtext['level10'] = "Region";
    // For extra map pins
  3. Do the same for all languages listed in the .cfg file.
  4. Save your work.
  5. If your site supports languages not supported by the Mod, you can add them to the Mod's .cfg file before installation.
    1. Copy the entire block for a language:
      %target:languages/English-UTF8/cust_text.php%

      %location:%
      //Mods should put their changes before this line, local changes should come after it.
      %end:%
      %insert:before%

      // Added for Google Maps - More Place Levels for extra map pins
      $admtext['level1'] = "Address";
      $admtext['level2'] = "Cemetery";
      $admtext['level3'] = "Farm";
      $admtext['level4'] = "Town";
      $admtext['level5'] = "Parish";
      $admtext['level6'] = "City";
      $admtext['level7'] = "County/Shire";
      $admtext['level8'] = "State/Province";
      $admtext['level9'] = "Country";
      $admtext['level10'] = "Region";
      // end of add for Google Maps - More Place Levels for extra map pins

      %end:%
    2. Paste the copied text into the .cfg file
    3. Change the name of the language folder that this directive is targeted at - the language AFTER the languages/ part of the target line to another language
    4. Change the Place Level Descriptions to that language - Make sure you leave each word(s) surrounded by the " marks with each line ending with a ;
    5. Save the changes to the .cfg file
  6. You can now upload the Mod folder and .cfg file to the mods folder on your site, and install the Mod as usual.
  7. NOTE - you will need to make these changes each time the Mod is updated and you install that update.

Changing the Place Level Descriptions - Method 2

NOTE - this Mod as supplied, only supports UTF-8 languages, plus English. If your site is NOT running as UTF-8, then you will need to save the .cfg file as Windows (Latin 1) (this is what BBEdit on Mac OS calls it) before uploading it to your site.

Another way to change the provided Place Level Descriptions is to provide your chosen descriptions in the cust_text.php file of each of the languages that your site supports:

  1. Install the Mod as provided. It will install the list of place levels into the following language files:
    languages/English
    languages/English-UTF8
    languages/French-UTF8
    languages/Spanish-UTF8
    languages/Italian-UTF8
    languages/German-UTF8
  2. Open the cust_text.php file that is in each of these language folders and
    1. Copy the block of Place Level Descriptions that is above the line
      //Mods should put their changes before this line, local changes should come after it.
    2. Paste the copied text BELOW the line
      //Mods should put their changes before this line, local changes should come after it.
      and BEFORE the final closing
      ?>
      line.
    3. Make your changes in this block of text. This block will remain in the file cust_text.php even after the Mod is Uninstalled, so preserving your changes
    4. Save the changes to the file.
  3. Repeat for all of the other languages your site supports.
  4. This method also works if your site supports other languages not supported by the Mod - copy that block of text from one cust_text.php file and paste it into the cust_text.php file of all the other languages your site supports, and provide the translations.

In the event of a problem

  • Try using the Mod Manager Remove capability
  • Or copy the backup versions of the TNG modules involved.

Visualization of this mod

Turns this (TNG 7):

GoogleMapPinsOld.png

or this (TNG8):

GoogleMapPinsTNG8.png

into this

GoogleMapPinsNew.png

more pins in less horizontal space.

This mod can be seen in effect here

Side effects

  • Happiness that your Maps are much more attractive and informative :-)
  • As with most source code modifications, these changes will likely be overwritten during your next TNG revision upgrade and will need to be re-implemented. (Using the Mod Manager to remove the mod before the upgrade and re-installing the mod after the upgrade greatly simplifies this process).


Recent Revision History

This Mod has been around since probably TNG 6.1 which introduced Google Maps in one form or another, and around since the Mod Manager came into existence. Recent updates are shown here

Mod Version TNG Versions Date Note
v12.0.0.3 TNG 12+ 5 October 2020 An update to bring the translated text into line with the English text.
v12.0.0.2 TNG 12+ 3 October 2020 An update to bring the Mod up to TNG 12 specification, and provide translations into French, Spanish, Italian, and German.
v10.1.0.1 TNG 10.1, TNG 11 8 March 2018 An update to bring the Mod up to TNG 10.1 specification.

Sites using this mod

If you download and install this mod, please add your TNG site to the table below

URL User Note Mod-Version TNG-Version User-language
Roger's Online Genealogy Roger Moffat The mod developer. 12.0.0.3 13.0 EN
Our Roy and Boucher Family Ken Roy I override the $text for the additional place levels. 12.0.0.2 13.0.0 EN, FR
AppeltHaus Genealogy Lawrence Appelt Not a Public Site. 0.0.0 10.1.0 EN
Kemp(e) Family History Andrew Kemp see User:Kempons see User:Kempons EN
g.nomi William Vincent 9.0.0.1 9.2.2 EN
Andersson - Hoppe - Sahlin - Thorell Erik Hoppe Public / Private 10.1.0.1 11.1.2 SE, EN, DE
DJCM.DK Claus Martinussen Public site 10.1.0.1 10.1.3 DK, EN
The Dutton's of Vermont Genealogy & History Darrin Dutton Public site 10.1.0.1 11.1.1 EN
Woking Family Tree Project Pete Smee Public and private site v10.1.0.1 v12.1 English
Thurmon King's New Sackett Family Database (The Sackett Family Association) Ted Smith Public and private site 10.1.0.1 12.0.2 EN

TNG modules Involved

In TNG 12 and above

TNG version: 12.0.0

In TNG V12 and above, this mod

  • modifies existing TNG files personlib.php, getperson.php, mapconfig.php, admin_mapconfig.php, admin_updatemapconfig.php
  • adds 5 new pins of different colours to the img folder
  • adds a script google_text_marker.php that superimposes a text string on the bottom of the image of a pin
  • adds text to languages/English/cust_text.php and languages/English-UTF8/cust_text.php, and translations of that text, provided by Pierre Landry, to languages/French-UTF8/cust_text.php, languages/Spanish-UTF8/cust_text.php, languages/Italian-UTF8/cust_text.php, and languages/German-UTF8/cust_text.php,
  • installs a TrueType font - LiberationSans-Regular - that is used to put the text on the pins.

In TNG 8 and above

TNG version: 8.0

In TNG V8 and above, this mod

  • modifies existing TNG files personlib.php, getperson.php, mapconfig.php, admin_mapconfig.php, admin_updatemapconfig.php
  • adds 5 new pins of different colours to the img folder
  • adds 2 scripts that can update your current place levels in the tng_places table - update_ChangePlaceLevels.php, update_ChangePlaceLevelsAuto.php
  • adds a script google_text_marker.php that superimposes a text string on the bottom of the image of a pin
  • adds text to languages/English/cust_text.php and languages/English-UTF8/cust_text.php
  • installs a TrueType font - LiberationSans-Regular - that is used to put the text on the pins.

In TNG 7

TNG version: 7.0

In TNG V7, this mod

  • modifies the personlib.php, getperson.php, mapconfig.php
  • adds 5 new pins of different colours to the googlemaps folder,
  • adds admin/dbupdateChangePlaceLevels.php, admin/dbupdateChangePlaceLevelsAuto.php, googlemaps/text_marker.php as new scripts
  • adds text to English/cust_text.php
  • installs a TrueType font - LiberationSans-Regular - that is used to put the text on the pins.