Comments (9)
From @stefan-niedermann on February 9, 2015 8:14
Hi, look here: http://tombatossals.github.io/angular-leaflet-directive/#!/examples/events
You can watch events. If this does not help you, i can post a piece of code how to listen the drag event and get the new coordinates.
Hint: You don't need to watch leafletDirectiveMap-Event, there is a leafletDirectiveMarker-Event which you can listen to.
from ui-leaflet.
From @praveenkumararepalliGit on February 9, 2015 9:22
Hi Stefan,
Thanks for you reply.
Can you post a piece of code .
from ui-leaflet.
From @praveenkumararepalliGit on February 9, 2015 11:20
Hi Stefen,
Actually I wanted to show default location by setting lat = 12 and lng =80;
angular.extend($scope, {
city: {
lat: 12,
lng: 80,
zoom: 12
},
markers: {
cityName: {
lat:12,
lng:80,
message: "You are here!",
focus: true,
draggable: true
}
},
defaults: {
scrollWheelZoom: true
},events: {
map: {
enable: ['zoomstart', 'drag', 'click', 'mousemove'],
logic: 'emit'
}
}
});
Here i am watching drag event.
$scope.$on('leafletDirectiveMarker.drag', function(event){
var draggedLat=event.targetScope.markers.cityName.lat;
var draggedLng=event.targetScope.markers.cityName.lng;
console.log(draggedLat,draggedLng); //here am getting 12 ,80 every time
console.log(event); // Here i can see new coordinates
console.log(event.targetScope.markers.cityName.lat,event.targetScope.markers.cityName.lng);
});
Can you Tell where the issue is ?
from ui-leaflet.
From @stefan-niedermann on February 9, 2015 12:19
sry, can't tell it by rote. i currently don't have access to my notebook. i'll post today evening, hope thats early enough. hmm, maybe the event is wrong? did you try leafletDirectiveMarker.dragend ?
from ui-leaflet.
From @praveenkumararepalliGit on February 9, 2015 12:28
Yes Stefen. But Coordinates are wrong
can I achieve by doing this code?
Default location is 12,80 once i drop marker to new location still its giving 12,80 only
But dropping point is different
$scope.$on('leafletDirectiveMarker.dragend', function(event){
var coordinatesObject = event;
var draggedLat=coordinatesObject.targetScope.markers.cityName.lat;
var draggedLng=coordinatesObject.targetScope.markers.cityName.lng;
console.log(draggedLat,draggedLng);
console.log(event.targetScope.markers.cityName.lat,
event.targetScope.markers.cityName.lng);
});
from ui-leaflet.
From @stefan-niedermann on February 9, 2015 21:25
I am sorry, i am not able to reproduce this behaviour
$scope.$on('leafletDirectiveMarker.dragend', function(event) {
console.log($scope.markers.mymarker.lat);
console.log($scope.markers.mymarker.lng);
}
this works fine for me...
from ui-leaflet.
From @praveenkumararepalliGit on February 10, 2015 9:55
Yes,i can see the new coordinates only for one image.
I have 3 Images side by side.When click any image making call to
$scope.imageLocationDetails(imageData,$index);
Then "imageLocationDetails()" will start executes and there am checking for
imageViewPage.jsp
<leaflet defaults="defaults" markers="markers" center="city" height="320px" width="320px"></leaflet>
imageController.js
$scope.imageLocationDetails = function (image,imageIndex) {
//Here i can read the EXIF data from Image (EXIF data may have lat and lng)
$scope.imageIndex = imageIndex;
if (image.lat && image.lng) {
angular.extend($scope, {
city: {
lat: latt,
lng: longi,
zoom: 12
},
markers: {
cityName: {
lat:latt,
lng:longi,
message: "You are here!",
focus: true,
draggable: true
}
},
defaults: {
scrollWheelZoom: true
},events: {
map: {
enable: ['zoomstart', 'drag', 'click', 'mousemove'],
logic: 'emit'
}
}
});
} else {
angular.extend($scope, {
city: {
lat: 12,
lng: 80,
zoom: 12
},
markers: {
cityName: {
lat:12,
lng:80,
message: "You are here!",
focus: true,
draggable: true
}
},
defaults: {
scrollWheelZoom: true
},events: {
map: {
enable: ['zoomstart', 'drag', 'click', 'mousemove'],
logic: 'emit'
}
}
});
}
}
$scope.$on('leafletDirectiveMarker.dragend', function(event,gh,mmm){
console.log($scope.markers.cityName.lat);
console.log($scope.markers.cityName.lng);
//Here i wanted to get the latest coordnates and put into image(Based on image ID)
$scope.imageList[$scope.imageIndex].lat = $scope.markers.cityName.lat;
$scope.imageList[$scope.imageIndex].lng = $scope.markers.cityName.lng;
});
Is this correct approach stefen?
from ui-leaflet.
From @stefan-niedermann on February 10, 2015 10:9
hmm @tombatossals any idea?
from ui-leaflet.
See rest of original issue tombatossals/angular-leaflet-directive#626
Rest of issue import broke.
from ui-leaflet.
Related Issues (20)
- leafletData.getDirectiveControls
- Dynamically add data to geoJSONShape HOT 1
- Migration to Angular 4 HOT 1
- Changin markers on scope, the model is different HOT 2
- Markers not showing in second (or more) maps HOT 4
- Travis CI seems to be broken HOT 1
- Add Custom Styles To Google Maps
- layercontrol - More than 1 map on the DOM
- IE 11: US Map mouse over highlighting beside state(s)
- <Security Issue> Slack token need to be encrypted
- Fitbounds and markercluster zoom issue
- Marker in not updating its position on the map, when its value is updated
- Nor working in angular 1.6.4 HOT 2
- Popup closes when changing marker icon
- ui-leaflet analog for bindLabel functionality? HOT 1
- Could anyone propagate this commit to the 2.0.x tag version?
- MBTiles
- Disable auto center adjust after change marker coordinates programmatically
- Is this project still active ?
- Issue with Clickable Marker Content
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui-leaflet.