Page 1 of 1

External Lib google maps geometry - AngularJS - Bootstrap

Posted: Mon May 18, 2015 12:36 pm
by Ravenight

I am very happy to see the ability to edit external libraries and dependencies after the latest update.

I am having an issue getting the following to load:
https://maps.googleapis.com/maps/api/...

I have gone into App settings and added it as an external lib that is not global with a shim enabled and a dependency on gmaps.
name: google_maps_geometry
url: https://maps.googleapis.com/maps/api/...
type: External lib
Enabled: Yes
global: no
shim: yes
shim export: [BLANK]
shim init code: [BLANK]
deps: gmaps

When I then try to call a function in this library:
codevar distance = google.maps.geometry.spherical.computeDistanceBetween(map.center,$scope.map.lastCenter );/code

I am getting this error:
codeCannot read property 'spherical' of undefined/code

I can console.log(google.maps) and everything is there but the geometry library.
Any idea why it is not loading the "geometry" functions? I assume it is something with my external lib setup.


External Lib google maps geometry - AngularJS - Bootstrap

Posted: Tue May 19, 2015 2:29 am
by Yurii Orishchuk

Hello,

Please follow these steps:

1 Open your app settings on "External resources" tab.

2 Take a look on "User-defined resources" part. There should be.

pre

http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places

/pre

3 If you can not find it - add it there. Details: http://prntscr.com/536jl3/direct

Regards.


External Lib google maps geometry - AngularJS - Bootstrap

Posted: Tue May 19, 2015 11:14 am
by Ravenight

That is where I was adding the data, but I tried it again with the following:

name: gmaps_geometry
url: http://maps.googleapis.com/maps/api/j...
type: External lib
Enabled: Yes
global: No
shim: No

and this worked, sorta.
The geometry is not loaded when the map tiles are first available. I put in a check to make sure the google.maps.geometry is there and on subsequent map tile loads it works fine.


External Lib google maps geometry - AngularJS - Bootstrap

Posted: Thu May 28, 2015 2:04 am
by Yurii Orishchuk

Hi Ravenight,

It seems to be a bug for angular project.

We are working on it. And will response you here as soon as we will have any update on it.

Thanks.


External Lib google maps geometry - AngularJS - Bootstrap

Posted: Wed Jun 03, 2015 12:52 pm
by Ravenight

As I was trying to add the places library I believe I discovered a related item. The angular-google-maps has added the "geometry" library and regardless of my external attempt to load this is irrelevant.

I disabled the call to this external library and my geometry continued to work. I noticed uiGmapGoogleMapApiProvider was loading the library.

How do I edit this in the framework:
code
.config(function(uiGmapGoogleMapApiProvider) {
uiGmapGoogleMapApiProvider.configure({
// key: 'your api key',
v: '3.17',
libraries: 'weather,geometry,visualization'
});
})/code
I can hack it by editing the source file for the angular-google-maps.min.js file and enter the library name in the libraries area.

I don't like hacking the framework.


External Lib google maps geometry - AngularJS - Bootstrap

Posted: Mon Jun 08, 2015 3:12 pm
by Illya Stepanov

We have reported this bug and we are working on fixing it, at this point we can't suggest any solution, unfortunately. Hopefully we will fix it and everything will work correctly.


External Lib google maps geometry - AngularJS - Bootstrap

Posted: Fri Jun 12, 2015 9:56 pm
by Alena Prykhodko

Hello,

App uses require.js for resources loading.

You can find your library in bootstrap.js - as alias in require config and in app.js as last dependence module.
Library is written in global area scope.


External Lib google maps geometry - AngularJS - Bootstrap

Posted: Tue Nov 03, 2015 11:24 pm
by Bruce Buttles

Hmmm, I am having the same error:

"User transformation function exception. Reason: Cannot read property 'spherical' of undefined"

Here is my code where p1 and p2 are LatLng objects and have valid values:
code
var distInMeters =google.maps.geometry.spherical.computeDistanceBetween(p1, p2);
/code

FIRST, I tried to add the library as a user-defined library as Yurii recommended - BUT - I then get this error:

"You have included the Google Maps API multiple times on this page. This may cause unexpected errors."

I desperately need a way to calculate the distance between two point on a map... can you help please?


External Lib google maps geometry - AngularJS - Bootstrap

Posted: Fri Nov 20, 2015 10:14 am
by Serhii Kulibaba

Hello Bruce,

Have you added google's geometry library into the app? https://maps.googleapis.com/maps/api/...