MapView.AddPoint
----------------

Adds a point or pin to the map.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [MapView](component_MapView.md) | [9.4](newinversion94.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "MapView.AddPoint"; MapView; JSON ) 

**MBS**( **"MapView.AddPoint";** /\* Adds a point or pin to the map. \*/  
**$MapView**; /\* The map view reference number.e.g. $$MapView \*/   
**$JSON**) /\* The JSON to describe the point. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| MapView | The map view reference number. | $$MapView |
| JSON | The JSON to describe the point. |  |

### Result

Returns identifier or error.

### Description

Adds a point or pin to the map.  
The JSON may contain the following entries:  
| latitude | The latitude of the coordinate. |
|---|---|
| longitude | The longitude of the coordinate. |
| address | The address to lookup to find latitude or longitude. |
| radius | The radius in meter. |
| title | The title for the pin. |
| subtitle | The subtitle for the item. |
| color | The color as name or hex notation for the pin. |
| identifier | The identifier to use. Can be empty to get new identifier auto assigned. |
| image | The base64 encoded image data to use. |
| imageWidth | Optional the image width to use. |
| imageHeight | Optional the image height to use. |
| clusteringIdentifier | Optionally an identifier that determines whether the annotation view participates in clustering. |
| displayPriority | Optionally the display priority of this annotation view. Can be Required, High, Low or Default. |

  
New in 9.5 are some boolean keys named enabled, draggable and canShowCallout to customize behavior.  
  
You can either pass latitude and longitude together or pass the address and we lookup it to find coordinates.  
### Examples

Create MBS Pin on map with custom image:

 Set Variable \[ $json ; Value: "{ \\"address\\": \\"Nickenich\\", \\"title\\": \\"Monkeybread Software\\", \\"subtitle\\": \\"MBS is here\\", \\"imageWidth\\": 40, \\"imageHeight\\": 40 }" \]   
\# add image from container field to JSON   
Set Variable \[ $json ; Value: MBS ( "[JSON.AddStringToObject](JSONAddStringToObject.md)"; $json ; "image"; Base64Encode ( MapView::image ) ) \]   
\# show   
Set Variable \[ $r ; Value: MBS ( "MapView.AddPoint"; $$MapView ; $JSON ) \]  
Adds simple pin for Hamburg:

 Set Variable \[ $r ; Value: MBS ( "MapView.AddPoint"; $$MapView ; "{ \\"address\\": \\"Hamburg, Germany\\", \\"title\\": \\"Hamburg\\"}") \]  
Create circle of pins around current region:

 # create some pins on a circle around a given point   
Set Variable \[ $centerLat ; Value: MBS ( "[MapView.GetCenterCoordinateLatitude](MapViewGetCenterCoordinateLatitude.md)"; $$MapView ) \]   
Set Variable \[ $centerLon ; Value: MBS ( "[MapView.GetCenterCoordinateLongitude](MapViewGetCenterCoordinateLongitude.md)"; $$MapView ) \]   
\#   
\# loop counting up from 1 to $count   
Set Variable \[ $count ; Value: 12 \]   
Set Variable \[ $index ; Value: 1 \]   
If \[ $index ≤ $count \]   
 Loop  
 # your script steps here  
 Set Variable \[ $angle ; Value: 360 \* ($index / 12) \]   
 Set Variable \[ $a ; Value: $angle / 180 \* Pi \]   
 #   
 # calculate new coordinates  
 Set Variable \[ $fLat ; Value: ,005 \]   
 Set Variable \[ $fLon ; Value: ,01 \]   
 Set Variable \[ $lat ; Value: $centerLat + Sin($a ) \* $fLat \]   
 Set Variable \[ $lon ; Value: $centerLon + Cos($a ) \* $fLon \]   
 #   
 Set Variable \[ $json ; Value: "{}" \]   
 Set Variable \[ $json ; Value: MBS ( "[JSON.AddNumberToObject](JSONAddNumberToObject.md)"; $json ; "latitude"; $lat ) \]   
 Set Variable \[ $json ; Value: MBS ( "[JSON.AddNumberToObject](JSONAddNumberToObject.md)"; $json ; "longitude"; $lon ) \]   
 Set Variable \[ $json ; Value: MBS ( "[JSON.AddNumberToObject](JSONAddNumberToObject.md)"; $json ; "clusteringIdentifier"; "pin") \]   
 Set Variable \[ $r ; Value: MBS ( "MapView.AddPoint"; $$MapView ; $JSON ) \]   
 #   
 # next  
 Set Variable \[ $index ; Value: $index + 1 \]   
 Exit Loop If \[ $index &gt; $count \]   
 End Loop  
End If  
### See also

- [JSON.AddNumberToObject](JSONAddNumberToObject.md)
- [JSON.AddStringToObject](JSONAddStringToObject.md)
- [MapView.AddPin](MapViewAddPin.md)
- [MapView.AddPinWithAddress](MapViewAddPinWithAddress.md)
- [MapView.AddPolyline](MapViewAddPolyline.md)
- [MapView.GetCenterCoordinateLatitude](MapViewGetCenterCoordinateLatitude.md)
- [MapView.GetCenterCoordinateLongitude](MapViewGetCenterCoordinateLongitude.md)

### Release notes

- **Version 9.5**
    - Added enabled, draggable and canShowCallout keys for [MapView.AddPoint](http://www.mbsplugins.eu/MapViewAddPoint.shtml) function.
    - Changed [MapView.AddPoint](http://www.mbsplugins.eu/MapViewAddPoint.shtml), so you can pass imageWidth or imageHeight or both.
- **Version 9.4**
    - Added [MapView.AddPoint](http://www.mbsplugins.eu/MapViewAddPoint.shtml), [MapView.AddPolyline](http://www.mbsplugins.eu/MapViewAddPolyline.shtml) and [MapView.AddPolygon](http://www.mbsplugins.eu/MapViewAddPolygon.shtml) functions.

### Example Databases

- [Mac and iOS/MapKit/MapView BeeExample](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/MapKit/MapView%20BeeExample.shtml#3ScriptAnchor_)
- [Mac and iOS/MapKit/MapView Click Polygons](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/MapKit/MapView%20Click%20Polygons.shtml#12ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 11 - Know Your Way](https://www.mbsplugins.de/archive/2024-12-11/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [Neue Funktionen des MBS FileMaker Plugin 9.4](https://www.mbsplugins.de/archive/2019-10-05/Neue_Funktionen_des_MBS_FileMa/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.5pr1](https://www.mbsplugins.de/archive/2019-10-02/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.4pr7](https://www.mbsplugins.de/archive/2019-09-12/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 3/2022, Seite 24](https://filemaker-magazin.de/neuigkeit/4187-Appetithappen-FMM_202203)

This function is free to use.

Created 10th September 2019 , last changed 9th April 2020

  
[MapView.AddPinWithAddress](MapViewAddPinWithAddress.md) - [MapView.AddPolygon](MapViewAddPolygon.md)

[HTML Version](MapViewAddPoint.shtml)