angular-openlayers-directive
angular-openlayers-directive copied to clipboard
Custom parameters example not working
Hi there,
I couldn't get this basic example about overriding defaults to work: http://tombatossals.github.io/angular-openlayers-directive/examples/030-custom-parameters-example.html
In fact, on further inspection I realised that this example itself is not working either. As I understood it, this part of the code would be overriding the default background layer and use OpenCycleMap instead:
defaults: {
layers: {
main: {
source: {
type: 'OSM',
url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
}
}
},
interactions: {
mouseWheelZoom: true
},
controls: {
zoom: false,
rotate: false,
attribution: false
}
}
But it clearly isn't. Waterways are still being displayed and cycle tracks aren't. I've included two screenshots to illustrate the difference between the two maps.
I've had a look in the source code (in
/dist/angular-openlayers-directive.js
) to see what's causing this issue. I think this is what is happening:
- They layers are being added correctly to the defaults object at line 50
- On lines 95-105 a default layer is being set on the condition that
!attrs.customLayers
. IMHO the condition should be!defaults.layers
. I verified that at least commenting this part of code out leaves me with a blank background layer. - However, there is no else clause for this scenario, so if a layer is indeed specified in the defaults object, it is not created.
- I didn't check very thoroughly, but is seems to me that the same issue exists for quite a few other properties as well.
Is this project still being maintained actively? Or should I abandon ship?
Cheers, Hendrik
HI @HendrikZero72, I'm helping @tombatossals out on maintaining this project. However I'm quite busy currently by myself with lots of other stuff. That's why things are proceeding a bit slowly currently.
I see your point. Could you provide a PR for this issue? That'd be awesome and I'd be happy to merge it in.
Hi Juri,
I’m glad to hear from you. I’ll try to free some spare time next week. Unfortunately, this week I have a big deadline coming up at work and am a bit ill, so it won’t be possible.. I’ll spend a couple of evenings on it next week. I’d be happy to update the directive, but I will leave it to someone else to update the example if needed.
Cheers, Hendrik
On 26 Jan 2016, at 23:34, Juri Strumpflohner [email protected] wrote:
HI @HendrikZero72 https://github.com/HendrikZero72, I'm helping @tombatossals https://github.com/tombatossals out on maintaining this project. However I'm quite busy currently by myself with lots of other stuff. That's why things are proceeding a bit slowly currently.
I see your point. Could you provide a PR for this issue? That'd be awesome and I'd be happy to merge it in.
— Reply to this email directly or view it on GitHub https://github.com/tombatossals/angular-openlayers-directive/issues/231#issuecomment-175270687.
Unfortunately we're all in the same situation :wink:. There's only a few lucky that get paid to work on open source. Thx for your effort
Hi,
I think the example does not work properly just because the custom-layers="true" is missing in the