tingalls

Multi-Marker Google Map without Javascript

Discussion created by tingalls on Nov 24, 2017
Latest reply on Nov 24, 2018 by keysolutions

I'm relatively new to FileMaker, and was getting bogged down in trying to figure out the Javascript explanations out there to get a WebViewer to produce a multi-marker Google Map from coordinates. Today I figured out how to do it without javascript, and wanted to share my process. Maybe the FileMaker experts out there can leave some comments about the drawbacks of this approach, which I would be happy to know about.

 

My scenario: We survey historic properties. I needed to make a photo location map to indicate where each photo of the property or historic district was taken from.

Two tables: Property and Photos

Six Fields: Photos::Latitude, Photos::Longitude, Photos::PhotoID, Photos::PhotoLocations

Property::ListPhotoLocations, Property::ListPhotoLocationsConcat

 

The Latitude and Longitude are pulled from the device using Get Location. The PhotoLocations field is an unstored calculation with the result being text. I also added the PhotoID field into the calculation for the marker label.

If (  not IsEmpty ( Latitude ); "&markers=color:red%7Clabel:" & PhotoID & "%7C" & Lat & "," & Long)

 

In the Property table I created two fields: ListPhotoLocations, and ListPhotoLocationsConcat, which are both unstored calculations with a result of text, respectively:

List ( Photos::PhotoLocations )

and

Substitute ( ListPhotoLocations; ¶; "")

 

In a layout based on the Property table, I inserted a WebViewer with the custom address, based on Google's' Static Map API instructions and trial and error:

 

"data:text/html,

<img src="&

 

"https://maps.googleapis.com/maps/api/staticmap?&zoom=19&size=1000x1000&scale=2&maptype=hybrid" & Property::ListPhotoLocationsConcat & "&key=YourAPIKey"

 

&

">"

 

This pulls up a nice map with markers at each photo location around a property, and marked with the Photo ID. I plan to adjust it to allow the user to specify the zoom, and theoretically you could do that with the scale and map type too. I will also be adding a button to allow users to export the map as an image to insert in our reports.

Attachments

Outcomes