Comments (7)
From @cgat on December 10, 2014 1:44
I've dug into this a bit more and found that the same is true for markers. In addMarkerWatch, I remove the true
option and in the marker directive I change watch to watchCollection. I realize this is a fundamental change in the way the leaflet-directive operates, and also removes some of the current functionality, but the performance improvement are huge, at least in my scenario.
To clarify my use case:
-potentially 1000s of markers
-Realtime(ish). Markers are expected to update often, updates are polled every second. Marker and paths are replaced on every poll (this is why my solution works above).
I've forked and pushed to a branch called no-deep-watch. Feel free to have a try yourself: https://github.com/cgat/angular-leaflet-directive/tree/no-deep-watch
What are your thoughts on integrating this type of behaviour in the directive? I'd be willing to put in some time to get it going, but I'm not 100 percent sure what would the best approach be without breaking a lot of things. Perhaps an option to use an observePattern type service to notify the directive of changes?
from ui-leaflet.
From @tombatossals on January 8, 2015 16:0
Hi @cgat, sorry I didn't read your issue before. You're totatlly right "$watchCollections" is the way to go.
I'm going to apply the same solution to the markers watchers.
Thanks so much!
from ui-leaflet.
From @cgat on January 12, 2015 3:48
Thanks for the response @tombatossals. Were these changes supposed to be made in the commit you made for issue #590? It looks like only paths were changed to used "$watchCollections".
I should point out that if you do use this solution for marker watchers as well, it will introduce breaking changes. At the moment, if you hold a reference to a marker that is watched, you can change the internal state of the marker and the map marker will get updated (a good example of this is change the 'focus' property to true). If we change to "$watchCollection", you'd have to replace the marker with an updated version of the object to get it to work. Personally, I think this is the better solution given the performance improvements, however, I could see this upsetting people.
I was thinking that it might be nice to have one watcherOptions
directive, which allows the users to configure how each element type is watched. For example, the input to the directive could be something like:
{
markers: "collection", //--> use $watchCollections
paths: true, //--> use $watch(...., true),
.... any other map element
}
This would be opposed to having a watch directive for each element type (watch-markers, watch-paths, etc).
Thoughts?
from ui-leaflet.
From @tombatossals on January 18, 2015 10:29
Hi @cgat, thanks for your ideas. I finally didn't change to "watchCollection" on markers, but changhed the "geojson" object to it. I have to take a look closely on changing the markers because what you say, it could break old code.
I'm thinking about reworking this directive when leaflet-0.8 goes out and solve some of the functionality that could be improved, for example listen to only the markers you are interested, not everyone.
I would like to research the possibility to take out the marker as a dom tag, so it could be customized easily, and not to have big objects linked to the main "leaflet" tag. I have coded something similar in the "angular-openlayers-directive" and it works pretty well. Take a the code of this example:
http://tombatossals.github.io/angular-openlayers-directive/#/markers/marker-no-javascript
What do you think about it?
from ui-leaflet.
From @cgat on January 20, 2015 23:9
Yes! I think that would be a great solution. This will give lots of control over performance to the developer using angular-leaflet and make your code base easier to reason with. How far off do you think this reason would be? If I can help out (update examples, etc), let me know.
from ui-leaflet.
From @tombatossals on January 25, 2015 19:13
I'm doing this in my spare time, but I'm searching for some time and rework all the code. All the experience of these years could make this directive evolve.
It would be great if you could help, you know the code, you have good ideas, and you're great programming angular.
I have almost finished coding the angular-openlayers-directive, so maybe in a few weeks I could start refactoring this library. If you want to get involved just tell me and we could open a trello board for this new version.
from ui-leaflet.
From @cgat on January 27, 2015 16:50
I realize you do this on your spare time, so forgive me if I came across a bit too eager in my previous message.
I'm definitely interested in helping out. Contact me in a few weeks and we'll get the ball rolling.
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.