Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MapView.AddPolyline

Adds a poly line to the map.

Component Version macOS Windows Linux Server iOS SDK
MapView 9.4 ✅ Yes ❌ No ❌ No ❌ No ✅ Yes
MBS( "MapView.AddPolyline"; MapView; JSON )   More

Parameters

Parameter Description Example
MapView The map view reference number. $$MapView
JSON The JSON to describe the circle.

Result

Returns identifier or error.

Description

Adds a poly line to the map.
The JSON may contain the following entries:
coordinatesThe JSON array with the objects for the coordinates. Each entry can contain either longitude & latitude pair or address value.
titleThe title for the poly line.
subtitleThe subtitle for the item.
fillColorThe fill color as name or hex notation for the line.
strokeColorThe stroke color as name or hex notation for the line.
identifierThe identifier to use. Can be empty to get new identifier auto assigned.
lineWidthThe line width to use. Default 5 point.

You can either pass latitude and longitude together or pass the address and we lookup it to find coordinates.

Examples

Add poly line from Hamburg to Munich and Cologne:

Set Variable [ $r ; Value: MBS( "MapView.AddPolyline"; $$MapView; "{ \"coordinates\": [{\"address\": \"Hamburg, Germany\"}, {\"address\": \"Munich, Germany\"}, {\"address\": \"Cologne, Germany\"}], \"strokeColor\": \"#FF000077\" }") ]

Draw a line with several stops and using coordinates:

Set Variable [ $json ; Value: "{ \"coordinates\": [], \"strokeColor\": \"#FF000077\" }" ]
Set Variable [ $json ; Value: JSONSetElement ( $json ; "coordinates[0]" ; JSONSetElement("{}"; ["latitude"; 53.550556; JSONNumber]; ["longitude"; 9.993333; JSONNumber]) ; JSONRaw ) // Hamburg ]
Set Variable [ $json ; Value: JSONSetElement ( $json ; "coordinates[1]" ; JSONSetElement("{}"; ["latitude"; 52.518611; JSONNumber]; ["longitude"; 13.408333; JSONNumber]) ; JSONRaw ) // Berlin ]
Set Variable [ $json ; Value: JSONSetElement ( $json ; "coordinates[2]" ; JSONSetElement("{}"; ["latitude"; 50.110556; JSONNumber]; ["longitude"; 8.682222; JSONNumber]) ; JSONRaw ) // Frankfurt ]
Set Variable [ $json ; Value: JSONSetElement ( $json ; "coordinates[3]" ; JSONSetElement("{}"; ["latitude"; 48.137222; JSONNumber]; ["longitude"; 11.575556; JSONNumber]) ; JSONRaw ) // Munich ]
Set Variable [ $r ; Value: MBS( "MapView.AddPolyline"; $$MapView; $json) ]

See also

Release notes

Example Databases

Blog Entries

This function is free to use.

Created 11st September 2019, last changed 22nd August 2022


MapView.AddPolygon - MapView.Annotations