map not showing as wanted

28 views
Skip to first unread message

Riwall Tonnelle

unread,
Oct 24, 2017, 4:22:29 PM10/24/17
to Leaflet
New to leaflet I wrote a bit of code that : 
1 - extracts the latitude and a longitude of a town from a data base
2 - displays a map center on that town (OSM in breton).

result :
bien.jpg

then I tried to incorporate this bit of code in a laarger prog (id within another id and so on...) ;
unfortunately, the map doest show as it should anymore :
nul.jpg

it's always the same piece of code : 
<div id="macarte" style="width:545px; height:300px;"></div>
<script type="text/javascript">
var mylat = 47.216667;
var mylong = -1.55;
var carte = L.map('macarte').setView([mylat, mylong], 12);
L.tileLayer('http://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png',
{maxZoom: 19}).addTo(carte);
</script>

any help welcome !
Répondre 
 
1 message • Page 1 sur 1

Matt Travis

unread,
Oct 26, 2017, 12:05:53 PM10/26/17
to Leaflet
It looks like you've specified the size of the map here:

<div id="macarte" style="width:545px; height:300px;"></div>

Did you mean to do this? Do you want it full screen? 

Matt

Riwall Tonnelle

unread,
Oct 27, 2017, 3:59:00 PM10/27/17
to Leaflet
Yes, I want it this size, not full screen.

Matt Travis

unread,
Oct 29, 2017, 9:04:33 AM10/29/17
to Leaflet
Ok. Then use styling to make it full screen like in this example.


Hope that helps.
Reply all
Reply to author
Forward
0 new messages