Terry's Second Site Tips

Adding Map Links to Your Person Pages

This page created 8 Feb 2016

Version note: Applies to Second Site 6 & 7

The Mapping Services feature includes links to an online Map Service when Places in your TMG Project appear in your Person Pages. If you enable the feature, the links are created automatically from the Place data recorded in event Tags in your Project. These links can add a new dimension to the family history accounts in your site. An example of these links in a Person Page can be see on my Narrative family history site.

This article describes some of the aspects of using this feature. Other articles in my Second Site Section cover other topics about customizing your site. This article assumes the reader is familiar with the basic steps in creating a site with Second Site, as described in my Second Site Basics article.

Topics Included in this Article
Defining a Location Defining a Place by its name or by coordinates
Enabling Map Service Links Turning on and managing the feature
Excluding Links on Specific Places Omitting links for specific place records
Specifying an Alternate Place Record Entering an alternate place for linking when the entered Place fails
Including Links on Specific Places Without Coordinates Including links for places without coordinates when "Only Places with LatLong" is checked
Forcing Links for Specific Tags Creating links when the [L] Sentence Variable is missing

Overview

Second Site's Map Service Link feature provides links to the major online map services so the reader can view maps. Information drawn from the Place data in your TMG Project is sent to the service so the map displayed centers on the identified place, which is marked on the map display. You choose the map service or services to be used and have some options in how the place is identified and which places receive the links. While viewing the map the reader has all the features of that service available, and can change the position, zoom level, and map style, and view associated images if available.

Maps may be included in sites posted on the Internet, or on sites distributed on CDs or thumb drives. The maps are accessed online when the reader views them, so if placed on sites on a CD the reader would need a live Internet connection to see them.

Defining a Location

Places can be defined to the map service in either of two ways. If you include coordinates in the LatLong field for the Place in the Tag Entry screen, the map service will center the map on that place and place a marker at those coordinates. If you do not include coordinates the place as described by the other Place fields will be sent to the map service, and it will attempt to identify the place using a process known as geocoding. The success of geocoding depends on a number of factors, including the type of data you have entered and the capabilities of the mapping service. Each method has its advantages and disadvantages, as shown in this table:

Method Advantages Disadvantages

Geocoding:

  • No need to find and enter coordinates
  • Place labeled on map
  • Map may include outline of area
  • Photos of place may be included
  • Does not work for all places, especially historic place names and very specific locations, like a tombstone
  • May display the wrong place

Coordinates:

  • Works for all places
  • Implies unintended precision by marking a specific point when a large area, such as city or state is referenced

There is no need to use only one method. You can specify that only places with coordinates be used, but alternatively you can choose to use coordinates only for place records that include them and use geocoding for the others.

I prefer to use geocoding for places where it works because in my view the resulting maps work better. The maps include labels for the specified places, and in the case of Google Maps include an outline on larger places, like a city, county, or state. Google Maps also includes photos for many places, which is especially effective when the place record includes a street address, as for an ancestor's home.

When geocoding produces the wrong place, or fails to identify any place at all, you can resolve the problem by:

Enabling Map Service Links

You manage the Map Service Link feature from the Data > Places section in Second Site:

Edit Map Screen

You enable the links by checking one or more boxes for "Mapping Services." You can choose more than one, which is helpful in evaluating the results for the various services for the places contained in your data. However for actual use I think using only one (or both in the case of Bing Maps) works best. The different services have quite different presentations so previewing each to see what it does with your data is a good idea. Note that the list of mapping services may change as updates of Second Site are released in response to user suggestions and to mapping services ceasing operations.

To have links only for places which contain coordinates, check the "Only Places with LatLong" box. That box is checked by default. To use the coordinates when they are entered and use geocoding for other places, leave the box unchecked.

By default the link appears as a superscripted letter, like a footnote reference number. The letter "B" is used for Bing Maps, "G" for Google Maps, etc. I prefer having an icon appear as the link instead, as can be seen on my Narrative family history site. To use the icon check the "Use Icon for Links" box. The default icon looks like this: mlicon

You could provide a different icon if you prefer by finding or creating a suitable icon as a png file, and saving it with the name ml.png in the Input ( "-i" ) folder for your site.

Second Site produces Mapping Service Links when the[L]variable is present in the Sentence of the Tag. It is not produced by variables that address only specific Place parts, such as[L2]or[L5]. To produce links from Tags with Sentences that do not include the[L]variable you must include the Second Site-only variable[SS-L-LINKS], as described in the section on Forcing Links for Specific Tags below.

