I add a bunch of markers to my Google Maps instance when it loads. However, when I try to call the method “Get Markers” to get properties from the markers and print them on a label, this error comes up.
Please send your block images!
When the location changes for the first time, the map generates a bunch of random (location and number) markers. I couldn’t figure out how to add just one marker so I add two every time. The markers list variable was just for testing but it works fine as well.
When I click on a marker to run the On Marker Click method, it returns the error I posted.
First… generating a random numbers and converted into latitude and longtitude? Some case will not create a marker and leave it empty the map, what if a latitude dont match with the longtitude?
Yep, use the variable with a list, create a prodecure where you add an items and clear the list empty and run again.
Its the marker ID issue, because as you said your just generating a random numbers for latitude and long, the coordinates didnt physically exist. So when you click a marker, (ID issue) the marker dont know what u are calling
The script picks the user’s location and randomizes a location near that location, the values of longitude and latitude are randomized within ± 0.017º of the initial location (random fraction maximum is 1, div is a variable declared as 60, 1/60=0.017). No invalid values of longitude and latitude are being generated, so I don’t think that’s the problem.