How to set different zoom level in layers in a map. I need to show different zoom levels in different layers. For example I have 2 layers 1.city, 2.state. When map initialization zoom level is 18, but when I am displaying STATE layer I have to set the zoom level into 22.
I am using the below code.
var city = new L.LayerGroup();
var state = new L.LayerGroup();
var cloudmadeUrl = 'http://{s}.tile.cloudmade/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
map = new L.Map('map', {layers: [cloudmade,city,state], center: new L.LatLng(17.7003292, 82.01161768), zoom:18 });
How can I set zoom level at layer initialization?
How to set different zoom level in layers in a map. I need to show different zoom levels in different layers. For example I have 2 layers 1.city, 2.state. When map initialization zoom level is 18, but when I am displaying STATE layer I have to set the zoom level into 22.
I am using the below code.
var city = new L.LayerGroup();
var state = new L.LayerGroup();
var cloudmadeUrl = 'http://{s}.tile.cloudmade./BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
map = new L.Map('map', {layers: [cloudmade,city,state], center: new L.LatLng(17.7003292, 82.01161768), zoom:18 });
How can I set zoom level at layer initialization?
Share Improve this question edited May 4, 2013 at 5:16 icodebuster 8,9747 gold badges66 silver badges67 bronze badges asked May 4, 2013 at 5:06 kishorekishore 411 silver badge4 bronze badges1 Answer
Reset to default 5Here's a jsfiddle of an example of how to do this.
var map = new L.Map('amap', {
center: new L.LatLng(45.50144, -122.67599),
zoom: 4,
minZoom: 0,
maxZoom: 18,
layers: [
L.tileLayer('http://{s}.tile.cloudmade./{key}/997/256/{z}/{x}/{y}.png', {
maxZoom: 13,
minZoom: 0,
attribution: 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
key: 'BC9A493B41014CAABB98F0471D759707'
}),
L.tileLayer('http://server.arcgisonline./ArcGIS/' + 'rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
minZoom: 14,
maxZoom: 18,
attribution: 'Tiles © Esri — '
+ 'Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, '
+ 'Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'})
]});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744263625a4565757.html
评论列表(0条)