A little more than a year ago I wrote how to make a clickable map in FileMaker using a web viewer. The fmp protocol was a little bit limited in the FileMaker desktop version back then, but with the new possibilities in 13v2 it is more useful!
If you, unlike me, have any drawing skills you can produce SVG images using Illustrator or any other image processing software capable of exporting to SVG. Instead I have found a map of Sweden with different regions on Wikimedia which I will use.
The idea is to click on a Swedish region on the map and show the population (using data from SCB 2009) for the selected region. It might as well be other information, sales figures for stores in their region, or budget for the region, etc.
In the FileMaker database I have 2 tables. I have one table of population figures for each region, there are 25 records with 5 fields (id, name, total, male and female). The second table has only one record with the map in SVG format (I’ve pasted the entire XML file in a plain text field), a global field with the ID number of the selected region, and a calculation field where I have choosen to highlight the selected region with a different color. The calculation field with the map is displayed in a web viewer. In the same layout is also a chart where I display the figures for the selected region in a simple bar graph.
I have added a link for each region in the SVG file. The link uses the fmp protocol to send the ID of the selected region to FileMaker, the link looks like this:
When the user clicks a region it runs the script ”ShowRegion” with the region id as an argument (the id is 24 in the link above). The script is short and easy, it sets a global field with the script argument which triggers the graph and updates the web viewer as the next step.
I have also added a small marker in the SVG file for each region, I replace the marker with a colour to highlight the selected region with a Substitute calculation. The resulting field is displayed in a web viewer with the following calculation:
"data:text/html, " & Sverigekarta::KartaSVG
You can download the sample file here: SwedishMap.fmp12. It should work on both Mac, Windows and iOS. Please note: For Mac and Windows it requires 13.0v2 or above.