I wish to plot and then remove a number of map locations (pins) on a WebMapViewer.
I have done this previously for singular locations by creating a Session Property of Type: WebMapLocation to store the current WebMapLocation, then referenced that property to remove a location or update for a new location.
I am not sure how to store an array of WebMapLocations whilst maintaining the correct datatype. I didn’t really want to store arrays of latitudes/longitudes (which works), given I had created WebMapLocations.
Thank you in advance.
Dim locations() as WebMapLocation
Dim loc as new WebMapLocation("…")
locations.append(loc)
Thank you for replying Marius,
I have similar code. My issue is when trying to save the “locations” array to a session property.
If I have a session property named pLocations of type WebMapLocation:
Session.pLocations = locations
Results in compile error:
wpMapping.Button3.Action, line 22
Type mismatch error. Expected class WebMapLocation, but got class WebMapLocation
Session.pLocations = tLocations
Kind regards, Andrew
you defined that Session.pLocations as an array? Session.pLocations()
Thanks Marius,
I had forgotten the () in the name of the session property pLocations. Type was correctly set to WebMapLocation.
Removing saved pins from the map is now efficient.
// to remove all saved pins from the map
for i as integer = 0 to Session.pLocations.Ubound
MapViewer1.RemoveLocation(Session.pLocations(i))
next i
If you don’t need them, remove them from the array, too