Gmap boundaries
Dear all,
I am displaying a google map (easily with your drag & drop Gmap).
Is there any way to obtain the boundaries of the map ?
Thank you in advance
Best regards
Xavier
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Dear all,
I am displaying a google map (easily with your drag & drop Gmap).
Is there any way to obtain the boundaries of the map ?
Thank you in advance
Best regards
Xavier
Hello Xavier,
Could you please clarify do you want to get a border around the component or you want to get the boundaries of displayed area of the map?
Hi Evgene,
Sorry for the lack of precision.
I would like to get the boundaries of the displayed area of the map (in term of latitude & longitude, if possible).
Thanks in advance
Kind regards
Xavier
Xavier,
The google reference is here:
https://developers.google.com/maps/do...
The documentation for that method specifically is here:
Example code to get it...
var omap = Appery("google_map").options.mapElement.gmap('get', 'map');
var obounds = omap.getBounds();
// what comes back is a latLang BOUNDS object .... so...the NE corner is:
var oNElatlng = obounds.getNorthEast();
// the SE corner is
var oSElatlng = obounds.getSouthWest();
// and to get the lat - or long of either object
var nNELat = oNElatlng.lat();
var nNELng = oNElatlng.lng();
Best,
Bruce
Dear Bruce,
Thank you for your fast answer !!
I obtained errors and I had to add an extra line of code.
Here is may code:
#####################################
Appery("googlemap_57").options.mapElement.bind('init',function(evt, map) {
var omap = Appery("googlemap_57").options.mapElement.gmap('get', 'map');
var obounds = omap.getBounds();
var oNElatlng = obounds.getNorthEast();
Map_right = oNElatlng.lat();
Map_up = oNElatlng.lng();
var oSOlatlng = obounds.getSouthWest();
Map_left=oSOlatlng.lat();
Map_bottom=oSOlatlng.lng();
});
#####################################
Without the "Appery("googlemap_57").options.mapElement.bind('init',function(evt, map)" part, I obtain the following error and the screen does not load (on web tester:
TypeError: obounds is undefined
Kind regard
Xavier