Hi everybody, I'm trying to use leaflet-plugin-geolocation with angularJS,
but first, I have to add geolocation api call to leaflet scope, I'm trying
to do that, but it's not working. Do you know how to do that? Here is the
link of the plugin: https://github.com/i-breaker/leaflet-plugin-geolocation.
I hope that you can help me.
Thankx for advance :)
Le vendredi 11 avril 2014 08:01:39 UTC+1, Sylvain M. a écrit :
>
> Hi,
>
> I'm having trouble with angularJS and geolocation API (cordova app).
>
>
> $scope.GEOsucces=function(position)
> {
> var newpos ={ "lat": position.coords.latitude, "lng":
> position.coords.longitude, "altitude": position.coords.altitude };
> var newcenter={ "lat": position.coords.latitude, "lng":
> position.coords.longitude, "zoom": 15 };
> $scope.$emit('NEW_GPS',newpos, newcenter);
>
> return false;
> };
>
> $scope.GEOerreur=function(err)
> {
> $log.info("GPS error...");
> return false;
> };
>
> $scope.$on("NEW_GPS", function(event, pos, centre)
> {
> $scope.$apply(function()
> {
> $scope.mytrace.path.p2.latlngs.push(pos);
> $scope.mytrace.centre.lat = centre.lat;
> $scope.mytrace.centre.lng = centre.lng;
> });
> $log.info($scope.mytrace);
> });
>
> GeoLoc = navigator.geolocation.watchPosition($scope.GEOsucces,
> $scope.GEOerreur, { maximumAge: 3000, timeout: 10000, enableHighAccuracy:
> true});
>
> It works for a while and then I get the following error :
>
> http://errors.angularjs.org/1.2.12/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3
> …406%2C%5C%22zoom%5C%22%3A13%2C%5C%22autoDiscover%5C%22%3Afalse%7D%22%5D%5D
> at http://127.0.0.1:1200/lib/ionic/js/ionic.bundle.js:7548:12
> at Scope.$digest (
> http://127.0.0.1:1200/lib/ionic/js/ionic.bundle.js:19339:19)
> at Scope.$apply (
> http://127.0.0.1:1200/lib/ionic/js/ionic.bundle.js:19553:24)
> at safeApply (
> http://127.0.0.1:1200/bower_components/angular-leaflet-directive/dist/angular-leaflet-directive.min.js:32:11561
> )
> at Object.<anonymous> (
> http://127.0.0.1:1200/bower_components/angular-leaflet-directive/dist/angular-leaflet-directive.min.js:31:21383
> )
> at o.Mixin.Events.fireEvent (
> http://127.0.0.1:1200/bower_components/leaflet-dist/leaflet.js:6:5055)
> at o.Map.Keyboard.o.Handler.extend._onBlur (
> http://127.0.0.1:1200/bower_components/leaflet-dist/leaflet.js:9:8418)
> at HTMLDivElement.t.(anonymous function).s [as _leaflet_blur13] (
> http://127.0.0.1:1200/bower_components/leaflet-dist/leaflet.js:8:20284)
> ionic.bundle.js:16905
> Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached.
> Aborting!
> Watchers fired in the last 5 iterations: [["fn: parentValueWatch; newVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false};
>
> oldV...<omitted>...5D ionic.bundle.js:7548
> Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
> Watchers fired in the last 5 iterations: [["fn: parentValueWatch; newVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}","center;
>
> newVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}"],["fn:
>
> parentValueWatch; newVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}","center;
>
> newVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}"],["fn:
>
> parentValueWatch; newVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}","center;
>
> newVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}"],["fn:
>
> parentValueWatch; newVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}","center;
>
> newVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false}"],["fn:
>
> parentValueWatch; newVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}","center;
>
> newVal:
> {\"lat\":43.46768406520923,\"lng\":3.7128639221191406,\"zoom\":13,\"autoDiscover\":false};
>
> oldVal:
> {\"lat\":43.468057820224466,\"lng\":3.715953826904297,\"zoom\":13,\"autoDiscover\":false}"]]
>
> Any help welcome...
>
> Best regards,
>
> Sylvain
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.