Closed sjaakp closed 10 years ago
@Sjaakp When we set a TileLayer
is really important that the layer is set with the name of the map. I thought would be best to override the maps by the one set on TileLayer. I could do it the otherway around but the same name should forcedly used no matter what.
Do you have a better solution?
I see... Well, I would suggest to give TileLayer a default map name, if only to make the provided example work out of the box.
By the way, perhaps you should consider that you can add more than one tile layer to a LeafLet map (tile layers may be partly transparent). It is used for weather maps, among others (OpenWeatherMap).
For the moment, I’m just playing a bit with your code. If I keep to it, I will surely come with a pull-request if I see it fit.
I really like the way you structured your code.
Keep up the good work,
Sjaak
Sjaak Priester
mailto:sjaak@sjaakpriester.nl sjaak@sjaakpriester.nl
Van: Antonio Ramirez [mailto:notifications@github.com] Verzonden: vrijdag 2 mei 2014 14:49 Aan: 2amigos/yii2-leaflet-extension CC: Sjaakp Onderwerp: Re: [yii2-leaflet-extension] Provided example doesn't work; LeafLet->name unset (#2)
@Sjaakp https://github.com/Sjaakp When we set a TileLayer is really important that the layer is set with the name of the map. I thought would be best to override the maps by the one set on TileLayer. I could do it the otherway around but the same name should forcedly used no matter what.
Do you have a better solution?
— Reply to this email directly or view it on GitHub https://github.com/2amigos/yii2-leaflet-extension/issues/2#issuecomment-42027530 . https://github.com/notifications/beacon/5585878__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNDY1NDE1MSwiZGF0YSI6eyJpZCI6MzEwMjc5MDJ9fQ==--50e8f3b6cce7522a7192aabe1b4177d09ec65fe6.gif
@Sjaakp
By the way, perhaps you should consider that you can add more than one tile layer to a LeafLet map (tile layers may be partly transparent). It is used for weather maps, among others (OpenWeatherMap).
We can already do that with the Layers
. I know is missing some doc, but will do as soon as I complete the large library I am building. Will create a proper site for all of them.
LeafLet->name gets overridden by TileLayer->map. This means that if TileLayer->map is unset, as it is by default, LeafLet->name will also get unset. Consequently, the generated JavaScript code is invalid (var = L.map('w0', ...).
Therefore, the provided example does not work as it is. A workaround is to explicitly define TileLayer->map.
It would be better, of course, to only override LeafLet->map by non-empty values. (LeafLet.php, line 134).
Personally, I wonder why LeafLet->name is overridden by TileLayer->map in the first place. What is the rationale behind that?