Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 10.2   10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4   11.5    Statistic    FMM    Blog  


Adds a polygon to the map.

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


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


Returns identifier or error.


Adds a polygon 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, x and y pair or address value.
titleThe title for the polygon.
subtitleThe subtitle for the item.
fillColorThe fill color as name or hex notation for the polygon.
strokeColorThe stroke color as name or hex notation for the polygon.
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.


Add polygon from Hamburg to Munich and Cologne:

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

Add polygon with some coordinates:

Set Variable [ $r ; Value: MBS( "MapView.AddPolygon"; $$MapView; "{
{\"longitude\": 7.3, \"latitude\": 50.4},
{\"longitude\": 7.3, \"latitude\": 50.5},
{\"longitude\": 7.4, \"latitude\": 50.5},
{\"longitude\": 7.4, \"latitude\": 50.4}
    \"strokeColor\": \"#FF000077\"

See also

Release notes

Example Databases

Blog Entries

Created 11st September 2019, last changed 20th September 2019

MapView.AddPoint - MapView.AddPolyline

Feedback: Report problem or ask question.

MBS Xojo blog

Start Chat