[OSM-dev] LeafletJS strange behaviour with OSM layer

François Lacombe francois.lacombe at telecom-bretagne.eu
Sat Sep 7 12:24:57 UTC 2013


Thank for your answer.

That's very weird. Maybe because I'm loading map container with ajax and
then call leafletJS with a non-ready DOM tree.

I'm looking forward to find a sustainable fix with jQuery, but using
setTimeout(loadMap(), 1000); works fine.


Cheers.

*François Lacombe*

francois dot lacombe At telecom-bretagne dot eu
http://www.infos-reseaux.com


2013/9/7 Yohan Boniface <yohanboniface at free.fr>

> Sounds like the container of your map has changed after its initialization.
> Try calling map.invalidateSize() when the container has its definitive
> size.
>
> Yohan
>
>
>
>
> On 09/06/2013 08:51 PM, François Lacombe wrote:
>
>> Hi,
>>
>> I'm currently trying to switch to OSM (from Google Maps) on several
>> pages & apps of my website.
>>
>> All is working fine with leafletJS but some of my apps doesn't get all
>> tiles loaded.
>> You can find an example here :
>> http://www.infos-reseaux.com/**apps/ADSLObs/carte-nra-nro/?**domain_id=FT<http://www.infos-reseaux.com/apps/ADSLObs/carte-nra-nro/?domain_id=FT>
>>
>> Only one row of tiles is loaded at the top of my map frame and I need to
>> drag down it to see other tiles on my screen.
>>
>> The div where leaflet is build received this css :
>> .app-webVRD-gMapsContainer {
>>      background-color:#FFFFFF;
>>      height:600px;
>>      min-height:600px;
>>      width:100%;
>>      min-width:100%;
>> }
>>
>> Here is the leaflet init JS :
>> // Conteneur
>> _MAP = L.map(gmaps_container_id, {
>>         "doubleClickZoom":false,
>>         "scrollWheelZoom":true
>> });
>>
>> // Couche OSM
>> L.tileLayer('http://{s}.tile.**openstreetmap.org/{z}/{x}/{y}.**png<http://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png>
>> <http://tile.openstreetmap.**org/{z}/{x}/{y}.png<http://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png>>',
>> {
>>
>>         attribution: 'Map data © OpenStreetMap contributors',
>>         maxZoom: 18,
>>         minZoom:1
>> }).addTo(_MAP);
>>
>> I'm working on firefox 23.0.1, I get the same on Chrome and IE.
>>
>> Thank you in advance for any tip about this problem.
>>
>>
>> Cheers.
>>
>>
>> *François Lacombe*
>>
>>
>> francois dot lacombe At telecom-bretagne dot eu
>> http://www.infos-reseaux.com
>>
>>
>> ______________________________**_________________
>> dev mailing list
>> dev at openstreetmap.org
>> http://lists.openstreetmap.**org/listinfo/dev<http://lists.openstreetmap.org/listinfo/dev>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20130907/b11ab2a2/attachment.html>


More information about the dev mailing list