Excluding Links on Specific Places

Second Site includes filters to avoid attaching links to some places that are unlikely to produce useful maps. For example, places with data only in the Details field are very unlikely to geocode successfully, so links are automatically not produced for these places. However Second Site cannot identify all places for which geocoding will fail. For example, genealogists are generally urged to record the place name as it was known at the time of an event, but obsolete place names often cause geocoding to fail. In addition, you may decide that links for certain types of places, such as those are defined as only as a state or only a country, are not useful.

You can instruct Second Site to omit the link for any place by adding a special code in any place field or in the Comments field for that place. The Comments field can only be accessed and viewed from the Master Place List. I think it is better to use a field that appears in the Tag Entry screen so you can see that it is present when editing a Tag. You can use any field that is not in use. In order to avoid the code appearing in TMG reports, it is probably best to enclose it in hidden codes, like this:

[HID:][:NO-PLACE-MAP-LINK:][:HID]

The code can be entered in individual Tags, or for any place by using the Master Place List. You can apply the code to all places that meet a specific criteria by the use of John Cardinal's TMG Utility. For example, I found that geocoding doesn't work for places using the name "Königreich Sachsen," the former Germanic state. So I applied the code to the Temple field of all Places that include that name in the State field using the Change Place Parts feature of the Utility.

To do that, open the Utility to the Places > Change Place Parts section:

Map Editor

Always make sure you have a current backup before making any changes to your project with the Utility. It has the power to do great damage to your Project if a mistake is made.

The "Rules" the Utility uses to make the changes are specified by clicking the "Set Rules..." button to open the Rules Editor:

The Rules consist of two parts: the Filters, in the upper half of the screen, specify which Place records are to be changed; and the Actions, in the lower half of the screen, which specify which changes are to be made. In this case, I wanted to add the code to all Place records which contain "Sachsen" in the State field, so I created a Filter to find those records. I wanted to add the code to the Temple field, so I created an Action to do that.

Filters and Actions are created by using the drop-downs and text fields below their respective boxes. They are then entered by clicking the "Add..." or "Update..." buttons on the right. When the rule is completed click the OK button to return to the main Utility Screen.

It is always wise to test a proposed change by checking the "Log Only" box near the bottom of the screen and then clicking the "Change Place Parts" button. The Utility will make a test run, and a log opens to show which records will be changed. Review the log carefully to be sure the Rules are identifying the correct records.

When you are satisfied uncheck the "Log Only" box and click the "Change Place Parts" button again. The Log will open showing which records were changed and the resulting changes.

Should you decide to add coordinates, or an alternate place record as described next, to some of the Places that have been excluded you can do so either in the Tag Entry screen for specific Tags, or in the Master Place list for all occurrences of that Place. Remember to remove the [:NO-PLACE-MAP-LINK:] code when you do so.

Specifying an Alternate Place Record

Geocoding may fail to locate the correct place from the data you have entered in the Place fields, or may fail to locate any place at all, even though place fields containing data may make the built-in filter expect it to work. This commonly happens when the names entered in one or more fields were in use at the time of the event but are now changed. Instead of excluding link for them as described above, you can enter the current name in a special code without changing the names entered in the Tag. The advantage of entering a current name rather than entering coordinates is that the resulting map may display the name of the place, or outline it, rather than marking a single point.

The code may be entered in any place field or in the Comments field for that place. The Comments field can only be accessed and viewed from the Master Place List. I think it is better to use a field that appears in the Tag Entry screen so you can see that it is present when editing a Tag. You can use any field that is not in use. In order to avoid the code appearing in TMG reports, it is probably best to enclose it in hidden codes, like this:

[HID:][GEO-PLACE:]Klosterbuch, Leisnig, Germany[:GEO-PLACE][:HID]

In the example above I entered the modern name for the place that is entered in my database as "Klosterbuch, Königreich Sachsen" because my mapping service cannot find the location using the obsolete name. It may be helpful to explore the place directly with your selected mapping service to find which place string works best.

When entering a place in the code, Second Site has to know which place parts you are entering. It assumes the level of each place part entered by how many parts, separated by commas, you enter, as shown in this table:

Number
of Parts
Assumed Fields
1 Country
2 State, Country
3 City, State, Country
4 City, County, State, Country
5 Detail, City, County, State, Country
6 Addressee, Detail, City, County, State, Country

