Clustering with the ArcGIS API for Flex
Clustering is an excellent technique for visualizing lotss of point data. We've all seen applications where there were so many points that simply appear as one big blob.Clustering takes the individual points and groups them into clusters and then renders the cluster as one graphic.In this post I will describe how you can use ArcGIS API for Flex to create clustering demo.
First,I add 500 random points in the map of tianditu.(There tell you how to create tianditu use ArcGIS API for Flex)
- // 往地图上添加点
- protected function addPointsToMap(cluseter:WeightedClusterer):void
- {
- var graphicsLayer:GraphicsLayer = new GraphicsLayer();
- for(var i:int = ; i < ; i++)
- {
- // 产生随机数
- var num: Number = Math.round(Math.random() * );
- var num2: Number = Math.round(Math.random() * );
- // 产生随机颜色
- var index: Number = Math.round(Math.random() * );
- var colors: Array = ["0xFF00FF", "0x0000FF", "0x000000", "0x008000", "0x800000"];
- var color:Number = parseInt(colors[index]);
- var sym:SimpleMarkerSymbol = new SimpleMarkerSymbol("circle",,color);
- var geo:MapPoint = new MapPoint(120.13102 - num * 0.01, 30.19089 - num2 * 0.01);
- var graphic:Graphic = new Graphic(geo,sym);
- graphicsLayer.add(graphic);
- }
- myMap.addLayer(graphicsLayer);
- }
And then, I create the Cluster.
- // 文本格式
- var tf:TextFormat = new TextFormat("Arial",,0xE6E6E6);
- // 创建FlareSymbol
- var flareSymbol:FlareSymbol = new FlareSymbol();
- flareSymbol.backgroundAlphas = [0.7,1.0];
- flareSymbol.backgroundColor = 0x394B8C;
- flareSymbol.backgroundColors = [0x5B8C3E,0xBF2827];
- flareSymbol.borderColor= 0x666666;
- flareSymbol.flareMaxCount=;
- flareSymbol.flareSizeIncOnRollOver=;
- flareSymbol.sizes=[,];
- flareSymbol.textFormat=tf;
- flareSymbol.weights=[,];
- // 创建Clustering
- var cluseter:WeightedClusterer = new WeightedClusterer();
- cluseter.sizeInPixels = ;
- cluseter.symbol = flareSymbol;
- cluseter.center = new MapPoint(117.02263, 28.28375,new SpatialReference());
At last, add cluseter to graphic.
- graphicsLayer.clusterer = cluseter;
The effect is like it.
Download source here.
Clustering with the ArcGIS API for Flex的更多相关文章
- 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(十)态势标绘模块
config.xml文件的配置如下: <widget label="态势标绘" icon="assets/images/impact_area_over.png&q ...
- arcgis api for flex之专题图制作(饼状图,柱状图等)
最近公司给我一个任务,就是利用arcgis api for flex实现在地图上点(业务数据)直接显示饼状图以及柱状图的专题图制作,而不是通过点击点显示气泡窗口的形式来实现,这个公司已经实现了. 经过 ...
- 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(一)GIS一张图的系统开发环境以及flexviewer框架
系统的GIS功能实现是基于arcgis api for flex,首先附上系统的主界面图,接下来的是对主界面的模块功能详细讲解: 一.GIS环境软件安装 (1)arcgis desktop的安装,要是 ...
- ArcGIS API for Flex实现GraphicsLayer上画点、线、面。
目的: ArcGIS API for Flex实现GraphicsLayer上画点.线.面. 准备工作: 1.这次地图数据就用Esri提供的http://server.arcgisonline.com ...
- arcgis api for flex 开发入门(一)环境搭建
http://www.cnblogs.com/wenjl520/archive/2009/06/02/1494514.html arcgis api for flex 开发入门(一)环境搭建arcgi ...
- 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(十三)台风模块
config.xml文件的配置如下: <widget label="台风" icon="assets/images/typhoon.png" config ...
- 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(十一)路径导航模块
config.xml文件的配置如下: <widget label="路径导航" icon="assets/images/lujingdaohang.png" ...
- 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(四)地图导航控件模块
config.xml文件的配置如下: <widget left="10" top="50" config="widgets/Navigation ...
- 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(三)显示地图坐标系模块
config.xml文件的配置如下: <widget left="3" bottom="3" config="widgets/Coordinat ...
随机推荐
- 怎么做一个bat文件
怎么做一个bat文件 | 浏览:639 | 更新:2014-11-25 17:02 1 2 3 4 5 6 7 分步阅读 其实做一个.BAT文件很简单,下面我就以做一个清除系统垃圾.BAT文件为例,给 ...
- fck编辑器漏洞想到的--目录的执行权限
结合近来我遇到的问题,转一篇关于目录的执行权限问题.来解决fck编辑器的漏洞.漏洞就是给人家上传了文件,而且还遍历目录或者直接执行文件,,非常大大的危险. 解决方法如下. 1,首先要删除fckedit ...
- springmvc学习第一天
一.helloworld的实现 1.加入jar包(加入无关的jar包可能会引起服务器的冲突) commons-logging-1.2.jarjstl.jarspring-aop-4.1.6.RELEA ...
- android技巧(二)listview的优化
对于listview的优化有以下三个措施: 1.原有listview每一个item显示时都会调用一次getView()方法,实际上对于ListView而言,只需要保留能够显示的最大个数的view即可, ...
- 数组第K小数问题 及其对于 快排和堆排 的相关优化比较
题目描述 给定一个整数数组a[0,...,n-1],求数组中第k小数 输入描述 首先输入数组长度n和k,其中1<=n<=5000, 1<=k<=n 然后输出n个整形元素,每个数 ...
- java中时间类型的问题
时间类型:System.currentTimeMillis() 获得的是自1970-1-01 00:00:00.000 到当前时刻的时间距离,类型为longimport java.sql.Date d ...
- Eclipse上运行第一个Hadoop实例 - WordCount(单词统计程序)
需求 计算出文件中每个单词的频数.要求输出结果按照单词的字母顺序进行排序.每个单词和其频数占一行,单词和频数之间有间隔. 比如,输入两个文件,其一内容如下: hello world hello had ...
- Linux命令--top使用技巧
摘自 http://www.jb51.net/LINUXjishu/151995.html top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用情况,类似于Windows的 ...
- 工具第二天 cocoaPods 私有库的创建
之前介绍了cocoaPods的安装与使用,今天简单谈一下 自己的私有库运用cocoaPods依赖. cd到需要做库的工程目录下 创建一个podspec文件 创建:pod spec create 名称 ...
- C#先执行一段sql等后台操作后再提示是否后续操作confrim
应用场景:例如选择一个单据号打击打印后先去数据库检索是否有打打印过,如果有则提示,已打印,是否再打 如果没有则不提示,直接进行打印. 实现原理:多做一个隐藏按钮去实现打印功能,页面上的打印按钮则进行数 ...