Garrett
Posts: 0
Joined: Sat Aug 17, 2013 12:18 pm

How can I move a marker on a google map?

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.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How can I move a marker on a google map?

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

Garrett
Posts: 0
Joined: Sat Aug 17, 2013 12:18 pm

How can I move a marker on a google map?

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How can I move a marker on a google map?

Please specify what exactly is not clear with setPosition?

Garrett
Posts: 0
Joined: Sat Aug 17, 2013 12:18 pm

How can I move a marker on a google map?

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How can I move a marker on a google map?

Did you manage with it? Do you need our help?

Garrett
Posts: 0
Joined: Sat Aug 17, 2013 12:18 pm

How can I move a marker on a google map?

I got it. Thanks!

Frederik
Posts: 0
Joined: Sun Dec 29, 2013 10:21 pm

How can I move a marker on a google map?

Would you care to share your solution?

Return to “Issues”