openalhighfiyers.ef.com3中什么代替了getfeaturesbyattribute

> 重写openalyers 的方法,加载天map瓦片数据
重写openalyers 的方法,加载天map瓦片数据
stsummer & &
发布时间: & &
浏览:62 & &
回复:0 & &
悬赏:0.0希赛币
重写openalyers 的方法,加载天地图瓦片数据
  将TiandituLayer 加载到OpenLayers.js Grid类后。
  OpenLayers.Layer.TiandituLayer = OpenLayers.Class(OpenLayers.Layer.Grid,
mapType : null,
mirrorUrls : null,
topLevel : null,
bottomLevel : null,
topLevelIndex : 0,
bottomLevelIndex : 20,
topTileFromX : -180,
topTileFromY : 90,
topTileToX : 180,
topTileToY : -270,
isBaseLayer : true,
initialize : function(name, url, options) {
options.topLevel = options.topLevel
options.topLevel
: this.topLevelI
options.bottomLevel = options.bottomLevel
options.bottomLevel
: this.bottomLevelI
options.maxResolution = this
.getResolutionForLevel(options.topLevel);
options.minResolution = this
.getResolutionForLevel(options.bottomLevel);
var newArguments = [ name, url, {}, options ];
OpenLayers.Layer.Grid.prototype.initialize.apply(this,
newArguments);
clone : function(obj) {
if (obj == null) {
obj = new OpenLayers.Layer.TDTLayer(this.name, this.url,
this.options);
obj = OpenLayers.Layer.Grid.prototype.clone
.apply(this, [ obj ]);
getURL : function(bounds) {
var level = this
.getLevelForResolution(this.map.getResolution());
var coef = 360 / Math.pow(2, level);
var x_num = this.topTileFromX & this.topTileToX
.round((bounds.left - this.topTileFromX) / coef) : Math
.round((this.topTileFromX - bounds.right) / coef);
var y_num = this.topTileFromY & this.topTileToY
.round((bounds.bottom - this.topTileFromY) / coef)
: Math.round((this.topTileFromY - bounds.top) / coef);
var type = this.mapT
if (type == "EMap") {
if (level &= 2 && level &= 10) {
type = "A0512_EMap";
} else if (level == 11 || level == 12) {
type = "B0627_EMap1112";
} else if (level &= 13 && level &= 18) {
type = "siwei0608";
}else if(type=="RMap"){
if (level &= 2 && level &= 7) {
type = "sbsm0210";
} else if (level &= 8 && level &= 10) {
type = "sbsm0210";
} else if (level &= 11 && level &= 14) {
type = "e11";
}else if (level &= 15 && level &= 18) {
type = "sbsm1518";
var url = this.
if (this.mirrorUrls != null) {
url = this.selectUrl(x_num, this.mirrorUrls);
return this.getFullRequestString({
X : x_num,
Y : y_num,
selectUrl : function(a, b) {
return b[a % b.length]
getLevelForResolution : function(res) {
var ratio = this.getMaxResolution() /
if (ratio & 1)
for ( var level = 0; ratio / 2 &= 1;) {
ratio /= 2;
getResolutionForLevel : function(level) {
return 360 / 256 / Math.pow(2, level);
getMaxResolution : function() {
return this.getResolutionForLevel(this.topLevelIndex)
getMinResolution : function() {
return this.getResolutionForLevel(this.bottomLevelIndex)
addTile : function(bounds, position) {
var url = this.getURL(bounds);
return new OpenLayers.Tile.Image(this, position, bounds, url,
this.tileSize);
CLASS_NAME : "OpenLayers.Layer.TiandituLayer"
  测试页面
  &!DOCTYPE html&
&meta http-equiv="Content-Type" content="text/ charset=utf-8"&
&meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"&
&meta name="apple-mobile-web-app-capable" content="yes"&
&title&OpenLayers Tiled Map Service Example&/title&
&link rel="stylesheet"
type="text/css"&
&link rel="stylesheet"
type="text/css"&
&script src="../lib/OpenLayers.js"$>$/script&
&script type="text/javascript"&
function init(){
var extent = new OpenLayers.Bounds(-180.0, -90.0, 180.0, 90.0);
var tempScales = [98.877];
var mapOptions = {
maxExtent: extent
var options= {
mapType:"EMap",
topLevel: 3,
bottomLevel: 20
map = new OpenLayers.Map("map",mapOptions);
layer = new OpenLayers.Layer.TiandituLayer("qincy", "",options);
map.addLayer(layer);
map.addControls([new OpenLayers.Control.MousePosition()]);
map.setCenter(new OpenLayers.LonLat(106,39), 3);
&body onload="init()"&
&div id="map" $>$/div&
  补充问题,由于天地图12级别以后,标注与地图分离,所以要修改下geturldaim
  加载两个图层一个图层设置成隐藏。
本问题标题:
本问题地址:
温馨提示:本问题已经关闭,不能解答。
暂无合适的专家
&&&&&&&&&&&&&&&
希赛网 版权所有 & &&}

我要回帖

更多关于 fe high fiyers 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信