arcgis simplify line流向图 xy to line 之后要怎么美化?

温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
博文约礼!
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(8415)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'(转)ArcGIS中如何将大量坐标点按顺序连接成线或面',
blogAbstract:'&&&&&&& 工作过程中,如果获得了一批点坐标信息(如Trimble GeoXT),如何将这些坐标信息直接转换成Arcmap下面的点呢?或者说就是把这些点坐标直接转换成线或面呢?需要用到Add XY Data…工具,下面是具体的方法:
&&&&& &1.将数据导入到Excel里面,总共有两列X,Y(列名可以随便取,但必须有列名),下面对应x,y坐标数据即可。&&&&
&&&&&& 2.将文件保存成.xls或者dbf文件。ArcMAP下面,菜单tools-Add XY Data,这时会形成一个新图层,所有的点都添加进来了,但现',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:1,
publishTime:5,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'博文约礼!',
hmcon:'0',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}3S处理技术(359)
ArcGIS教程(579)
  流向地图火了,因为Facebook的那张著名的友邻图,抑或因为《数据可视化之美》中介绍飞行模式的航线图,总之,流向地图以它特殊的可视化形式,直观地展示事物之间的联系,尤其在展示网络流向、贸易流向、迁徙路线等方面具有天然的优势。
  Flow maps - show the movement of some phenomenon, normally goods or people, from one place to another. Lines are used to symbolize the flow, typically varied in width to represent differences in the quantity of the flow.
  上面这段话是Flow Map的定义(Buckley,2013,AAG),流向地图的特点就在于展示移动的地理现象,利用线的粗细或是颜色来展示更多的信息。当我们惊叹于那优美的线条以及绚丽的可视化效果时,不由得会想到,怎么才能做出这么一张流向地图呢?ArcGIS是否能够快速的实现呢?
  其实早在2011年,Esri的制图专家Mamata Akella就发表了一篇Blog,介绍在ArcGIS中实现一种流向地图的方法[1],来展示2011年Esri用户大会的参会者来源,如下图所示。
  这里我们也以一个实例来尝试如何快速生成该类型的地图,在这个例子里,我们把帝都北京和其他各国家的首都连接起来,通过结果可以看到帝都与各首都之间航线的轨迹和距离,这里我们主要是利用ArcGIS的一个工具——XY to line。
  数据准备:XY to line工具所需要的输入是一个表格数据(.xls,.csv,.txt,.dbf均可以),必需的四个字段是每个点对的XY起止坐标,如下图所示,XCoor为各首都的X坐标,YCoord为各首都的Y坐标,BJX为北京的X坐标,BJY为北京的Y坐标,这里采用的是WGS 1984的坐标系统。
  数据处理:打开XY to line工具,设置如上图,在Line Type中有四个选项,这里我们选择的是GEODISIC,ID字段设置为大洲,目的是为了保留该字段,以便将来按大洲进行符号化。
  GEODESIC:测地线,椭球体表面上两点之间的最短连线
  GREAT_CIRCLE: 大圆航线,通过两航路点间的大圆圈线(该两航路点与地心在同一平面)
  RHUMB_LINE(loxodrome line): 等角航线:是地球表面上与经线相交成相同角度的曲线。在地球表面上除经线和纬线以外的等角航线,都是以极点为渐近点的螺旋曲线,在航海图(采用墨卡托投影)上又表现为直线
  NORMAL_SECTION:法截弧,A点的法线与B点确定的法截面与椭球相交的弧线
  经过简单渲染,我们就得到了这样的地图:
  偶尔换个视角也不错,例如我们把Data Frame的坐标系统换一换,再按大洲做个符号化:
  这样的地图看起来也很别致吧。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:255659次
