Page 1 of 1
How can I move a marker on a google map?
Posted: Thu Sep 19, 2013 8:38 pm
by Garrett
With a google map, how do I move a marker? I don't want a new one, I just want to reposition it to a determined latitude and longitude. I would also like the map to center on this marker. I've been pouring through the forums and API docs and can't find anything on this.
How can I move a marker on a google map?
Posted: Thu Sep 19, 2013 9:38 pm
by Alena Prykhodko
1) Don't use marker in visual component.
2) Add marker on map with js. (you can find an example here http://docs.appery.io/tutorials/addin...)
when you add marker save created object e.g. in global variable.
3) Move marker with setPosition method:
premarkerVar.setPosition(new google.maps.LatLng( 40, 20 ));/pre
How can I move a marker on a google map?
Posted: Thu Sep 19, 2013 10:31 pm
by Garrett
What is the best way to save the created object in a global variable? A code example would be really nice.
Say, on page load, it creates the object and saves it.
I can create the object without issue, but trying to save it and access/modify it later with the setPosition function is where I'm lost.
Thanks,
Garrett
How can I move a marker on a google map?
Posted: Thu Sep 19, 2013 11:26 pm
by Alena Prykhodko
Please specify what exactly is not clear with setPosition?
How can I move a marker on a google map?
Posted: Thu Sep 19, 2013 11:32 pm
by Garrett
I was able to figure it out from one of your other posts.
I used this when I created the object...
code
window["makerVar"] = new google.maps.Marker({.....
/code
And this to recall the object...
code
window["makerVar"].setPosition(...
/code
How can I move a marker on a google map?
Posted: Fri Sep 20, 2013 4:48 am
by Alena Prykhodko
Did you manage with it? Do you need our help?
How can I move a marker on a google map?
Posted: Fri Sep 20, 2013 4:57 am
by Garrett
How can I move a marker on a google map?
Posted: Sun Dec 29, 2013 10:21 pm
by Frederik
Would you care to share your solution?