Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

get center Lat/Lng from google map

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!!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

get center Lat/Lng from google map

Hello!

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

Looks like you need ti refresh map.

Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

get center Lat/Lng from google map

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!!

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

get center Lat/Lng from google map

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.

Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

get center Lat/Lng from google map

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~~

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

get center Lat/Lng from google map

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.

Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

get center Lat/Lng from google map

Thanks !!
I will try it~

Return to “Issues”