# Automatic marker in map

**URL:** <https://forum.inductiveautomation.com/t/automatic-marker-in-map/73953>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [May 19, 2023, 1:53pm UTC](https://forum.inductiveautomation.com/t/automatic-marker-in-map/73953 "2023-05-19T13:53:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivano\_Russo](https://avatars.discourse-cdn.com/v4/letter/i/2bfe46/32.png) [@Ivano\_Russo](https://forum.inductiveautomation.com/u/Ivano_Russo)\
**Post date:** [May 19, 2023, 1:53pm UTC](https://forum.inductiveautomation.com/t/automatic-marker-in-map/73953/1 "2023-05-19T13:53:50Z")

</div>

I would like to know how to generate markers to apply on the map, automatically, so as not to repeat the step every time

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 19, 2023, 1:55pm UTC](https://forum.inductiveautomation.com/t/automatic-marker-in-map/73953/2 "2023-05-19T13:55:08Z")

</div>

Automatically from what?

---

<div class="post-metadata">

**Author:** ![Ivano\_Russo](https://avatars.discourse-cdn.com/v4/letter/i/2bfe46/32.png) [@Ivano\_Russo](https://forum.inductiveautomation.com/u/Ivano_Russo)\
**Post date:** [May 19, 2023, 3:49pm UTC](https://forum.inductiveautomation.com/t/automatic-marker-in-map/73953/3 "2023-05-19T15:49:09Z")

</div>

from code, i use this for example

```auto
def runAction(self, event):
	markers = []
	#Tooltip
	TooltipOrientation = 'auto' #top,bottom etc
	TooltipView = {'params':{},'path':'path_to_tooltip_view'}#params which are defined on the path_to_tooltip_view. If You have some, so the code have to be: 'params':{'first_param':value_of_the_first_param,'second_param':value_of_the_second_param}
	tooltip = {'enabled':True,'content':{'text':'Tooltip Tittle','view':TooltipView},'direction':TooltipOrientation,'permanent':False,'sticky':False,'opacity':1}
	#Marker PopUp
	MarkerView = {'params':{},'path':'path_to_marker_view'}#params which are defined on the path_to_marker_view
	content = {'text':'PopUp text','view':MarkerView}
	pan = {'auto':True}
	width = {'max':300,'min':50}
	height = {'max':300}
	IconClasses = {'classes':''}
	icon = {'path':'material/place','color':'(0,0,0)','size':{'width':30,'height':30},'style':IconClasses}
	popup = {'enabled':False,'content':content,'pan':pan,'closeButton':False,'autoclose':False,'closeOnEscapeKey':False,'closeOnClick':True,'width':width,'height':height}
	#Marker
	markers.append({'popup':popup,'name':'New Marker','lat':float(59.252521),'lng':float(24.020222),'opacity':1,'icon':icon,'tooltip':tooltip})
	self.getSibling("Map").props.layers.ui.marker = markers

```

I have to develop this code for an indefinite number of markers

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 19, 2023, 4:18pm UTC](https://forum.inductiveautomation.com/t/automatic-marker-in-map/73953/4 "2023-05-19T16:18:23Z")

</div>

What is the source of the "indefinite number of markers"?

Go to the map component, `props.layers.ui.marker`, and add a binding. Use the binding to bring in the source of the markers. Add a transform script that loops through the results and returns appropriately formatted marker JSON objects.

---

<div class="post-metadata">

**Author:** ![Ivano\_Russo](https://avatars.discourse-cdn.com/v4/letter/i/2bfe46/32.png) [@Ivano\_Russo](https://forum.inductiveautomation.com/u/Ivano_Russo)\
**Post date:** [May 22, 2023, 6:38am UTC](https://forum.inductiveautomation.com/t/automatic-marker-in-map/73953/5 "2023-05-22T06:38:36Z")

</div>

I want to use a for loop to generate multiple markers, how do I do this?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 22, 2023, 3:32pm UTC](https://forum.inductiveautomation.com/t/automatic-marker-in-map/73953/6 "2023-05-22T15:32:07Z")

</div>

Please explain more about what you're doing, because it doesn't make sense to me.

If you're using a for loop to generate these markers...what tells you how many markers to make? How do you know where to put each marker?
