如何使用ArcGIS API for Flex 调用天地图
5个回答
2014-12-22 · 知道合伙人数码行家
可以叫我表哥
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:25897
获赞数:1464984
2010年毕业于北京化工大学北方学院计算机科学与技术专业毕业,学士学位,工程电子技术行业4年从业经验。
向TA提问 私信TA
关注
展开全部
本文讲述如何使用ArcGIS API for Flex调用天地图的服务,那么下面我就把代码共享给大家。 实现的方式主要是扩展ArcGIS API for Flex中的TiledMapLayer,去读取天地图的切片: packagecom.esrichina { importcom.esri.ags.SpatialReference; importcom.esri.ag
本文讲述如何使用ArcGIS API for Flex调用天地图的服务,那么下面我就把代码共享给大家。 实现的方式主要是扩展ArcGIS API for Flex中的TiledMapLayer,去读取天地图的切片:
package com.esrichina { import com.esri.ags.SpatialReference; import com.esri.ags.geometry.Extent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.layers.LOD; import com.esri.ags.layers.TileInfo; import com.esri.ags.layers.TiledMapServiceLayer; import flash.net.URLRequest; public class tdtMapslayer extends TiledMapServiceLayer { public function tdtMapslayer() { super(); buildTileInfo(); setLoaded(true); } private var _tileInfo:TileInfo=new TileInfo(); private var _baseURL:String=""; override public function get fullExtent():Extent { return new Extent(-180, -90, 180, 90, new SpatialReference(4326)); } override public function get initialExtent():Extent { return new Extent(-180, -90, 180, 90, new SpatialReference(4326)); } override public function get spatialReference():SpatialReference { return new SpatialReference(4326); } override public function get tileInfo():TileInfo { return _tileInfo; } override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest { var url:String="http://tile2.tianditu.com/DataServer?T=A0512_EMap&" + "X=" + col + "&" + "Y=" + row + "&" + "L=" + level; return new URLRequest(url); } private function buildTileInfo():void { _tileInfo.height=256; _tileInfo.width=256; _tileInfo.origin=new MapPoint(-90 ,45 ,new SpatialReference(4326)); _tileInfo.spatialReference=new SpatialReference(4326); _tileInfo.lods = [ new LOD(1, 0.3515625, 147748799.285417), new LOD(2, 0.17578125, 73874399.6427087), new LOD(3, 0.087890625, 36937199.8213544), new LOD(4, 0.0439453125, 18468599.9106772), new LOD(5, 0.02197265625, 9234299.95533859), new LOD(6, 0.010986328125, 4617149.97766929), new LOD(7, 0.0054931640625, 2308574.98883465), new LOD(8, 0.00274658203125, 1154287.49441732), new LOD(9, 0.001373291015625, 577143.747208662), new LOD(10, 0.0006866455078125, 288571.873604331), new LOD(11, 0.00034332275390625, 144285.936802165), new LOD(12, 0.000171661376953125, 72142.9684010827), new LOD(13, 8.58306884765629E-05, 36071.4842005414), new LOD(14, 4.29153442382814E-05, 18035.7421002707), new LOD(15, 2.14576721191407E-05, 9017.87105013534), new LOD(16, 1.07288360595703E-05, 4508.93552506767), new LOD(17, 5.36441802978515E-06, 2254.467762533835), new LOD(18, 2.68220901489258E-06, 1127.2338812669175) ]; } } }
本文讲述如何使用ArcGIS API for Flex调用天地图的服务,那么下面我就把代码共享给大家。 实现的方式主要是扩展ArcGIS API for Flex中的TiledMapLayer,去读取天地图的切片:
package com.esrichina { import com.esri.ags.SpatialReference; import com.esri.ags.geometry.Extent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.layers.LOD; import com.esri.ags.layers.TileInfo; import com.esri.ags.layers.TiledMapServiceLayer; import flash.net.URLRequest; public class tdtMapslayer extends TiledMapServiceLayer { public function tdtMapslayer() { super(); buildTileInfo(); setLoaded(true); } private var _tileInfo:TileInfo=new TileInfo(); private var _baseURL:String=""; override public function get fullExtent():Extent { return new Extent(-180, -90, 180, 90, new SpatialReference(4326)); } override public function get initialExtent():Extent { return new Extent(-180, -90, 180, 90, new SpatialReference(4326)); } override public function get spatialReference():SpatialReference { return new SpatialReference(4326); } override public function get tileInfo():TileInfo { return _tileInfo; } override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest { var url:String="http://tile2.tianditu.com/DataServer?T=A0512_EMap&" + "X=" + col + "&" + "Y=" + row + "&" + "L=" + level; return new URLRequest(url); } private function buildTileInfo():void { _tileInfo.height=256; _tileInfo.width=256; _tileInfo.origin=new MapPoint(-90 ,45 ,new SpatialReference(4326)); _tileInfo.spatialReference=new SpatialReference(4326); _tileInfo.lods = [ new LOD(1, 0.3515625, 147748799.285417), new LOD(2, 0.17578125, 73874399.6427087), new LOD(3, 0.087890625, 36937199.8213544), new LOD(4, 0.0439453125, 18468599.9106772), new LOD(5, 0.02197265625, 9234299.95533859), new LOD(6, 0.010986328125, 4617149.97766929), new LOD(7, 0.0054931640625, 2308574.98883465), new LOD(8, 0.00274658203125, 1154287.49441732), new LOD(9, 0.001373291015625, 577143.747208662), new LOD(10, 0.0006866455078125, 288571.873604331), new LOD(11, 0.00034332275390625, 144285.936802165), new LOD(12, 0.000171661376953125, 72142.9684010827), new LOD(13, 8.58306884765629E-05, 36071.4842005414), new LOD(14, 4.29153442382814E-05, 18035.7421002707), new LOD(15, 2.14576721191407E-05, 9017.87105013534), new LOD(16, 1.07288360595703E-05, 4508.93552506767), new LOD(17, 5.36441802978515E-06, 2254.467762533835), new LOD(18, 2.68220901489258E-06, 1127.2338812669175) ]; } } }
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
展开全部
本文讲述如何使用ArcGIS API for Flex调用天地图的服务,那么下面我就把代码共享给大家。 实现的方式主要是扩展ArcGIS API for Flex中的TiledMapLayer,去读取天地图的切片: packagecom.esrichina { importcom.esri.ags.SpatialReference; importcom.esri.ag
本文讲述如何使用ArcGIS API for Flex调用天地图的服务,那么下面我就把代码共享给大家。 实现的方式主要是扩展ArcGIS API for Flex中的TiledMapLayer,去读取天地图的切片:
package com.esrichina { import com.esri.ags.SpatialReference; import com.esri.ags.geometry.Extent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.layers.LOD; import com.esri.ags.layers.TileInfo; import com.esri.ags.layers.TiledMapServiceLayer; import flash.net.URLRequest; public class tdtMapslayer extends TiledMapServiceLayer { public function tdtMapslayer() { super(); buildTileInfo(); setLoaded(true); } private var _tileInfo:TileInfo=new TileInfo(); private var _baseURL:String=""; override public function get fullExtent():Extent { return new Extent(-180, -90, 180, 90, new SpatialReference(4326)); } override public function get initialExtent():Extent { return new Extent(-180, -90, 180, 90, new SpatialReference(4326)); } override public function get spatialReference():SpatialReference { return new SpatialReference(4326); } override public function get tileInfo():TileInfo { return _tileInfo; } override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest { var url:String="http://tile2.tianditu.com/DataServer?T=A0512_EMap&" + "X=" + col + "&" + "Y=" + row + "&" + "L=" + level; return new URLRequest(url); } private function buildTileInfo():void { _tileInfo.height=256; _tileInfo.width=256; _tileInfo.origin=new MapPoint(-90 ,45 ,new SpatialReference(4326)); _tileInfo.spatialReference=new SpatialReference(4326); _tileInfo.lods = [ new LOD(1, 0.3515625, 147748799.285417), new LOD(2, 0.17578125, 73874399.6427087), new LOD(3, 0.087890625, 36937199.8213544), new LOD(4, 0.0439453125, 18468599.9106772), new LOD(5, 0.02197265625, 9234299.95533859), new LOD(6, 0.010986328125, 4617149.97766929), new LOD(7, 0.0054931640625, 2308574.98883465), new LOD(8, 0.00274658203125, 1154287.49441732), new LOD(9, 0.001373291015625, 577143.747208662), new LOD(10, 0.0006866455078125, 288571.873604331), new LOD(11, 0.00034332275390625, 144285.936802165), new LOD(12, 0.000171661376953125, 72142.9684010827), new LOD(13, 8.58306884765629E-05, 36071.4842005414), new LOD(14, 4.29153442382814E-05, 18035.7421002707), new LOD(15, 2.14576721191407E-05, 9017.87105013534), new LOD(16, 1.07288360595703E-05, 4508.93552506767), new LOD(17, 5.36441802978515E-06, 2254.467762533835), new LOD(18, 2.68220901489258E-06, 1127.2338812669175) ]; } } }
本文讲述如何使用ArcGIS API for Flex调用天地图的服务,那么下面我就把代码共享给大家。 实现的方式主要是扩展ArcGIS API for Flex中的TiledMapLayer,去读取天地图的切片:
package com.esrichina { import com.esri.ags.SpatialReference; import com.esri.ags.geometry.Extent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.layers.LOD; import com.esri.ags.layers.TileInfo; import com.esri.ags.layers.TiledMapServiceLayer; import flash.net.URLRequest; public class tdtMapslayer extends TiledMapServiceLayer { public function tdtMapslayer() { super(); buildTileInfo(); setLoaded(true); } private var _tileInfo:TileInfo=new TileInfo(); private var _baseURL:String=""; override public function get fullExtent():Extent { return new Extent(-180, -90, 180, 90, new SpatialReference(4326)); } override public function get initialExtent():Extent { return new Extent(-180, -90, 180, 90, new SpatialReference(4326)); } override public function get spatialReference():SpatialReference { return new SpatialReference(4326); } override public function get tileInfo():TileInfo { return _tileInfo; } override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest { var url:String="http://tile2.tianditu.com/DataServer?T=A0512_EMap&" + "X=" + col + "&" + "Y=" + row + "&" + "L=" + level; return new URLRequest(url); } private function buildTileInfo():void { _tileInfo.height=256; _tileInfo.width=256; _tileInfo.origin=new MapPoint(-90 ,45 ,new SpatialReference(4326)); _tileInfo.spatialReference=new SpatialReference(4326); _tileInfo.lods = [ new LOD(1, 0.3515625, 147748799.285417), new LOD(2, 0.17578125, 73874399.6427087), new LOD(3, 0.087890625, 36937199.8213544), new LOD(4, 0.0439453125, 18468599.9106772), new LOD(5, 0.02197265625, 9234299.95533859), new LOD(6, 0.010986328125, 4617149.97766929), new LOD(7, 0.0054931640625, 2308574.98883465), new LOD(8, 0.00274658203125, 1154287.49441732), new LOD(9, 0.001373291015625, 577143.747208662), new LOD(10, 0.0006866455078125, 288571.873604331), new LOD(11, 0.00034332275390625, 144285.936802165), new LOD(12, 0.000171661376953125, 72142.9684010827), new LOD(13, 8.58306884765629E-05, 36071.4842005414), new LOD(14, 4.29153442382814E-05, 18035.7421002707), new LOD(15, 2.14576721191407E-05, 9017.87105013534), new LOD(16, 1.07288360595703E-05, 4508.93552506767), new LOD(17, 5.36441802978515E-06, 2254.467762533835), new LOD(18, 2.68220901489258E-06, 1127.2338812669175) ]; } } }
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
需要下载安装 arcgis server api for flex
如果只是加载地图,很简单的,如果需要别的功能,就需要仔细研究下了。esri网上都提供了常见功能的demo。
稍后帮你提供点链接~~
如果只是加载地图,很简单的,如果需要别的功能,就需要仔细研究下了。esri网上都提供了常见功能的demo。
稍后帮你提供点链接~~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
继承 TiledMapServiceLayer 编写SXGeoTileLayer 类
package ext
{
import com.esri.ags.SpatialReference;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.layers.supportClasses.LOD;
import com.esri.ags.layers.supportClasses.TileInfo;
import com.esri.ags.layers.TiledMapServiceLayer;
import com.esri.ags.layers.TiledMapServiceLayer;
import flash.geom.Point;
import flash.net.URLRequest;
/**
* SXGeoTileLayer 吉奥的地图服务
*/
public class SXGeoTileLayer extends TiledMapServiceLayer
{
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Creates a new PortlandTiledMapServiceLayer object.
*/
public function SXGeoTileLayer()
{
super();
buildTileInfo(); // to create our hardcoded tileInfo
setLoaded(true); // Map will only use loaded layers
}
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
private var wkid:int = 4326;
private var _tileInfo:TileInfo = new TileInfo(); // see buildTileInfo()
private var _url:String = new String();
//private var _wmsLayer:String = new String();
//--------------------------------------------------------------------------
//
// Overridden properties
// fullExtent()
// initialExtent()
// spatialReference()
// tileInfo()
// units()
//
//--------------------------------------------------------------------------
//----------------------------------
// fullExtent
// - required to calculate the tiles to use
//----------------------------------
override public function get fullExtent():Extent
{
return new Extent(-180, -90, 180, 90, new SpatialReference(4326));
//return new Extent(65.94,18.84,137.74,62.85, new SpatialReference(4326));
}
//----------------------------------
// initialExtent
// - needed if Map doesn't have an extent
//----------------------------------
override public function get initialExtent():Extent
{
return new Extent(-124.731422,24.955967,-66.969849, 49.371735,new SpatialReference(4326));
//return new Extent(112.48,47.77,112.60,47.97, new SpatialReference(4326));
}
//----------------------------------
// spatialReference
// - needed if Map doesn't have a spatialReference
//----------------------------------
override public function get spatialReference():SpatialReference
{
return new SpatialReference(4326);
}
//----------------------------------
// tileInfo
//----------------------------------
override public function get tileInfo():TileInfo
{
return _tileInfo;
}
//----------------------------------
// units
// - needed if Map doesn't have it set
//----------------------------------
override public function get units():String
{
return "esriDecimalDegrees";
}
//--------------------------------------------------------------------------
//
// Overridden methods
// getTileURL(level:Number, row:Number, col:Number):URLRequest
//
//--------------------------------------------------------------------------
override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest
{
var url:String ;
url = _url + "&X=" + col.toString() + "&Y=" + row.toString()+ "&L="+ level.toString();
return new URLRequest(url) ;
}
//--------------------------------------------------------------------------
//
// Private Methods
//
//--------------------------------------------------------------------------
private function buildTileInfo():void
{
_tileInfo.height = 256;
_tileInfo.width = 256;
_tileInfo.origin = new MapPoint(-180, 90);
_tileInfo.spatialReference = new SpatialReference(4326);
_tileInfo.lods = [
//new LOD(0, 1.40625, 590995197.1416691),
new LOD(1, 0.703125, 295497598.5708346),
new LOD(2, 0.3515625, 147748799.2854173),
new LOD(3, 0.17578125, 73874399.64270864),
new LOD(4, 0.087890625, 36937199.82135432),
new LOD(5, 0.0439453125, 18468599.91067716),
new LOD(6, 0.02197265625, 9234299.95533858),
new LOD(7, 0.010986328125, 4617149.97766929),
new LOD(8, 0.0054931640625, 2308574.98883465),
new LOD(9, 0.00274658203124999, 1154287.49441732),
new LOD(10, 0.001373291015625, 577143.747208662),
new LOD(11, 0.0006866455078125, 288571.873604331),
new LOD(12, 0.000343322753906249, 144285.936802165),
new LOD(13, 0.000171661376953125, 72142.9684010827),
new LOD(14, 0.0000858306884765626, 36071.4842005414),
new LOD(15, 0.0000429153442382813, 18035.7421002707),
new LOD(16, 0.0000214576721191406, 9017.87105013534),
];
}
private function padString(text:String, size:int, ch:String):String
{
while (text.length < size)
{
text = ch + text;
}
return text;
}
public function set url(val:String):void
{
this._url = val;
}
}
}
package ext
{
import com.esri.ags.SpatialReference;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.layers.supportClasses.LOD;
import com.esri.ags.layers.supportClasses.TileInfo;
import com.esri.ags.layers.TiledMapServiceLayer;
import com.esri.ags.layers.TiledMapServiceLayer;
import flash.geom.Point;
import flash.net.URLRequest;
/**
* SXGeoTileLayer 吉奥的地图服务
*/
public class SXGeoTileLayer extends TiledMapServiceLayer
{
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Creates a new PortlandTiledMapServiceLayer object.
*/
public function SXGeoTileLayer()
{
super();
buildTileInfo(); // to create our hardcoded tileInfo
setLoaded(true); // Map will only use loaded layers
}
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
private var wkid:int = 4326;
private var _tileInfo:TileInfo = new TileInfo(); // see buildTileInfo()
private var _url:String = new String();
//private var _wmsLayer:String = new String();
//--------------------------------------------------------------------------
//
// Overridden properties
// fullExtent()
// initialExtent()
// spatialReference()
// tileInfo()
// units()
//
//--------------------------------------------------------------------------
//----------------------------------
// fullExtent
// - required to calculate the tiles to use
//----------------------------------
override public function get fullExtent():Extent
{
return new Extent(-180, -90, 180, 90, new SpatialReference(4326));
//return new Extent(65.94,18.84,137.74,62.85, new SpatialReference(4326));
}
//----------------------------------
// initialExtent
// - needed if Map doesn't have an extent
//----------------------------------
override public function get initialExtent():Extent
{
return new Extent(-124.731422,24.955967,-66.969849, 49.371735,new SpatialReference(4326));
//return new Extent(112.48,47.77,112.60,47.97, new SpatialReference(4326));
}
//----------------------------------
// spatialReference
// - needed if Map doesn't have a spatialReference
//----------------------------------
override public function get spatialReference():SpatialReference
{
return new SpatialReference(4326);
}
//----------------------------------
// tileInfo
//----------------------------------
override public function get tileInfo():TileInfo
{
return _tileInfo;
}
//----------------------------------
// units
// - needed if Map doesn't have it set
//----------------------------------
override public function get units():String
{
return "esriDecimalDegrees";
}
//--------------------------------------------------------------------------
//
// Overridden methods
// getTileURL(level:Number, row:Number, col:Number):URLRequest
//
//--------------------------------------------------------------------------
override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest
{
var url:String ;
url = _url + "&X=" + col.toString() + "&Y=" + row.toString()+ "&L="+ level.toString();
return new URLRequest(url) ;
}
//--------------------------------------------------------------------------
//
// Private Methods
//
//--------------------------------------------------------------------------
private function buildTileInfo():void
{
_tileInfo.height = 256;
_tileInfo.width = 256;
_tileInfo.origin = new MapPoint(-180, 90);
_tileInfo.spatialReference = new SpatialReference(4326);
_tileInfo.lods = [
//new LOD(0, 1.40625, 590995197.1416691),
new LOD(1, 0.703125, 295497598.5708346),
new LOD(2, 0.3515625, 147748799.2854173),
new LOD(3, 0.17578125, 73874399.64270864),
new LOD(4, 0.087890625, 36937199.82135432),
new LOD(5, 0.0439453125, 18468599.91067716),
new LOD(6, 0.02197265625, 9234299.95533858),
new LOD(7, 0.010986328125, 4617149.97766929),
new LOD(8, 0.0054931640625, 2308574.98883465),
new LOD(9, 0.00274658203124999, 1154287.49441732),
new LOD(10, 0.001373291015625, 577143.747208662),
new LOD(11, 0.0006866455078125, 288571.873604331),
new LOD(12, 0.000343322753906249, 144285.936802165),
new LOD(13, 0.000171661376953125, 72142.9684010827),
new LOD(14, 0.0000858306884765626, 36071.4842005414),
new LOD(15, 0.0000429153442382813, 18035.7421002707),
new LOD(16, 0.0000214576721191406, 9017.87105013534),
];
}
private function padString(text:String, size:int, ch:String):String
{
while (text.length < size)
{
text = ch + text;
}
return text;
}
public function set url(val:String):void
{
this._url = val;
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
首先确认一下,你是不是用flexviewer来访问天地图里面发布的地图服务?如果是那样,只需要把flexviewer里面的config.xml中的basemap和其它服务替换成你需要访问的天地图服务地址就可以了。Good luck~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询