jasper07/openui5-googlemaps

set Markers in the Map

vinny366 opened this issue · 1 comments

Hi I am new to UI5. I am working on using the google maps. Currently i embedded the map onto my shell and appended the markers like below.

<gmaps:Map id="map1" class="googleMap" height="600px" width="100%" zoom="4" lat="10" lng="20" markers="{/coords}" zoomControl="true" ready="onMapReady"> <gmaps:Marker class="mark" lat="{latitude}" lng="{longitude}" click = "onMarkerClick" animation="0" ></gmaps:Marker> </gmaps:Map>

The issue i am facing is if i want to add an extra marker from user input without removing the already loaded marker.

I created a new marker
var oMarker = new openui5.googlemaps.Marker({ lat: '16', lng: '80' });

But when i try to insert this marker to the map this.oMap.setMarker(oMarker) it gives me an error

i have seen in your sample app2 . you iterated throught all the markers using getMarkers(); Is there any way to set the marker to the map???

Hello @vinny366 , @jasper07

May I know why you closed this issue, as I am also facing the same problem and the library does not offer a way to add additional markers.
for Ex. I want to have a different icon and click operation for the current position. so essentially its a different marker. but problem I face is that I have to add all markers to a single model and then create a template using that model.

I want to just add a another marker in the end for current location with out all this hassle.

If you have an answer please let me know.

Thanks
Prateek