Comments (1)
From @pieterjandesmedt on December 18, 2014 13:15
You'll need to modify angular-leaflet-directive.js
a bit for that. Right now, it checks if the layer exists (by name only) and then does nothing if the layer exists, even if its url has changed. Study lines 626-647 and 675-696 to understand. I modified it like this:
On line 628, change
if (!isDefined(newBaseLayers[name])) {
into
if (!isDefined(newBaseLayers[name]) || newBaseLayers[name].refresh) {
Likewise, change line 676 into
if (!isDefined(newOverlayLayers[name]) || newOverlayLayers[name].refresh) {
In your initial layer configuration, add refresh: true
like this:
layers: {
baselayers: {
myTileLayer: {
name: 'My Changing Base Layer',
url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
type: 'xyz',
refresh: true
}
},
overlays: {
myOverlay: {
name: 'My Changing Overlay',
type: 'xyz',
url: ...,
visible: false,
refresh: true
},
}
Then you can change the layer's url to http://tile.stamen.com/#toner/{z}/{x}/{y}.png
after your first init. The watch will pick up the change and delete the layer then add it again with the new url if its refresh
attribute is set to true
.
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.