Show some markers from data list

Hi Dears.
i wrote attached blocks for showing markers on map from list of data. data list items number varies with respect to user selection at beafore steps and may be more or less . therefore number of items is not fix. i decided show 8 markers but there is some problems:
1-if list item less than 8, i have error " selecting from item that is not exist"
2-if list item more than 8, i cannot show those.
how can i correct it. thanks for your tips. have eight design time Markers on your Map. Every time you use your Display Button you instruct your app to provide coordinates for eight locations; even though your current List has less then 8 items in it the app attempts to provide coordinates for all eight items. You instruct the event handler to always attempt to provide coordinates for item 8, this causes the error.

You might handle this by using conditional statements. Only fill Markers with information based
on the number of items in your List. Possibly use a for each number ... or for each item block to iterate through those values. If you only have four items, only display and populate four Markers.
Here are some topics to review:

I expect you have a larger issue; the design of your project inappropriate to the type of data available but you didn't describe the Project, only your current problem.

Either use run time markers or provide a sufficient number of design time markers to allow populating all markers with coordinates. If you have 20 items, you need 20 design time markers.

A partial solution to your dilemma might be to learn to use run time Markers. Run time Markers are more flexible dealing with large numbers of Markers, however their programming is more complex. Have you done the National Parks Tutorial? The National Parks tutorial demonstrates how to plot multiple run time markers using a csv file to an OpenStreetMap. Use the list from csv Block to convert the csv to a List. What you do depends on how you make your List, where it is stored or is downloaded from.

Use the community search function to find articles discussing markers maps to find more tutorials and discussions about how to work with maps and map Markers efficiently.

Good luck.

Hi Steve
Thank you. I did that with following runtime marker.
but i want to have different color for markers and i wrote codes for fillcolor, that isn't working.
How i can have different color for markers?

thanks a lot.

What you do depends on whether various Markers have to be colored in specific colors or the color can be random. You could provide a List of Colors and select from it randomly if you don't care what color each user is assigned or you could include that information as index 19 or ? in your database.

What you tried cannot work ; re-readi Colors blocks . It will help you understand why what you tried did not work. If you don't care what colors are chosen, try


to generate random Marker colors; else do something more elaborate w.r.t. your database. Either the upper or lower example should work. :slight_smile:

Thank you for your very good guidance. You helped me a lot in writing this App.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.