For best results, you should always include a country and state if possible to help Second Site format the link correctly. If you find including one or both of these parts does not work well with your mapping service, proceed that element with an exclusion mark (hyphen) so that Second Site can use the information internally but not pass it to the mapping service.

If any parts are being omitted you should include the commas as if they were entered, but leave the space between them empty. For examples, some mapping services do better without the county in some cases, so if you might get better results entering the place name in this format:

[HID:][GEO-PLACE:]Detail, City,, State, Country[:GEO-PLACE][:HID]

The code can be entered in individual Tags, or for any place by using the Master Place List. You can apply the code to all places that meet a specific criteria by the use of John Cardinal's TMG Utility as described in the previous section.

Including Links on Specific Places Without Coordinates

If you have checked the "Only Places with LatLong" box you may decide that specific places should include links using geocoding rather than coordinates. For example, you may decide that places that include an entry in the Details field will work better allowing the mapping service to locate them by geocoding if your service will provide photos of the address.

You can instruct Second Site to include a link for such places by not entering coordinates and adding a special code. The code can be placed in any place field or in the Comments field for that place. The Comments field can only be accessed and viewed from the Master Place List. I think it is better to use a field that appears in the Tag Entry screen so you can see that it is present when editing a Tag. You can use any field that is not in use. In order to avoid the code appearing in TMG reports, it is probably best to enclose it in hidden codes, like this:

[HID:][:PLACE-MAP-LINK:][:HID]

This code overrides not only the "Only Places with LatLong" box option, but also the built-in filters that attempt to suppress links that are not expected to geocode successfully. If you use it be sure to test that the place does in fact produce successful links.

The code can be entered in individual Tags, or for any place by using the Master Place List. You can apply the code to all places that meet a specific criteria by the use of John Cardinal's TMG Utility as described above.

Forcing Links for Specific Tags

The Map Service Link feature will create a link when the[L]variable is appears in the Sentence for the subject of the Person Page entry, subject to the restrictions described above. If that variable is not used, for example if you use variables for specific Place fields to control the order of the place elements, you can force the link to appear by placing a special Second Site-only Variable in the Sentence:

<[HID:][SS-L-LINKS][:HID]>

The Variable will produce a link for all places or only those with coordinates entered in the LatLong field, depending on whether the "Only Places with LatLong" box is checked or not. The Variable applies whether or not Sentences are actually used in your Second Site output. If you do use Sentences for your website you must place the Variable where you want the link symbol or icon to appear in the output, just as you do for regular Sentence Variables and text.

The Variable can be placed in the Tag Type Sentences, and will then apply to all Tags of that type that do not have local Sentences. If you have created local Sentences for some Tags and what to apply the Variable to them, you must update each Tag individually. Fortunately, the Find and Replace function in the TMG Utility will do that task with little effort.

To do that, open the Utility to the Other > Find and Replace section:

Setting Points

Always make sure you have a current backup before making any changes to your project with the Utility. It has the power to do great damage to your Project if a mistake is made.

In the "Field to change" drop-down select "Event Sentence." In this context, the "Event Sentence" means the Sentences for all persons entered in the Tag, whether as Principals or Witnesses.

Next, find a text string that will uniquely identify the Sentences you want to change, and only those Sentences. In this case I wanted to add the code to Sentences in my custom Census Tag. To be sure the text did not match the Sentences in any other Tags I included the word "Census." Enter it in the "Find what" field.

Then repeat that same text string in the "Replace with" field, adding in the Variable.

The text I used is difficult to see in the small window in the screenshot, so I will repeat it below. For the "Find what" field I used:

Census of< [LCI],>< [LCN],> [LS] in the household

For the "Replace with" field I used:

Census of< [LCI],>< [LCN],> [LS]<[HID:][SS-L-LINKS][:HID]> in the household

It is always wise to test a proposed change by checking the "Log Only" box near the bottom of the screen and then clicking the "Find All" button. The Utility will make a test run, and a log opens to show which records will be changed. Review the log carefully to be sure the Find string is identifying the correct records.

When you are satisfied uncheck the "Log Only" box and click the "Replace All" button again. The Log will open showing which records were changed and the resulting changes.

Conclusion

The Mapping Service Link feature makes an interesting addition to sites created with Second Site. I find it especially effective for cases where you have a specific address if your mapping service has photos of that address. But it is useful in other cases as well if your readers may not be familiar with the area being described. They can locate the area and explore it in a wider context, or switch to the Satellite view and get a detailed image of the area.


ReigelRidge Home Terry's Tips Home Contact Terry

 

 

Copyright 2000- by Terry Reigel