Xavier
Posts: 0
Joined: Wed Oct 29, 2014 8:09 pm

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Gmap boundaries

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?

Xavier
Posts: 0
Joined: Wed Oct 29, 2014 8:09 pm

Gmap boundaries

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Gmap boundaries

Xavier,

The google reference is here:

https://developers.google.com/maps/do...

The documentation for that method specifically is here:
Image

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

Xavier
Posts: 0
Joined: Wed Oct 29, 2014 8:09 pm

Gmap boundaries

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

Return to “Issues”