添加边界限制

This commit is contained in:
wlx 2015-01-30 02:33:44 +00:00
parent f7114a3358
commit b1d256b679
1 changed files with 10 additions and 3 deletions

View File

@ -26,8 +26,8 @@ $this->nav[] = array('link'=>"/data/landuse",'title'=>'三江源土地利用地
var size = ol.extent.getWidth(projectionExtent) / 256; var size = ol.extent.getWidth(projectionExtent) / 256;
var resolutions = new Array(19); var resolutions = new Array(19);
var matrixIds = new Array(19); var matrixIds = new Array(19);
var mapExtentQH = [89.3, 31.8, 102.3, 36.3]; var mapExtentQH = [89.3, 31.5, 102.3, 36.3];
var myextent=ol.extent.applyTransform(mapExtentQH, ol.proj.getTransform("EPSG:4326", "EPSG:3857")); var myextent=ol.proj.transformExtent(mapExtentQH, "EPSG:4326", "EPSG:3857");
var res = 156543.03392804096153584694438047; var res = 156543.03392804096153584694438047;
for (var z = 1; z <= 19; z++) { for (var z = 1; z <= 19; z++) {
@ -135,9 +135,9 @@ $this->nav[] = array('link'=>"/data/landuse",'title'=>'三江源土地利用地
title: '2012年', title: '2012年',
visible: false, visible: false,
opacity: 0.6, opacity: 0.6,
extent:myextent,
source: new ol.source.XYZ({ source: new ol.source.XYZ({
extent: mapExtentQH, extent: mapExtentQH,
url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2012/{z}/{x}/{y}.png' url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2012/{z}/{x}/{y}.png'
}) })
}), }),
@ -146,6 +146,7 @@ $this->nav[] = array('link'=>"/data/landuse",'title'=>'三江源土地利用地
title: '2011年', title: '2011年',
visible: false, visible: false,
opacity: 0.6, opacity: 0.6,
extent:myextent,
source: new ol.source.XYZ({ source: new ol.source.XYZ({
extent: mapExtentQH, extent: mapExtentQH,
url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2011/{z}/{x}/{y}.png' url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2011/{z}/{x}/{y}.png'
@ -156,6 +157,7 @@ $this->nav[] = array('link'=>"/data/landuse",'title'=>'三江源土地利用地
title: '2010年', title: '2010年',
visible: false, visible: false,
opacity: 0.6, opacity: 0.6,
extent:myextent,
source: new ol.source.XYZ({ source: new ol.source.XYZ({
extent: mapExtentQH, extent: mapExtentQH,
url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2010/{z}/{x}/{y}.png' url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2010/{z}/{x}/{y}.png'
@ -166,6 +168,7 @@ $this->nav[] = array('link'=>"/data/landuse",'title'=>'三江源土地利用地
title: '2009年', title: '2009年',
visible: false, visible: false,
opacity: 0.6, opacity: 0.6,
extent:myextent,
source: new ol.source.XYZ({ source: new ol.source.XYZ({
extent: mapExtentQH, extent: mapExtentQH,
url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2009/{z}/{x}/{y}.png' url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2009/{z}/{x}/{y}.png'
@ -176,6 +179,7 @@ $this->nav[] = array('link'=>"/data/landuse",'title'=>'三江源土地利用地
title: '2008年', title: '2008年',
visible: false, visible: false,
opacity: 0.6, opacity: 0.6,
extent:myextent,
source: new ol.source.XYZ({ source: new ol.source.XYZ({
extent: mapExtentQH, extent: mapExtentQH,
url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2008/{z}/{x}/{y}.png' url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2008/{z}/{x}/{y}.png'
@ -186,6 +190,7 @@ $this->nav[] = array('link'=>"/data/landuse",'title'=>'三江源土地利用地
title: '2007年', title: '2007年',
visible: false, visible: false,
opacity: 0.6, opacity: 0.6,
extent:myextent,
source: new ol.source.XYZ({ source: new ol.source.XYZ({
extent: mapExtentQH, extent: mapExtentQH,
url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2007/{z}/{x}/{y}.png' url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2007/{z}/{x}/{y}.png'
@ -195,6 +200,7 @@ $this->nav[] = array('link'=>"/data/landuse",'title'=>'三江源土地利用地
new ol.layer.Tile({ new ol.layer.Tile({
title: '2006年', title: '2006年',
opacity: 0.6, opacity: 0.6,
extent:myextent,
source: new ol.source.XYZ({ source: new ol.source.XYZ({
extent: mapExtentQH, extent: mapExtentQH,
url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2006/{z}/{x}/{y}.png' url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2006/{z}/{x}/{y}.png'
@ -204,6 +210,7 @@ $this->nav[] = array('link'=>"/data/landuse",'title'=>'三江源土地利用地
title: '2005年', title: '2005年',
visible: false, visible: false,
opacity: 0.6, opacity: 0.6,
extent:myextent,
source: new ol.source.XYZ({ source: new ol.source.XYZ({
extent: mapExtentQH, extent: mapExtentQH,
url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2005/{z}/{x}/{y}.png' url: 'http://qherc.sanjiangyuan.org.cn/tile/landuse2005/{z}/{x}/{y}.png'