Map Query



This is my first plugin so I hope you find it useful.

The aim of this Plugin is to allow tends in family data from Family Historian to be plotted on a map. It extracts data from Family Historian and this is presented to google maps for plotting. Markers can be added to maps to indicate family event locations and lines joining related events and sequenced in a user defined order.


The plugin is based on Mike Tate's Map Facts plugin and uses his code for extracting place names from a Family Historian database and adding geographic coordinates using google geolocation service.

There are 3 steps to producing a map.

  1. The first step is to use the GeoLocation tab of the plugin to extract the location data and add the geographic coordinates to them to form a geographic database for the locations in the FH database.
  2. The second step is to write a query in FH to extract the required data and then save it to a CSV file. See Notes below for further guidance on writing queries.
  3. The third step is to define the layout of the required map and specify which columns the data is to come from in the CSV data query file. Then finally save the finished map to a web html file. It is possible to change the settings until you arrive at the map you want.

It is advised that you read the section on the Create Map tab to understand how the CSV data is used in the plugin to annotate the maps before you set up your query in FH.


When you first open the plugin there are 3 tabs in view, one each for Geocode location plots, Create Map and Set Preference Options. Under the Set preference options there are three tabs; Location Plot Options, Web page Map Options and Database Management. The Geocode tabs, i.e. Geocode Location Plots, Location Plot Options and Database Management are the same as in the Map Facts plugin. The help and advice button still points to the Map Facts plugin help - sorry I have not written my own help yet - but that help will describe how to use the Goecode tabs.

Web Page Options tab: This defines the layout of the map to be produced. It has a simple example map below so you can see the affect of the various options. In the box at the top you define where you want the web page you generate saved. The Set Maps Folder opens a file dialog so you can navigate to folder you want. The other controls are used to define the annotation requirements for the map. As you change the options the example map display will change to show you what the option will look like.

There are three types of annotation that can be applied to a marker. A label is displayed over the maker and can be seen all the time. A caption is displayed when you hover the mouse cursor over the marker. The fact data is displayed when you click on a marker and is a larger box displayed beside the marker. Since the fact box is bigger you can put more data into it. It is possible to have more than one piece of data for each location. The plugin will assemble these data for each location. The dropdown boxes allow you to choose whether it is assembled into one line or separate pieces of data are displayed on separate lines. There is also an option to turn this off all together for each annotation type.

For the lines you can change the thickness and the colour of the lines.

The two tick boxes to the left allow you to turn off or on markers and line independently.

Create Map Tab This is where you define what is to be displayed. The top control allows you to indicate the CSV file you produced from query in FH and what to use to produce the map. Once you have defined the CSV file you want to use a numbered list of the fields of the first line is displayed in the big control on the right. This allows you to see how the records are split and can allocate the field to annotations.

The most important field to define is the place field and the control takes the field number of the field that contains the place to be plotted and is used to match the place in the geocode database. The controls labelled Caption, Fact and Label defines the fields from which their respective data are collected for the marker annotation. The group and order field defines how lines will be drawn. The group field defined those locations between which line will be drawn. The order defines the sequence in which the lines will be drawn. The line will have arrows so this order can be seen on the map.

Once these parameters have been set click the plot button and the map will be displayed in the map at the bottom of the plugin window. This will include the annotation as selected in the options so you can see how it will look. When you are happy with how the map looks you can save the map by clicking the Save button. There is a control to let you enter a title for the map.


  1. It took me a while to figure out in the FH query how to do some simple field manipulations to get them the way I wanted to plot out. I give here some of the useful functions I used in the end.
    1. To concatenate two strings together there is the CombineText function.
    2. If you use an Event query you get an individual's name by using =FactOwner(%FACT%, 1,MALES_FIRST).
    3. If you use an Event query and want to get a sub-field of name, e.g. surname use the following form, =FieldText(FactOwner(%FACT%,1,MALES_FIRST),'INDI.NAME:SURNAME').
  2. Do not try to put too many markers onto your map. You will find that the page will be very slow to respond. I did this the first time I tried to produce a map and the whole thing almost ground to a halt and it took several sections just to move the view on the map.

map_query_0.4.fh_lua Map Query


Section Map Query