Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples
New in version: 9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3    Statistic  


Creates a map snapshot.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
MapView 9.0 Yes No Yes, macOS only No Yes
MBS( "MapView.Snapshot"; Options { ; ImageType; Filename } )   More


Parameter Description Example value
Options The options as JSON block.
All values are optional and have default.
"{\"width\": 800, \"height\": 600}"
ImageType Optional
The type of image to return. Either JPEG, PNG, GIF or BMP. Default is JPEG.
Filename Optional
The filename to use for the picture. Default is "image" with the extension matching the image type.


Returns image or error.


Creates a map snapshot.
Not sure if this works on server!

Keys in the JSON include:
widthThe pixel width requested. Default is 256.
heightThe pixel height requested. Default is 256.
scaleThe scale of the display, defaults to screen scale. Only for iOS.
showsPointsOfInterestWhether to show points of interests. Pass 1 to enable or 0 to disable.
showsBuildingsShow buildings. Pass 1 to enable or 0 to disable.
mapTypePass Standard, Satellite, Hybrid, SatelliteFlyover, HybridFlyover or MutedStandard.
mapRectAn object with x, y, width and height for the map rectangle to show in world coordinates.
regionAn object with region details. Can be degree or meter based for span. latitude and longitude to define center coordinate. Add latitudeMeters/longitudeMeters or latitudeDelta/longitudeDelta to define span.
cameraThe JSON object for camera specification.
appearanceWhich appearance to use for MacOS 10.14. Can be Dark, Light or current. Default is current of Mac.

Camera specification includes center coordinate (latitude and longitude) and can be either looking from eye point (eyeLatitude, eyeLongitude and altitude) or looking from distance (distance, pitch and heading).

Rendering may take a few seconds, but gets faster over time due to caching.


Make a snapshot with all options default:

Set Field [ Snapshots::Image ; MBS( "MapView.Snapshot"; "{}" ) ]

Snapshot with camera:

Set Variable [ $json ; Value: MBS( "JSON.CreateObjectRef" ) ]
Set Variable [ $r ; Value: MBS( "JSON.AddNumberToObject"; $json; "width"; 800 ) ]
Set Variable [ $r ; Value: MBS( "JSON.AddNumberToObject"; $json; "height"; 600 ) ]
Set Variable [ $r ; Value: MBS( "JSON.AddStringToObject"; $json; "mapType"; "HybridFlyover" ) ]
Set Variable [ $r ; Value: MBS( "JSON.AddNumberToObject"; $json; "showsBuildings"; 1 ) ]
Set Variable [ $r ; Value: MBS( "JSON.AddNumberToObject"; $json; "showsPointsOfInterest"; 1 ) ]
Set Variable [ $camera ; Value: MBS( "JSON.CreateObjectRef" ) ]
# The coordinate point on which the map should be centered.
Set Variable [ $r ; Value: MBS( "JSON.AddNumberToObject"; $camera; "latitude"; 40.7457172 ) ]
Set Variable [ $r ; Value: MBS( "JSON.AddNumberToObject"; $camera; "longitude"; -73.9941266 ) ]
# The line-of-sight distance from the camera to the center coordinate of the map.
Set Variable [ $r ; Value: MBS( "JSON.AddNumberToObject"; $camera; "distance"; 3000 ) ]
# The viewing angle of the camera, measured in degrees.
# A value of 0 results in a camera pointed straight down at the map. Angles greater than 0 result in a camera that is pitched toward the horizon by the specified number of degrees. If the map type is satellite or hybrid, the pitch value is clamped to 0.
# The value in this property may be clamped to a maximum value to maintain map readability. There is no fixed maximum value, though, because the actual maximum value is dependent on the current altitude of the camera.
Set Variable [ $r ; Value: MBS( "JSON.AddNumberToObject"; $camera; "pitch"; 70 ) ]
# The heading of the camera (measured in degrees) relative to true north.
# The value 0 means that the top edge of the map view corresponds to true north. The value 90 means the top of the map is pointing due east. The value 180 means the top of the map points due south, and so on.
Set Variable [ $r ; Value: MBS( "JSON.AddNumberToObject"; $camera; "heading"; 28 ) ]
Set Variable [ $r ; Value: MBS( "JSON.AddItemToObject"; $json; "camera"; $camera) ]
Set Variable [ $r ; Value: MBS( "JSON.Release"; $camera ) ]
Set Variable [ $options ; Value: MBS( "JSON.Format"; $json ) ]
Set Variable [ $r ; Value: MBS( "JSON.Release"; $json ) ]
Set Variable [ $image ; Value: MBS("MapView.Snapshot"; $options; "PNG"; "map.png") ]
If [ MBS("isError") ]
    Show Custom Dialog [ "Failed to render map" ; $image ]
    Set Field [ Snapshots::Image ; $image ]
End If

See also

Example Databases

Blog Entries

Created 12nd January 2019, last changed 16th January 2019

MapView.ShowAllAnnotations   -   MarkDown.CSS

Feedback: Report problem or ask question.

MBS Xojo tutorial videos