Page 1 of 1

get center Lat/Lng from google map

Posted: Sun Feb 15, 2015 6:57 am
by Spark Chao

hello everyone!!
can anyone can give me some suggestions to get center Lat/Lng from google map?
I already create a popup window like below,and the "show on map"and "show my location" function are working.
Image

how should I set the JavaScripe to show the Lat/Lng of center point on the map?
the function will like the web.
http://gmaps-samples-v3.googlecode.co...

thanks you guys's help!!


get center Lat/Lng from google map

Posted: Sun Feb 15, 2015 9:18 am
by Maryna Brodina

Hello!

Please check Katya's reply here https://getsatisfaction.com/apperyio/...

Looks like you need ti refresh map.


get center Lat/Lng from google map

Posted: Tue Feb 17, 2015 6:46 am
by Spark Chao

hello Maryna
so sorry ,I still can't figure out the solution you have mentioned.
(I am not a coding base guy,the javascript is hard to me.so please give more detail thanks)

In my APP,user can create own diving spot.
when user click the button "find spot" will open a popup of map.
user can use "show on me" or "show my location" to find the location probably.
example:Taipei,Taiwan

then user can use the map to modify the location accurately,and the location's lat/len will show on the popup input label.
(by click on map or just get the canter location's lat/len)

when user click the button "ok",the lat/len information will save in localstorage variables.

I can handle with the First and third step,but still can't figure out how to let second step worked.

looking for your help again!!


get center Lat/Lng from google map

Posted: Wed Feb 18, 2015 5:06 am
by Yurii Orishchuk

HI Spark,

Here is code how to get center of the map:

pre

//Where "mapName" is your map component name.
var center = Apperyio("mapName").gmap.center;

var latitude = center.k;
var longitude = center.D;

//Here you can save these value to LSV.

/pre

Regards.


get center Lat/Lng from google map

Posted: Sat Feb 21, 2015 4:00 am
by Spark Chao

Yurii
thanks for your reply!!
should I add the code on the map component in click event for run Javascript ?

and "center.k" and "center.D" ,is my input label name ?
Thanks again~~


get center Lat/Lng from google map

Posted: Wed Feb 25, 2015 3:45 am
by Yurii Orishchuk

Hi Spark,

You can use this code in event you need. For example on some click or some "success" etc..

Nope, in this code you have only "mapName" that should be changed.

precode

//Where "mapName" is your map component name.
var center = Apperyio("mapName").gmap.center;
var latitude = center.k;
var longitude = center.D;

console.log("latitude = " + latitude);
console.log("longitude = " + longitude);

//Here you can save these value to LSV.
localStorage.setItem("mapLat", latitude);
localStorage.setItem("mapLng", longitude);

/code/pre

Regards.


get center Lat/Lng from google map

Posted: Wed Feb 25, 2015 9:53 am
by Spark Chao

Thanks !!
I will try it~