积分:6782
积分:6782
排名:第2543名
原创:392篇
转载:248篇
评论:11条
(2)(2)(8)(11)(12)(11)(12)(8)(15)(12)(18)(21)(17)(13)(19)(1)(31)(36)(20)(15)(20)(18)(42)(26)(30)(22)(62)(55)(56)(26)模仿是最好的学习,这次我们继续山寨百度,通过自定义Infowindow来实现百度风格的BubblePopup
2.1 Copy模板
先打开百度地图,按下f12吧BubblePopup的HTML代码和CSS代码拷贝下来,这里我无耻的把类名改了,大家不要在意细节。
1 &div class="dextra-bubble-pop-center" style="z-index: 3; position: height: 50 width: 160"&
&div class="dextra-bubble-pop-content"
style="display: width: 160 height: 50 overflow-x: overflow-y:"&
&div id="poi_info_window" class="dextra-poi-info-window"&
&div class="left name-wrap"&&span class="name"&&/span&&/div&
9 &div class="dextra-bubble-pop-bottom" style="display: z-index: 2; width: 160 left: 72"&
&span&&/span&
2 .dextra-bubble-pop {
position: absolute;
z-index: <span style="color: #;
box-sizing: border-box;
box-shadow: 1px 2px 1px rgba(0, 0, 0, .15);
background-color: #FFF;
10 .dextra-poi-info-window {
padding: 4px 0;
14 .dextra-poi-info-window .left {
padding-left: 10px;
padding-right: 10px;
height: 40px;
line-height: 40px;
display: table;
table-layout: fixed;
width: <span style="color: #px;
text-align: center;
25 .dextra-poi-info-window .name-wrap .name {
vertical-align: middle;
font-size: 14px;
font-weight: <span style="color: #;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
35 .dextra-bubble-pop-bottom span {
position: absolute;
left:72px;
width: 16px;
height: 10px;
background-image: url("../images/tail_shadow.png");
2.2 编写BubblePopup
&&& 要实现BubblePopup,实际上就是自定义一个InfoWindow,我们可以通过继承InfoWindowBase来实现。要实现自定义的InfoWindow。我们可以先参考一下官方的例子,注意,这个例子是有缺陷的,如果当infowindow超出当前视图边界就会出现滚动条。下载官方的实例,我们打开infoWindow.js文件。
1 define([
"dojo/Evented",
"dojo/parser",
"dojo/on",
"dojo/_base/declare",
"dojo/dom-construct",
"dojo/_base/array",
"dojo/dom-style",
"dojo/_base/lang",
"dojo/dom-class",
"dojo/fx/Toggler",
"dojo/fx",
"dojo/Deferred",
"esri/domUtils",
"esri/InfoWindowBase"
18 function(
domConstruct,
InfoWindowBase
return declare([InfoWindowBase, Evented], {
isContentShowing :false,
constructor: function(parameters) {
lang.mixin(this, parameters);
domClass.add(this.domNode, "myInfoWindow");
this._closeButton = domConstruct.create("div",{"class": "close", "title": "Close"}, this.domNode);
this._title = domConstruct.create("div",{"class": "title"}, this.domNode);
this._content = domConstruct.create("div",{"class": "content"}, this.domNode);
this._toggleButton = domConstruct.create("div",{"class": "toggleOpen", "title": "Toggle"}, this.domNode);
var toggler = new
"node": this._content,
showFunc: coreFx.wipeIn,
hideFunc: coreFx.wipeOut
toggler.hide();
on(this._closeButton, "click", lang.hitch(this, function(){
//hide the content when the info window is toggled close.
this.hide();
if(this.isContentShowing){
toggler.hide();
this.isContentShowing = false;
domClass.remove(this._toggleButton);
domClass.add(this._toggleButton, "toggleOpen");
on(this._toggleButton, "click", lang.hitch(this, function(){
//animate the content display
if(this.isContentShowing){
toggler.hide();
this.isContentShowing = false;
domClass.remove(this._toggleButton);
domClass.add(this._toggleButton,"toggleOpen");
toggler.show();
this.isContentShowing=true;
domClass.remove(this._toggleButton);
domClass.add(this._toggleButton,"toggleClose");
//hide initial display
domUtils.hide(this.domNode);
this.isShowing = false;
setMap: function(map){
this.inherited(arguments);
map.on("pan-start", lang.hitch(this, function(){
this.hide();
map.on("zoom-start", lang.hitch(this, function(){
this.hide();
// map.on("zoom-start", //this, this.hide);
setTitle: function(title){
this.place(title, this._title);
setContent: function(content){
this.place(content, this._content);
show: function(location){
if(location.spatialReference){
location = this.map.toScreen(location);
//Position 10x10 pixels away from the specified location
domStyle.set(this.domNode,{
"left": (location.x + 10) + "px",
"top": (location.y + 10) + "px"
//display the info window
domUtils.show(this.domNode);
this.isShowing = true;
this.onShow();
hide: function(){
domUtils.hide(this.domNode);
this.isShowing = false;
this.onHide();
resize: function(width, height){
domStyle.set(this._content,{
"width": width + "px",
"height": height + "px"
domStyle.set(this._title,{
"width": width + "px"
destroy: function(){
domConstruct.destroy(this.domNode);
this._closeButton = this._title = this._content = null;
我们就在此基础上进行改造,不但要实现需求还要解决缺陷。infoWindowBase是继承自_WidgetBase的,我们先来看一下infoWindowBase的官方描述.
我们可以重写infoWindowBase的一些方法,来实现自己的infoWindow。
首先我们先引入我们要用到的模块
1 define([
"dojo/Evented",
"dojo/on",
"dojo/query",
"dojo/_base/declare",
"dojo/dom-construct",
"dojo/dom-attr",
"dojo/_base/array",
"dojo/dom-style",
"dojo/_base/lang",
"dojo/dom-class",
"dijit/_TemplatedMixin",
"esri/domUtils",
"esri/InfoWindowBase",
"esri/geometry/ScreenPoint",
"esri/geometry/screenUtils",
"esri/geometry/webMercatorUtils",
"dojo/text!./templates/dextraPopup.html"
function (Evented,
domConstruct,
_TemplatedMixin,
InfoWindowBase, ScreenPoint, screenUtils, webMercatorUtils, template) {
var showMapPoint = null;
return declare([InfoWindowBase, Evented, _TemplatedMixin], {
isContentShowing: false,
templateString: template,
_events: [],
constructor: function (parameters) {
lang.mixin(this, parameters);
&&&&& 对比官方的例子,我去掉了部分模块(coreFx,Toggler),加入了dijit/_TemplateMixin,esri/geometry/webMecratorUtils,
esri/geomtry/srcreenUtils模块。_TemplateMixin是为了使用我在第一步拷贝下来的HTML模板,关于编写基于模板的widget可以到
dojo的官网进行查看;webMecratorUtils和srcreenUtils则是为了实现地理坐标和屏幕坐标的准确转换。
showMapPoint是一个全局的变量,用来记录popup的地理坐标位置。
templateString是_TemplateMixin模块的一个属性,用来保存HTML模板。
_events:是一个数组,用来存储相关的事件,在popup被释放时释放注册的事件。
&&&&& 先用一个私有方法来进行初始化。应为InfoWindowBase是继承自_WidgetBase的,domNode是_WidgetBase的一个属性,用于表示生成Widget的dom节点,可以通过在构造函数里用第二个参数来进行传入,或者在内部自己定义。
_createInfoWindowInstance: function (map) {
this.domNode = domConstruct.create("div", null, map.id + "_root");
domClass.add(this.domNode, "dextra-bubble-pop");
domStyle.set(this.domNode, {
width: "160px",
this.domNode.innerHTML = this.templateS
this._content = query("div.name-wrap span.name");
this._title=query("div.name-wrap");
//hide initial display
domUtils.hide(this.domNode);
this.isShowing = false;
&&&& 注意,我在这里创建了一个div节点,并把它添加到一个id为{map.id}_root({map.id}占位符,用于表示地图的id)的dom节点中,这一步就是解决当infowindow超出当前视图范围时会出现滚动条。我们可以先用arcgis提供的infowindow来试一试,在浏览器中按
f12,我们看一看infowindow是放在哪的。
&&&& 利用arcgis自带的infowindow,我们可以看到这个infowindow的dom节点被添加到一个id为map_root的div中。在这里,我的map控件的id为&map&,所以它会生成一个id为&map_root&({map.id}_root)的div。所以我们只要把自定生成的popup放到这个节点中,当popup超出当前视图时,会被裁减了,而不是出现滚动条。这里最关键的部分已经完成了,接下来的操作就是如何在地图上展现这个popup。
_showInfoWindow: function (extent) {
if (showMapPoint == null)return;
var showScreenPoint = screenUtils.toScreenGeometry(extent, this.map.width, this.map.height, showMapPoint);
domStyle.set(this.domNode, {
"left": (showScreenPoint.x - 80) + "px",
"top": (showScreenPoint.y - 76 ) + "px"
domUtils.show(this.domNode);
this.isShowing = true;
this.onShow();
show: function (location) {
showMapPoint = location;
if (webMercatorUtils.canProject(location, this.map)) {
showMapPoint = webMercatorUtils.project(location, this.map);
if (showMapPoint.spatialReference) {
var screenPoint = this.map.toScreen(showMapPoint);
domStyle.set(this.domNode, {
"left": (screenPoint.x - 80) + "px",
"top": (screenPoint.y - 76) + "px"
//display the info window
domUtils.show(this.domNode);
this.isShowing = true;
this.onShow();
&&&&& _showInfoWindow方法是一个私有方法,用于在地图事件触发时调用。当地图平移,缩放时根据地理坐标从新计算BubblePopup的屏幕坐标。用screenUtils.toScreenGeometry(extent, width, height, mapGeometry)根据地图的范围,宽度,高度,和点计算出相应的屏幕坐标。
&&&& show方法是一个公有方法,用于在外部进行调用。在这里利用了arcgis js 提供webMercatorUtils模块,来进行坐标的转换。一般而言,我们都会用经纬度坐标,但是当地图是webMercator投影时,就需要先把经纬度坐标转化成米制坐标,才能在正确的位置显示出来来。
关键的部分已经完成,下面贴出全部代码
1 define([
"dojo/Evented",
"dojo/on",
"dojo/query",
"dojo/_base/declare",
"dojo/dom-construct",
"dojo/dom-attr",
"dojo/_base/array",
"dojo/dom-style",
"dojo/_base/lang",
"dojo/dom-class",
"dijit/_TemplatedMixin",
"esri/domUtils",
"esri/InfoWindowBase",
"esri/geometry/ScreenPoint",
"esri/geometry/screenUtils",
"esri/geometry/webMercatorUtils",
"dojo/text!./templates/dextraPopup.html"
function (Evented,
domConstruct,
_TemplatedMixin,
InfoWindowBase, ScreenPoint, screenUtils, webMercatorUtils, template) {
var showMapPoint = null;
return declare([InfoWindowBase, Evented, _TemplatedMixin], {
templateString: template,
_events: [],
constructor: function (parameters) {
lang.mixin(this, parameters);
_createInfoWindowInstance: function (map) {
this.domNode = domConstruct.create("div", null, map.id + "_root");
domClass.add(this.domNode, "dextra-bubble-pop");
domStyle.set(this.domNode, {
width: "160px",
this.domNode.innerHTML = this.templateS
this._content = query("div.name-wrap span.name");
this._title=query("div.name-wrap");
//hide initial display
domUtils.hide(this.domNode);
this.isShowing = false;
setMap: function (map) {
this.inherited(arguments);
this._events = [];
this._createInfoWindowInstance(map);
this._events.push(map.on("pan", lang.hitch(this, function (evt) {
if (this.isShowing) {
this._showInfoWindow(evt.extent);
this._events.push(map.on("zoom-start", lang.hitch(this, function (evt) {
this.hide();
this._events.push(map.on("zoom-end", lang.hitch(this, function (evt) {
this._showInfoWindow(evt.extent);
unsetMap: function (map) {
this.inherited(arguments);
array.forEach(this._events, function (event) {
event.remove();
setTitle: function (title) {
this._title.forEach(function (node) {
domAttr.set(node, "title", title);
setContent: function (content) {
this._content.forEach(function (node) {
node.innerHTML =
_showInfoWindow: function (extent) {
if (showMapPoint == null)return;
var showScreenPoint = screenUtils.toScreenGeometry(extent, this.map.width, this.map.height, showMapPoint);
domStyle.set(this.domNode, {
"left": (showScreenPoint.x - 80) + "px",
"top": (showScreenPoint.y - 76 ) + "px"
domUtils.show(this.domNode);
this.isShowing = true;
this.onShow();
show: function (location) {
showMapPoint = location;
if (webMercatorUtils.canProject(location, this.map)) {
showMapPoint = webMercatorUtils.project(location, this.map);
if (showMapPoint.spatialReference) {
var screenPoint = this.map.toScreen(showMapPoint);
domStyle.set(this.domNode, {
"left": (screenPoint.x - 80) + "px",
"top": (screenPoint.y - 76) + "px"
//display the info window
domUtils.show(this.domNode);
this.isShowing = true;
this.onShow();
hide: function () {
if (this.isShowing) {
domUtils.hide(this.domNode);
this.isShowing = false;
this.onHide();
resize: function (width, height) {
domStyle.set(this._content, {
"width": width + "px",
"height": height + "px"
remove: function () {
this.hide();
showMapPoint = null;
destroy: function () {
domConstruct.destroy(this.domNode);
1 &!DOCTYPE html&
2 &html lang="en"&
&meta charset="UTF-8"&
&title&DExtra-BubublPoopup&/title&
&link rel="stylesheet" href="/3.16/esri/css/esri.css"&
&link rel="stylesheet" href="../dist/dijit/css/dextraPopup.css"&
&link rel="stylesheet" href="css/mainApp.css"&
var dojoConfig = {
parseOnLoad:true,
packages: [{
name: 'custom',
location: location.pathname.replace(/\/[^/]+$/, '') + '/custom'//从cdn加载自己定义的模块方法
name: 'dextra',
location: '/extra.arcgis.3.x/dist/'//从cdn加载自己定义的模块方法
&script src="/3.16/"&&/script&
"dojo/dom",
"dojo/on",
"esri/map",
"esri/symbols/SimpleMarkerSymbol",
"esri/InfoTemplate",
"esri/layers/GraphicsLayer",
"dextra/layers/GoogleVectorLayer",
"dextra/dijit/DEBubblePopup",
"dojo/domReady!"],
function (dom, on,
Graphic, SimpleMarkerSymbol, InfoTemplate, GraphicsLayer,
GoogleVectorLayer,DEBubblePopup) {
var infoWindow = new
DEBubblePopup();
var map = new Map("map", {
showAttribution: false,
center: [102.3, 24.6],
autoResize: true,
sliderPosition: "bottom-right",
logo: false,
infoWindow:infoWindow,
var googleVect = new GoogleVectorLayer();
map.addLayer(googleVect);
var measureLayer = new GraphicsLayer({id: "infoWindowTest"});
map.addLayer(measureLayer);
on(dom.byId("infowindow"), "click", function (e) {
on.once(map, "click", function (evt) {
console.log(map._container);
var sms = new SimpleMarkerSymbol({
"color": [255, 0, 0],
"size": 12,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [0, 0, 0, 255],
"width": 1,
"type": "esriSLS",
"style": "esriSLSSolid"
var point = map.toMap(evt.screenPoint);
var attr = {"Xcoord": point.x, "Ycoord": point.y, "Plant": "Mesa Mint"};
var infoTemplate = new InfoTemplate("Locations", "Latitude: ${Ycoord} Longitude: ${Xcoord}Plant Name:${Plant}");
var graphic=new Graphic(point, sms,attr,infoTemplate);
measureLayer.add(graphic);
#measureTools {
z-index: 1000;
89 &/head&
91 &div id="measureTools"&
&button id="infowindow"&弹出框&/button&
95 &div id="map" &&/div&
96 &/body&
97 &/html&
效果截图:
&&& 可以看到,通过继承InfoWindowBase我们完全可以实现自己的的infoWindow,编写更具个性化的插件。最后像新手玩家推荐一下
esri的github,这里有很多有用的东西,非常值得学习。
&&& 本文参考了
谢谢的分享。
& & 欢迎转载&/deliciousExtra/p/5565787.html
阅读(...) 评论()ARCGIS中的线与面转换
Feature To Line与Polygon To Line的异同
在Arctoolbox中,有两个命令可将面要素类转换成线要素类:Feature To Line和Polygon To
Line。虽然这两个命令都能将面状要素类转换成线状要素类,但他们之间有很多不同,正确的了解了他们之间的不同后我们可以有选择地使用这两个命令之一。
一、Feature To Line:由输入的面要素类或线要素类生成新的线要素类
这个工具与有两个特点:
1、可将输入要素类的属性值传递到输出要素类中(由preserve attribute选项决定)
2、两个要素的公共边会产生重复线段。
输入要素类:&&
&& 输入要素类:
二、Polygon To
Line:由输入的面要素类生成线要素类
其特点是会在产生的线要素类的属性表内生成两个字段:left_fid和right_fid,代表相应的线段在原面要素类中左多边形和右多边形的fid值。
输入要素类同上,输出要素类:
Polygon To Line不会传递原面要素类的属性到生成的线要素类,且不会产生重复的线段,这是与Feature To
Line最大的区别。
巴特~为什么Feature To Line会产生重复线而Polygon To Line不会呢?其原因可能是Feature To
Line转换polygon的边界时是一个个polygon单独提取边界的,没考虑之间的相互位置关系,所以会产生重复的线;而Polygon
To Line综合考虑了相邻polygon的相互关系,所以不会产生重复的线。
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

我要回帖

更多关于 arcgis 流向 的文章

 

随机推荐