jeudi 15 janvier 2015

Change marker's size by with zoom in Leaflet


I get stuck with changing my marker's size when zoom changes in my Leaflet code. It's a simple map with a metro stations overlay coming from an ArcGIS Server. The markers are coming from that same source.


The code is as follow:



<html>
<head>
<meta charset=utf-8 />
<title>Simple FeatureLayer</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

<!-- Load Leaflet from CDN-->
<link rel="stylesheet" href="http://ift.tt/1nNDvsa" />
<script src="http://ift.tt/1nNDvsc"></script>

<!-- Load Esri Leaflet from CDN -->
<script src="http://ift.tt/1B55tKq"></script>

<style>
body {margin:0;padding:0;}
#map {position: absolute;top:0;bottom:0;right:0;left:0;}
</style>
</head>
<body>

<div id="map"></div>

<script>
var map = L.map('map').setView([51, 7], 13);

L.esri.basemapLayer('Streets').addTo(map);

var iconFs = L.icon({
iconUrl: 'http://ift.tt/1CpuEVg',
iconSize: [14, 15],
iconAnchor: [0, 0]
});

L.esri.featureLayer('http://ift.tt/1B55u0E', {useCors: false,
pointToLayer: function (feature, latlng) {
return L.marker(latlng, { icon: iconFs} );
}
}).addTo(map);
</script>

</body>
</html>


I would be very glad if someone's got an idea to solve it. Thanks





Aucun commentaire:

Enregistrer un commentaire