Quantcast
Channel: GeoVisual
Viewing all 11 articles
Browse latest View live

用Google Reader订阅GIS相关中文期刊

$
0
0

虽然我怀有一颗学术的心,但无奈长了一双码农的翅膀,还是先飞的那款。不过不管怎样,都应该时常关注学术界的动态。英文的有点难,毕竟有语言的障碍。中文的就相对简单了,用Google Reader,订阅一下各个期刊feed,所有更新都会给你存着。找个风和日丽的日子,挑你感兴趣的浏览下标题、看看摘要,摘要还不错的下个全文阅读下。方便快捷,简单高效!

下面是我在cnki上找的一些feed,可能有所缺漏(欢迎补充),供大家参考:

可以去这里订阅:

https://www.google.com/reader/bundle/user%2F14979793743573599778%2Fbundle%2FGISCN

先前曾做过新浪微博中的Esri中国相关微博的订阅源,但后来那个中间转发的工具坏掉了,新浪又坚持不公开RSS功能。曾想过月光老师的开发的微博推送工具,架在sina app上自己用,但那是针对早期新浪微博的版本,现在已经更新了不知道多少个版本了。那就算了吧,多看一点资料少看一点资料地球照样转,而且对Esri技术的关注最好的办法可能是直接关注官方博客,虽然英文稍微吃力了点,但绝对是物有所值的。


Mercator那些事儿

$
0
0

Mercator(1512~1594),生于Rupelmonde(现比利时某地,当时属于 Flanders——荷、法、比交界的地方),制图学家、哲学家及数学家。拟定了著名的Mercator投影(正轴等角切圆柱),推动了航海事业和Web地图产业(这个您老没想到吧~)发展;首次使用“Atlas”来表示地图集,并延续至今。今年恰逢Mercator诞辰500周年,Esri曾专门撰文纪念,在此也向Mercator表示敬意。

(比利时法郎中的Mercator头像,及Mercator投影和Atlas,via umich)

Mercator与航海

在Mercator投影发明之前,航海中使用的是最简单的plate carrée投影(现在天地图还在用),最早由Ptolemy发明,投影公式简单到不能再简单了:x=lon, y=lat。但这个投影既不等角也不等积,特别在高纬度地区,与实际相差很大,所以并不实用。Mercator于1569年发明了Mercator投影,通过对普通透视圆柱投影的改进,根据纬度越高的纬圈投影到圆柱上长度变化越大,因此考虑纬度变长时将对应的经线也拉长,从而保证两者之比恒定,即能等角。

在Mercator投影的海图中,恒向线(Rhumb line)是一条直线,这对航海来说有重要意义。沿恒向线航行不用改变航向就能到达目的地。比如你要从A航行到B,只需拿把尺子在Mercator海图上将AB连起来,计算AB与经线所成的角度,在航行中使用罗盘一直保持这个角度就能到达B了。但要注意,恒向线并不是球面上的最短距离。球面上两点间的最短距离是大圆航线(Great circle)。在实际航海中,考虑到航行的距离和驾驶的方便性,往往是两者结合起来使用。在近距离航海中,沿着恒向线朝一个方向航行就能到达目的地。远距离航行中,可以先绘制从出发到目的地的大圆航线,再将大圆航线分为几段,每段按恒向线航行,这就能兼顾了距离和方便性了。当然,实际中并没那么简单。也可以想这么个问题,你一直朝一个方向走(与经线成一个恒定的角度),最终不是走到北极就是南极,除非你沿着经纬网走,那能走回原地。所以,恒向线其实是一条螺旋线。

(大圆航线和恒向线在Mercator投影中的对比,via esri)

人类征服海洋的过程是十分坎坷的,Mercator投影的发明只是一部分。直到伟大的Harrison发明了海钟(1737),人类才能在航海时精确地计算经度,进而保证航行的安全。Harrison发明海钟又是一个百味杂陈的故事,有机会可以另说,或者阅读这本书

Mercator投影公式

虽然我没推导过,但不妨碍我们看看起投影公式的真面容:

(Mercator投影正解公式)

(以赤道、本初子午线为原点)

使用的参数不做过多解释,参看地图投影书籍。Mercator投影的最大优点就是正形(conformal),

(变形椭圆,via wikipedia)

但与之相伴的在高纬度地区极度的失真(面积、距离),最经典的是格陵兰岛和南美洲的大小差异,这个可以从投影公式中用到的正切函数看出。

(比例尺,via wikipedia)

Mercator并不很适合用来展现世界地图,特别是一些专题图的制作,面积与实际的差异实在是夸张,地图也会撒谎的。在教育小孩的时候,最好不要用Mercator投影地图,这可能会影响“世界观”的呀。

Web地图之空间参考

自从Google Maps(2005)出现以来,现今全球范围的Web地图,用的空间参考都是Web Mercator投影(3857)。Web Mercator与Mercator相似,可以看下其投影公式:

(Web Mercator投影正解公式)

与Mercator投影的主要差别在于纬度的计算上,Google工程师为了简便起见,没有使用椭球第一偏心率(e1),从而简化了投影公式。即将WGS84椭球在投影时看作了以其长半轴(6378137)为半径的正球体,而经纬度坐标还是参考WGS84的,这显然与GIS中的空间参考规范不符。众所周知,常用空间参考主要有投影坐标系(PCS)与地理坐标系(GCS)两大类,一个PCS建立在一个GCS之上,并要指定一个投影公式,这个投影公式是要以GCS为基准的,不然定义PCS基于GCS就没有意义了。但Google没有这么做,这就搞乱了空间参考的标准体系,不过这样我们可以从两个角度来理解Web Mercator:

(1)GIS角度。如前所述,Web Mercator采用了两个椭球,WGS84椭球和以WGS84长半轴为半径的正球。GCS用的是WGS84,而GCS投影到PCS时,使用的是正球,虽然地理坐标是参考WGS84的,这点最关键!

(2)非GIS角度。从数学上看,投影无非是一个函数。Mercator投影利用了WGS84椭球的所有参数(a、b、e1、e2),而Web Mercator只不过使用了部分参数罢了(a)。这么理解,就能忽略椭球与正球的差异了,那Web Mercator就是Google参考Mercator投影发明的一种新投影。

值得注意的是,Web Mercator投影不是等角的,只是近似等角(near-conformality),Mercator投影是等角的。虽然我不能证明,但我可以理解。从投影公式去看,或者想象一下投影时椭球和正球的区别,显然是能直观地想明白的。

Google的Hack行为一来推动了Web地图的发展,并形成了一套标准,二来也搅乱了GIS界。EPSG开始并不认可这种投影,至少是不推荐,并不给其编号。但是坊间已经应用广泛,并编之为900913,意指google。后来900913俨然成为了业界标准,EPSG数据库中也就出现了3785这个投影,但没过多久又换成了3857(3785与3857之间的差异后面再说)。Esri方面,Esri的Web地图开始用的都是4326,到09年末才转换为3857,并逐步停用了原先的4326。选择3857自然有许多好处,比如这是业界标准,这样大家都能互相mashup,一起建设和谐社会。4326的瓦片大小是512×512,3857是256×256,瓦片变小既能减少单张瓦片的网络流量,又能缩小瓦片数目的规模,而且在一张256×256的瓦片正好能做一张世界地图。

Web Mercator与Web Mercator(Auxiliary Sphere)之异同

ArcGIS中的Web Mercator就是3785,Web Mercator(Auxiliary Sphere)就是3857。如果你有一份与Google Maps使用相同投影的数据A,但失去了投影信息,那么你在ArcGIS中使用任何一个去定义(define)你的空间参考都是正确的。但是,假如你再将一份WGS84(4326)定义的GCS数据B与A去叠加,那么B与A3857可以直接叠加,而B与A3785就不能了,至少不能on the fly。为什么呢?这个通过看一下投影文件,结合前述的Web Mercator投影介绍,再自己实践一下就能明白。

(3785投影文件)

(3857投影文件)

两个比较明显的区别:

(1)3785用的是正球体,3857用的是椭球体。

(2)3857的投影参数里面多了“Auxiliary_Sphere_Type: 0.0”。

也就是说3785是以正球体上为基准的,但其GCS还是参考WGS84;3857是以椭球体为基准的,但投影时参考正球体,“Auxiliary_Sphere_Type: 0.0”的作用就在这里吧。

那么,我现在有一份4326的数据,分别要投影到3785和3875上,该怎么做呢?

对于3857,因为3857本身基于4326的,所以可以直接project。但是对于3785,就稍微麻烦点了,如果你直接project,那arcgis会提示你进行椭球转换,结果显然会与你预期的不一致。所以你得先重新给这份4326的数据定义一个新的空间参考,定义一个空间参考并不改变其数据,而椭球转换显然是会改变数据的。根据3785所使用的椭球,为4326定义一个新的GCS(104199),就是6378137为半径的正球体,然后再project到3785。这样得到的数据会跟4326直接project到3857一致,但空间参考是不一致的,一个是3857,一个是3785。如果有兴趣可以自己尝试,我附了数据在后面。

显而易见,3857比3785更合适一些,至少Datum是正常的。GIS的一大特征就是能叠加多源数据,3785这样的投影在叠加数据就很尴尬了,这也是Esri最终使用3857的原因。Esri Dev Summit的视频中也表示,3875和3785在数学上是一致的,如果要考虑叠加数据,建议使用3857。其实我觉得3785现在基本上没什么用了,只是Esri自己凌乱状态下定义的一个过渡空间参考:P

回过头看,Google 工程师的一次偷懒行为,破坏了GIS界的规范,还最终逆袭成为了事实上的标准,让人唏嘘不已。如果Google使用的是正常的Mercator投影,同样也可以在一张256×256的瓦片中容纳世界地图,只不过南北的跨度略有差异,这样既能保证真正的等角,又符合GIS规范,也不会给我们带来这么困扰。同样,如果Esri或者EPSG能更有话语权,那或许也不会有Web Mercator的存在了。只能说IT和GIS相遇,失意的总是GIS,至少目前是这样的。

———

空间参考本身比较复杂,所以文中难免有所疏漏和错误,请批评、指正。另外,现今GIS中的地图学课程越来越式微,地图投影等学习也十分薄弱。个人觉得,GIS的教育是很失败的,但是教育失败并不是我们止步的借口,而是我们更应发奋的缘由之一。

附:文中所提及的相关资料,包括数据、代码及投影文件等

坐标转换那些事儿

$
0
0

在GIS中,最基础(basic)、最关键(essential)的部分应该就是坐标系(coordinate)了,或者说空间参考(spatial reference)。只有明确了空间参考,才能正确地确定地物的空间位置、度量地物之间的空间关系,以及发挥GIS融合多源数据的功能,等等。显然,空间参考是GIS的一个根本问题。

在实际工作中,当你准备用GIS来完成一项任务时,如果你手头上数据的空间参考是正确一致的,至少基准面(datum)是正确并一致的。那么恭喜你,你基本上可以跳过坐标转换这一道坎了,可以直接使用GIS软件进行数据处理与分析了。如果空间参考是不一致的,甚至是没有空间参考的数据,那该怎么办呢?显然是要定义一个空间参考,甚至还要进行坐标转换,在一致的坐标系下才能进行后续的工作。还有,矢量、栅格数据在进行坐标转换时的原理与操作又是一致的吗?

前面废话了比较多,其实我就是想谈一谈坐标转换的问题。很基础,也不会完全正确,但应该有点用处。

矢量数据坐标转换

先来看一张矢量数据坐标转换的流程图:

(矢量数据坐标转换流程图 v0.1)

这个是我自己定义的,有点诚惶诚恐。如果接触过坐标转换,或者对GIS中的空间参考概念了解的话,我想这张图应该表达的比较清楚了。当然还有几点需要特别说明下:

(1)空间参考“已有”、“已知”的区别。“已有”说明数据是有坐标文件的,比如Shapefile数据有prj文件,而且“已有”当然“已知”了。但是“已知”并不一定“已有”,比如一份Shapefile数据知道是WGS84空间参考,但是没有prj文件,这样的情况需要重新给数据定义(define)空间参考。

(2)PCS与GCS,PCS是Projected Coordinate System的缩写,GCS是Geographic Coordinate System的缩写。PCS定义在一个GCS之上(Web Mercator比较特别,可以参考这里),GCS定义在一个Datum(大地基准面)之上,Datum又是Ellipsoid(地球椭球体)经过椭球定位、定向之后的产物,Ellipsoid就是通过长短半轴去描绘地球形态的光滑椭球体了。

(3)“N参数拟合”的说明。当有一份数据并不知道其空间参考时,这时就需要根据坐标数据的大小、范围等因素去推测原始坐标系,找到准确的同名控制点,再根据经验选择一个合适的物理模型,例如:仿射变换六参数,N阶多项式变换。之后进行模型参数求解,最后就是计算坐标了。特别是小范围城市级别的坐标转换,一般使用仿射变换就能满足普通需求了。这整个流程,我概括为“N参数拟合”。另外,这有点类似于ArcGIS中Spatial Adjustment工具条做的事情。

(4)“基准面不一致”的说明。当基准面不一致时,才要真正考虑到坐标转换(convertion),因为在基准面一致时,任何PCS1到PCS2都是有解析式的,坐标系之间只存在变换(transformation)的关系。基准面不一致时,一般通N个参数来确定两个基准面之间的关系,这也就是转换的物理模型。比如三参数转换、Molodenski转换、Helmert转换以及Molodenski-Badekas转换等等。这些转换大多是基于地心空间直角坐标的,也就是XYZ。

戴勤奋老师翻译了Coordinate Conversions and Transformations including Formulas中的“Formulas for Coordinate Operations other than Map Projections”章节,中文名为“坐标系转换公式”,里面介绍了许多坐标转换模型的方方面面,是很好的学习资料。

另外还参考了《现有测绘成果转换到2000国家大地坐标系技术指南》、杨启和教授的《地图投影变换原理与方法》以及别的各种小论文。

顺带说点八卦:

杨启和教授是吴忠性教授的学生,吴忠性教授是王家耀院士、高俊院士、孟立秋以及祝国瑞等等知名教授的导师,也是吴邦国委员长的父亲。吴忠性教授被称为“测绘将军”,应该是现代中国地图学界的宗师级人物之一了。

杨启和教授的这本书曾被John SnyderWaldo Tobler翻译为Map Projection Transformation: Principles and Applications,至今在Amazon上还有销售,胡毓钜教授曾专门撰文谈到过这部书的出版意义。值得强调一下的是,John Snyder生前是USGS的首席地图投影专家,他将在USGS的工作成果整理为了一本书,Map Projections: A Working Manual,另外他也是Space oblique Mercator投影的发明者。Waldo Tobler就更不用多解释了,地理学第一定律的提出者,UCSB的教授。

栅格数据坐标转换

栅格数据与矢量数据的定义不同,空间参考定义也是不同的,因而坐标转换当然也不会相同了。一般来说,栅格数据的坐标转换往往是一步到位。对小范围的数据,选好控制点和坐标转换模型,直接拟合;大范围数据,先分成几块,分别拟合,最后合并。这样做的原因,个人认为可能是栅格数据坐标转换涉及重采样的问题,重采样本身就有误差,若是像矢量数据一样有按严格的空间参考定义去进行一步步转换,那期间要涉及多次重采样,最终的结果可能会面目全非。另外,还可以参考ArcGIS中的Georefrencing工具的原理和使用。

仿射变换

在所有坐标转换模型中,仿射变换是最简单,也是最常用的。

所以,使用仿射变换,只需使用3对同名控制点,解出A~B六个参数,即能得到坐标转换公式(模型)。如果超过3对控制点,就要通过最小二乘来解算,这些使用Matlab来计算还是很方便的。

仿射变换的原理,通过几何关系可以很清楚的看出:

(仿射变换几何原理,via 戴勤奋)

由上图可知公式:

杭州公交数据转换

今年4月份的时候,调用过杭州公交数据。但当时因为一些别的原因,没有用心去做,也就没有对数据进行纠偏了。

从文献来看,杭州本地基准是在北京54的基础上经过偏移的,平面坐标当然是高斯克吕格投影。而Web上的地图服务一般都是Web Mercator投影(天地图除外),基准是WGS84。

我要做即是将hzbus.cn上数据转换到arcgisonline.cn上。转换模型选择仿射变换,如果效果不好,可以再换。以地理坐标(经纬度)数据为基础,因为原始数据就是经纬度的,而且WGS84与Web Mercator的正反算也很容易。

这样,我只需要找出3对同名控制点就可以计算了。因为原始数据是公交车站的点位坐标,而这个车站的位置与实际中的位置并不一致(地图做得太烂),而且目标地图上并没有公交车站的点位标识。因而,只能使用靠近道路交叉口的公交车站,再去目标地图上找相同的交叉口,最后确定附近大概是公交车站的位置。这样来选择控制点,确实有些不友好,但也没办法呀。

找到同名控制点的坐标,通过Matlab解算参数,最后计算坐标。最终结果可以接受,至少车站都分布在道路两侧。考虑到原始数据的质量,这样的结果已经挺不容易啦。

(hzbus上的公交车站位置)

(arcgisonline上的公交车站位置)

 

学了这么久的GIS,坐标系也是一开始就开始接触的。简单来说,“坐标虐我千百遍,我待坐标如初恋”。

相关日志

数据分类那些事儿

$
0
0

数据分类、地图分级(Classification)通常用于Choropleth Map(面量图)的制作中,是专题制图中最初,也是最基本的一个步骤。没有进行过分类的地图,很难让人理解其表意。比如,以中共十八大的各省代表人数为例。假若为每一个省(港澳台除外)单独设色,会是这样的效果(注:每张地图点击都可以看大图的,不再说明):

(图1 单一设色分类)

这样的地图让人不明其意,不知道各个省的代表人数到底几何。因为人眼分辨差异(类别数)的能力是有限的(多于7个类别就有点难了吧)。倘若为之分类,就可以极大地简化数据,显现出数据的空间分布特征、模式,更便于人们使用和分析。

所谓数据分类,就是将数据按照大小排列,并以一定的方法(主观、客观的或统计的,等等),将某一部分归为一类,这样每一个数据都有自己的类别,且仅属于一类。数据分类看似是一个很简单的东西,一般我们做图时选择往往随便选个分类,可能连分类方法都不去看,再找个顺眼的颜色,也不知道这些颜色因何而配的(我也不知道),确定显示觉得ok就行了,不ok就再改改,直到满足你的审美为止。最终可能看上去漂亮,但也就只剩看上去还行了,而缺乏基本的分类依据。比如,各个分类方法的原理是什么?什么分类方法适用于什么数据?ArcGIS为什么选择了Natural Breaks作为默认分类法?这些都是简单的操作背后值得思考的问题。

数据说明

本文将以刚刚胜利结束的中共十八大中各省参会代表人数为数据源,讨论数据分类的问题。本届会议各省代表共计1556人,以下是分布直方图:

(图2 数据分布直方图)

为什么用这个数据?一直觉得,不管是学习还是工作,使用的数据一定要真实,最好还有时效性。真实是一个首要条件。学习中,如果数据真实,才会让自己产生更多的兴趣,有折腾的动力;工作中,只有数据真实,你的工作才有点用处,不然再怎么努力也是自欺欺人。另外,全国各省的矢量数据还是比较容易获得的,这样关联起来就成了本文所用的数据了。至于数据分布是否合适,这就是天命了,该怎么样就怎么样。

常用的分类方法

以ArcGIS提供的六种分类方法为例:Defined Interval、Equal Interval、Quantile、Standard Deviation、Natural Breaks(Jenks)、Geometry Interval(Geometry Interval是Esri自己开发的一种分类法,资料太少,这个就先不讨论),介绍下各种方法的原理、实现以及用途,以前文数据为例。

Defined Interval

定义间隔分类。定义一个间隔,比如0~100的数据,定义10为间隔,那么10,20…就是断点,分类数由间隔大小决定。

(图3 Defined Interval分类图,Interval=15)

用Defined Interval分类,提供的信息不多,只能看出不同的省份落在了不同的区间而已,而这个区间的大小没有太大的实际意义。

Equal Interval

等距分类。定义一个分类数,比如0~100的数据,分为4类,那么间隔就是25。间隔定了,那就和定义间隔分类的原理一致了。

等距分类和上面的定义间隔分类原理简单,易于计算。比较适合用在温度、成绩和百分比等范围、间隔都为人熟知的数据。但是这两种分类法可能会有“空类”(定义间隔也是的),比如0~100的数据,大部分都在0~50中,剩下的几个在90~100。如果你再按10为间隔去分类,那将会有4个空类!

(图4 Equal Interval分类图)

同样,Equal Interval分类提供的信息也不多。

Quantile

等量分类。又叫分位数分类,每一类的数目一样,这样就不会出现空类了。等量分类适合用于线性分布的数据,比如排名数据。但它不考虑数值大小,很可能将两个大小相近的值分到不同的类别中,也可能数据一样的数据,却分在不同的类中。

(图5 Quantile分类图)

Quantile分类,每一类中的数目是相同的,也就是每一种颜色的省份个数一样,但它忽视了省份之间人数的差异。

Standard Deviation

标准差分类。显然适合正态分布的数据,用于表现与均值相异的程度。但涉及一点点统计知识,普通用户可能不好理解。

(图6 Standard Deviation分类,Interval=1std)

Standard Deviation分类可以看出黄色的省份人数适中(均值),而绿色就偏少了,红色最多。另外,这种分类法的图例与一般的不一样,原因是显而易见的。

Natural Breaks(Jenks)

自然断点分类。一般来说,分类的原则就是差不多的放在一起,分成若干类。统计上可以用方差来衡量,通过计算每类的方差,再计算这些方差之和,用方差和的大小来比较分类的好坏。因而需要计算各种分类的方差和,其值最小的就是最优的分类结果(但并不唯一)。这也是自然断点分类法的原理。另外,当你去看数据的分布时,可以比较明显的发现断裂之处(可以参看前文直方图),这些断裂之处和Natural Breaks方法算出来也是一致的。因而这种分类法很“自然”。

那Jenks又是谁?简单介绍下:

George F. Jenks (1916-1996),美国制图学家,生于纽约。41年本科毕业后加入陆军航空队,退伍后进入雪城大学深造,在Richard Harrison指导下学习制图。49年博士毕业后获堪萨斯大学教职,设计并执教制图学课程至退休。Jenks发明的Natural Breaks分类法是最常用的数据分类法,也是ArcGIS中的默认分类法。

Natural Breaks算法又有两种:

(1)Jenks-Caspall algorithm(1971),是Jenks和Caspall发明的算法。原理就如前所述,实现的时候要将每种分类情况都计算一遍,找到方差和最小的那一种,计算量极大。n个数分成k类,就要从n-1个数中找k-1个组合,这个数目是很惊人的。数据量较大时,如果分类又多,以当时的计算机水平根本不能穷举各种可能性。所以当时计算的得到的自然断点是看“运气”的!当然也有一些经验得来的评价指标。

(2)Fisher-Jenks algorithm(1977),Fisher(1958)发明了一种算法提高计算效率,不需要进行穷举(暂时还没看明白,文献也很少。等我弄明白了,再另写吧)。Jenks将这种方法引入到数据分类中。但后来者几乎只知道Jenks而不知Fisher了,难道是学地理的数学都太差的缘故: P。ArcGIS也是以这个算法为基础改进的,就是说还要更快!开源软件中也有些实现了,后面再说。

(图7 Natural Breaks分类图)

Natural Breaks分类可以很好地“物以类聚”,类别之间的差异明显,而类内部的差异是很小的,每一类之间都有一个明显的断裂之处。

比较与总结

从直观上看,这份数据用Standard Deviation和Natural Breaks分类的效果较好,它们两个都考虑了数据分布的统计特征。而Equal(Defined) Interval和Quantile,仅仅是两种相对主观的分类法,不管是类间的距离还是类的数目,在这里都没有明确的标准。不像温度这样的数据,长久以来大家都有默认的区间,比如以10度为区间。

这个比较还说明了一点,即相同的数据,用不同分类方法,所表现的效果是截然不同的,特别是偏度很大或很小的数据。idvsolutions曾撰文讨论过,可参考。

另外,如果要表示时序数据的时候,分类一定要确定,不能因为不同时刻不同数据有不同的分类。比如地图汇的这个气温变化例子,做得很好。不过有个小问题,就是图例的区间都是闭合且连续的。即上一个区间的终点和下一个区间的起点相同,那这个间断点到底应该属于哪一类呢?貌似地图汇暂时都是这样的处理。

分类的评价指标

GVF,The Goodness of Variance Fit,暂且叫“方差拟合优度”吧,公式如下:

(公式1 GVF)

其中,SDAM是the Sum of squared Deviations from the Array Mean,即原始数据的方差;SDCM是the Sum of squared Deviations about Class Mean,即每一类方差的和。显然,SDAM是一个常数,而SDCM与分类数k有关。

一定范围内,GVF越大,分类效果越好。SDCM越小,GVF越大,越接近于1。而SDCM随k的增大而大,当k等于n时,SDMC=0,GVF=1。也就是说k越大,GVF越大。但这显然不是说k越大分类效果越好,就如前文提到过的,人的眼睛能识别的类别是有限的,而且也见过了单一设色的效果,很糟糕。

那这个GVF怎么用,又有什么用呢?主要有两种用途:

(1)类数相同,比较方法的优劣

GVF可以用来比较不同的方法,在相同类数情况下,分类效果的优劣。比如,上述几个分类的GVF:

分类方法GVF
Defined Interval0.7203
Equal Interval0.7128
Quantile0.7271
Natural Breaks0.8524
Standard Deviation0.8137

(表1 GVF大小比较图;注:Standard Deviation类数肯定是奇数的,区间为1std时是5;其余分类数均为4)

可见,Natural Breaks明显优于别的分类法,而且任何数据都是这个结果,因为GVF中的SDCM就是Natural Breaks中类方差和嘛。既然Natural Breaks计算出的方差和(SDCM)是最小的,那GVF显然是最大的了。从这个角度来说,Natural Breaks是最优的分类法,ArcGIS将其作为默认分类法也是因为这个原因,有些地方将也称Natural Breaks为Optimal,都显示出了该方法的优越性。

(2)方法相同,比较类数的优劣

GVF还能用于比较一个方法,不同分类数的分类效果好坏。以k和GVF做图可得:

(图8 GVF变化图)

随着k的增大,GVF曲线变得越来越平缓。特别是在红线处(k=5),曲线变得基本平坦(之前起伏较大,之后起伏较小),k(5)也不是很大,所以可以分为5类。一般来说,GVF>0.7就可以接受了,当然越高越好,但一定要考虑k不能太大。显然,这是一个经验公式,但总比没有好吧。

不分类可以吗?

数据分类的缘起就是因为早年的制图技术不能实现唯一值设色,客观技术的制约导致了数据分类的需求。现在的技术已经完全可以实现,因而有人对数据分类的必要性提出过质疑。但我想数据分类还是必须的,原因前文已述。但如果真的不分类,如何才能更好地表达专题信息?

Prism Map(棱柱图),可以满足这一的需求:

(图9 单一棱柱图)

如果再加上自然断点分类,效果就更好了:

(图10 分类棱柱图)

但这不是专题制图的常规手段,比如ArcScene中不能加图例吧。Jenks说可以以Prism Map为标准来评价各种分类的效果,还提出了tabular error、overview error和boundary error三种指标。有兴趣的去翻论文吧: P

由此,可以想到地图投影的各种方法。没有一种投影是完美的,一种投影只能保持一种性质不变。反观数据分类,同样也没有一种分类是完美的,也需要根据不同的需求去选择。空间参考未来或许会归结为没有投影,仅存地理坐标系,所有的显示、分析都基于球面坐标。类似,数据可能也会不需要分类。

更高级的分类法

上述的各种分类法顶多考虑了数据在数轴上的分布,通过统计特征进行分类。而GIS中的数据都是具有空间位置的,如果将空间位置等考虑进去,那分类方法还有很多值得研究的地方。比如空间位置相邻,数值大小也相近,但自然断点分类后却在两个不同的类别中的两个要素,是不是可以考虑分为一类内?类似的分类法(考虑多指标)已经有人研究,目前还没有流行开来,但可以期待是GIS软件中会出现更多的分类方法。

GIS软件中的实现

总结一下各GIS软件中对分类法的实现也是蛮有意思的(以ArcGIS分类法为参考):

ArcGISSuperMapMapGISQGISuDig
Defined IntervalOOXXX
Equal IntervalOOOOO
QuantileOOXOO
Standard DeviationOOXOX
Natural BreaksOXXOX
其他Geometry
Interval
对数分段、开方分段默认提供等距分段Pretty BreaksUnique Values

(表2 GIS软件分类法比较)

其中,各测试软件版本号为:ArcGIS 10.1、SuperMap Deskpro 6、MapGIS K9、QGIS 1.8、uDig 1.3.2。

各个厂商对分类的理解不一致的,ArcGIS 不再介绍;超图没有自然断点,另外提供了对数、开方分段;MapGIS默认给数据做等距分段,没有方法选择,只能手动修改;QGIS不提供Defined Interval,矢量支持Natural Breaks,还提供Pretty Breaks(貌似在R中见过);uDig没有Defined Interval、Quantile以及Natural Breaks,但提供Unique Values(可这不就是不分类吗,这也算一种分类法Orz)。

参考

主要参考了Thematic Cartography and GeovisualizationCartography: Thematic Map Design,以及若干文献,就不逐一列出了。

代码

我用C#实现了上述提到的分类法,其中Natural Breaks比较“暴力”(穷举),没有用到Fisher的算法,只能有时间再研究了。

这是测试数据。

相关日志

有史以来最牛逼的制图学家

$
0
0

Esri Mapping Center有一个栏目叫做Featured Cartographer,会随机播放一些制图学家的卡通肖像(我是看肖像去的。。)和生平,现在有17位。我把内容抓下来看了看,认识的几位和先前所知的基本相符,不认识的几位通过这个栏目也大致了解了。我觉得称他们为“有史以来最牛逼的制图学家”再恰当不过了!

我按时间顺序(出生日期)重新组织了一下,贴在下边。原先想翻译一下,但发现其实没必要,熟悉的地方一看就懂,生疏的内容还得查资料,就偷下懒吧。当然,如果哪位同学有时间,可以做一下这个事情,为中文GIS圈子贡献一点力量哈。

我先介绍一点我自己的认识,不深入,特别是对刚认识的那几位:

1.Anaximander,第一个绘制世界地图的人,祖师爷!维基中他的介绍比较全面,也有他画的地图。

2.Eratosthenes,Geography说法的提出者,最早计算了地球直径。

3.Ptolemy,写过三本很牛逼的书:《天文学大全》、《地理学指南》和《占星四书》,地心说就是他提出的。

4.Gemma-Frisius,他首次提出了三角测量、时差测经度等概念,他还是Mercator的老师!

5.Gerardus Mercator,Mercator应该人尽皆知了,Mercator投影和Atlas(地图集)是他的代表作,今年也是他诞辰500周年。Mercator投影我还研究过一点

6.Abraham_Ortelius,贵族出身,Mercator的好基友。第一部真正意义上的地图集是他出版的,叫Theatrum Orbis Terrarum,世界概貌。

7.8.9.11.12.Cassini Family,祖孙四代都是天文学家!Cassini V因为一些原因没有走家族路线,成为了一名植物学家(为什么他也算Featured Cartographer?)。他们家主要成就在天文和测绘上,比如测绘法国地图。

10.Johann Heinrich Lambert,Lambert发明了若干投影,比如:Lambert conformal conicTransverse MercatorLambert azimuthal equal area,Lambert也是第一个证明pi是无理数的!

13.Eduard Imhof,发明了晕渲图(relief shading、hillshade)。

14.Arthur H. RobinsonRobinson投影的发明者,这种投影广泛用于世界地图中。

15.Jacques Bertin,信息可视化(Information Visualization)理论奠基人!

16.George F. JenksNatural Breaks数据分类发明人,ArcGIS的默认分类法。二战后美国制图课程的设计人,堪萨斯大学教授,桃李满天下。

17.John Snyder,可能是当代最著名的地图投影学家了,发明了Space Oblique Mercator投影。他还是杨启和教授《地图投影变换原理与方法》的英文版译者,我在坐标转换一文中有所介绍。

从历史来看,早期的制图学在古希腊,一直延续到文艺复兴和地理大发现时代,期间,以Mercator以及Cassini家族位中心的欧洲开始繁荣,现代当然主要是美国人的天下了。一般来说,科学技术的发展大抵都这样吧,cartography当然不能免俗了~

以下来自Mapping Center:

1.Anaximander

(c.610 BC-c.546 BC) Anaximander is said to have made the first map of the world. It was circular in form and was centered on the Aegean Sea (the Mediterranean Sea between the mainland of Greece and Turkey), and the ocean was shown along the outer edge of the circle. The northern half was called “Europe” and the southern half was “Asia”.  Two small strips of land to the north and south of the Mediterranean Sea  represented the habitable world. The lands to the north of the habitable world were the cold countries where mythical people lived and the lands south were considered the hot countries where the burnt people lived.

Anaximander was a Greek philosopher who lived in Miletus where he belonged to the Milesian school. After studying under his master Thales, he succeeded him as the second master of the school – Pythagoras was one of his pupils. Because of Anaximander’s belief that physical rather than supernatural forces order the universe, he is considered by some to be the first true scientist. He is known to have conducted the earliest recorded scientific experiment, and he is the first philosopher known to have written down his studies. Like many thinkers of his time, he contributed to many disciplines, including to philosophy, astronomy, physics, geometry, politics, and, of course, geography.

2.Eratosthenes

(276 BC-194 BC) was a Greek mathematician, poet, athlete, geographer and astronomer. Around 250 BC, while head of the Alexandria Library and Museum, he made the first scientifically-based estimate of the earth’s circumference. Eratosthenes heard of a deep well at Syene, about 500 miles south of Alexandria, Egypt. The bottom of the well was illuminated by the sun only on the summer solstice (June 21), so he concluded that the sun must be directly overhead on that day. If the sun’s rays were parallel and the earth was spherical, the angle of the shadow cast from a vertical column in Alexandria on the same day could be used to calculate earth’s circumference, if the north-south distance to Syene were known. On the next summer solstice Eratosthenes found the shadow angle from an obelisk in Alexandria to be 7°12′ (1/50th of a circle), so he concluded that the distance between Alexandria and Syene is 1/50th of the earth’s circumference. He was told that Syene was about 5,000 stadia (200 to 210 modern yards) south of Alexandria, so he computed the earth’s circum- ference as 50×5,000 stadia, or 28,400 to 29,800 modern miles, just a little greater than the current value of 24,874 statute miles.

3.Claudius Ptolemaeus (Ptolemy)

(c. 85-c. 165) Claudius Ptolemaeus (known in English as “Ptolemy”) “Geographia” recorded classical Greek geographic knowledge in the second century A.D. and was the chief source for cartographic publications in the early Renaissance era. It remained the cartographic convention until; Ortelius’s “Theatrum” was published in the 1500′s. Ptolemy’s compiled what was known about the world’s geography in the Roman Empire during his time into “Geographia”. He relied a bit on the work of an earlier geographer, Marinos of Tyre, and on gazetteers of the Roman and ancient Persian Empire, but most of his sources beyond the perimeter of the Empire were unreliable.

Ptolemy was the also the author of other scientific treatises; “Geographia” is one of three that were of continuing importance to later Islamic and European science. The first was an astronomical treatise now known as “The Great Treatise”, originally “Mathematical Treatise”). The second was “Geographia”. The third was an astrological treatise known as the “Four Books” in which he attempted to adapt horoscopic astrology to the Aristotelian natural philosophy of his day.

“Ptolemaeus” is a Greek name. Beyond his being considered a member of Alexandria’s Greek society, few details of Ptolemy’s life are known.

4.Gemma-Frisius

(1508-1555) born Regnier Gemma, he was a native of Friesland (a coastal province in northern Netherlands). He adopted a Latin version of his name (Frisius) when he became a scholar. A Dutch mathematician, astronomer, and geographer, he is perhaps best known for his theoretical description of how to calculate longitude using portable clocks long before it was actually possible to do so.

He described this theory in a second edition of the book “De Principiis Astronomiae Cosmographicae” which appeared in 1533 along with a combined terrestrial and celestial globe that Gemma Frisius produced. With “Cosmographia”, he included Libellus de locurum which described the theory of trigonometric surveying and the first proposal to use triangulation as a method of accurately locating places.

He also added notes about finding longitude at sea. This was the first time anyone had proposed a solution to the problem although there were many others proposed in the 250 years following Gemma Frisius’s work. Ultimately the methods he outlined became the adopted solution to finding the longitude at sea.

From 1534 Gemma Frisius began to teach his student Gerardus Mercator. They constructed a terrestrial globe in 1536, and they constructed a celestial globe in the following year.

5.Gerardus Mercator

(1512-1594) Mercator was a Flemish map maker and geographer.  In 1569, he created the Mercator projection which is widely used for navigation because straight lines drawn on maps that use this cylindrical projection are lines of constant compass bearing (rhumb lines).  Mercator mastered the essentials of mathematics, geography, and astronomy and primarily supported himself through his craftsmanship of mathematical instruments. With Gemma Frisius, another producer of globes and mathematical instruments, and Gaspar à Myrica, an engraver and goldsmith, he made Louvain, Belgium an important center for the construction of globes, maps, and astronomical instruments.

Mercator began making maps independently in 1537.  He encouraged Abraham Ortelius to compile the first modern world atlas, “Theatrum Orbis Terrarum” (1570). Mercator’s first atlas, published in 1578, contained corrected versions of maps originally drawn by Ptolemy. The atlas he published in 1585 included maps of France, Germany and the Netherlands, and in 1588 he published an atlas with the Balkans and Greece. After his death, Mercator’s son, Rumold, added additional maps in a final part published in 1595.

6.Abraham Ortelius

(1527-1598) was a Flemish scholar and geographer. While not a scientific innovator, Abraham Ortelius is regarded as one of the most prominent geographers of the sixteenth century because of his ability to gather an immense body of existing geographic knowledge and publish it in a consistent and high-quality cartographic format. Ortelius’s “Theatrum Orbis Terrarum” (Theatre of the World) is considered the first true atlas in the modern sense: a collection of uniform map sheets and supporting text bound in book form. The maps were organized logically to represent continents, groups of regions, and nation-states, with the text providing relevant information and further references. Many of the atlas’s maps were based upon sources that no longer exist or are extremely rare. Therefore, Ortelius atlas is sometimes referred to as the summary of sixteenth-century cartography.

Ortelius’s atlas contained a “Catalogus Auctorum” – a separate section in the atlas-identifies the names of all thirty-three cartographers whose maps Ortelius consulted, as well as eighty-seven geographers known to him. The “Catalogus” was thus the first critical attempt to provide readers with a historical context for published maps.

The Theatrum was the most authoritative and successful such work during the late sixteenth and early seventeenth centuries. The atlas first appeared in 1570 and continued to be published until 1612. During this period, over seventy-three hundred copies were printed in thirty-one editions and seven different languages-a remarkable figure for the time.

Earlier mapbooks (after ca. 1400) had been based on the work of Claudius Ptolemy, whose Geographia recorded classical Greek geographic knowledge in the second century A.D. and was the chief source for cartographic publications in the early Renaissance era. Ortelius’s Theatrum definitively freed cartography from the influence of Ptolemy although convention still demanded that the new form of map presentation and illustration pay homage to the classical writers.

Before the publication of the Theatrum, Ortelius was a respected student of classical history and a collector of books and old coins but had found only modest acclaim for his cartographic skills. Yet, he had made a living as a professional illuminator after 1554, illustrating hundreds of maps, and making at least six single- and multi-sheet maps of his own between 1564 and 1570. Still, it was the Theatrum that firmly established his reputation as a cartographer and made him a wealthy man.

7.Giovanni Domenico Cassini (Cassini I)

(1625-1712) The name Cassini relates not to one person only but to a whole family that contributed significantly to cartography.  The Cassini (and Maraldi) families are said to have been the creators of the first “accurate” national topographic map. It took four generations. Giovanni Domenico Cassini (Cassini I) became Director of l’Observatoire de Paris in 1669, and it was under his leadership that the use of triangulation was introduced in the construction of a map of Paris and surrounding areas.

8.Jacques Cassini (Cassini II)


(1677-1756) Jacques Cassini (Cassini II) assisted his father in his work, including carrying out a number of geodesic observations. Jacques’ main scientific failing can be traced to work he carried out with his father in 1700. Their project to measure the meridian from Perpignan to Paris resulted in Jean Dominique’s stating that the Earth was elongated at the poles. Later, in 1713, and using a different method of measurement based on the moon’s eclipses of stars and planets but with the data of the 1700 experiments, Jacques confirmed his father’s theory.

9.César François Cassini (Cassini III)

(1714-1784) While Jacques Cassini (Cassini II) believed that the Earth was elongated along its axis, his son César François (Cassini III) sided with the Newtonian view that it was flattened at its poles. So, the early eighteenth century saw Jacques Cassini and his son beginning the process of developing the principles of triangulation and accuracy in order to produce more accurate mapping, specifically of France. The triangulation begun in 1740 was developed by César François as he sought to produce the first accurate map of the whole of France.

Their map, produced in 1746 and 1747, was much more accurate than any that had preceded it. It covered eighteen sheets at a scale of 1:86,400. One of their findings was that France was approximately ten per cent larger than had previously been thought. Just as important, the Cassinis accurately located the geographical relationship between the observatories in Paris, France and Greenwich, England, establishing the basis for greater accuracy in making astronomical observations.

10.Johann Heinrich Lambert

(1728-1777), was a Swiss mathematician, physicist and astronomer. Although Lambert is credited with the first proof (in 1761) that pi is irrational, his contributions to cartography lie primarily in the map projections he created. In 1772, he published equations for the Lambert azimuthal equal area projection. This planar equal area projection is in commercial atlases and for statistical maps of continents and countries that are basically circular in overall extent. You will also see the oceans shown on maps that use the equatorial or oblique aspects of this projection.

Also in 1772, Lambert constructed the transverse Mercator projection as well as the Lambert cylindrical equal-area projection. Lambert’s idea for the transverse Mercator projection was to rotate the Mercator projection by 90 degrees so that narrow north-south strips of the earth can be projected with no local shape distortion and little distortion of area. This projection is used to map gores which are used in the construction of globes.

In 1772, he also devised the Lambert conformal conic projection which is used as the basis for east-west trending U.S. State Plane Coordinate system zones. These projections are in turn used for the 1:24,000 USGS scale topographic maps within the state. Another major use of the Lambert conformal conic projection is for aeronautical charts, because navigators (like aviators) prefer navigational charts that use conformal projections, which preserve shapes and directions locally.

11.Jean Dominique Cassini (Cassini IV)

(1748-1845) In 1783, Jean Dominique Cassini (Cassini IV) became Director of the Paris Observatory. He proposed that the differences in measurement of longitude between the Paris and Greenwich observatories should be resolved by triangulating the south-east of England and extending the measurements to France. As a result, cross-channel measurements were taken linking France and England at the same time that triangulation survey work continued in England, forming the basis of the Ordnance Survey.

In July 1789, revolution swept France and a mob took over the Bastille in Paris, searching for weapons and munitions, and two days, another ransacked the Observatory looking for supplies. Jean Dominique’s wife died in April 1791, leaving him to look after their five children. At that time the Adadémie des Sciences was establishing a project to measure the meridian from Dunkerque to Barcelona in order to establish an accurate measurement for the meter to be defined as one ten-millionth of the distance from the North Pole to the equator. The Académie des Sciences required Jean Dominique to lead the surveying as was the tradition in this type of work but, with the pressure of having to look after his children, he asked to direct the work from Paris. His request was denied and the Académie appointed Delambre in his stead. At the Observatoire Jean Dominique was having significant problems with his three assistants with whom he had a falling out.

Additionally, the National Assembly created four posts of Professor, one of them being Jean Dominique appointed at half his previous salary with the intent that he should rotate into the appointed post of Director. The Académie des Sciences was disbanded in August 1793 so the rotation never took place. Jean Dominique therefore resigned in September 1793, the same year that he completed his father’s maps and they were published by the Académie des Sciences. The National Assembly took ownership of his map and, when he complained, he was arrested in February 1794 and imprisoned. In August 1794 Jean Dominique was released and went to live at the family home in Thury. Although his colleagues tried to get him to return to Paris and take up his scientific work once again, he refused, arguing that his family was more important.

12.Alexandre H. G. Cassini (Cassini V)

(1781-1832) Alexandre Cassini (Cassini V) did not follow the same footsteps of science as the preceding Cassinis. It is likley that the political intrigue and difficulties that brought the career of his father, Jean Dominique, to an end were responsible for Alexandre’s being unable or unwilling to follow his ancestors in a career in astronomy or cartography. Instead he went into the field of botany.

13.Eduard Imhof

(1895-1986) Eduard Imhof was a Swiss cartographer who is widely known for the relief shading maps he produced for school maps and atlases.  He founded the Institute of Cartography at the Swiss Federal Institute of Technology in Zurich (ETH Zurich), Switzerland and was its first professor. In 1927, he first revised the atlas used in Swiss high schools, and he then directed all published editions from 1932 until 1976. Between 1934 and 1975, all editions of the Swiss primary school atlas were also produced under his direction. He ultimately retired from teaching at ETH Zurich in 1965 but continued working on school maps until the mid-1970s.

14.Arthur H. Robinson

(1915-2004) Arthur Robinson was an American geographer and cartographer, born in Canada to American parents.  He wrote many influential articles and important books on cartography including: “The Look of Maps” (1952), based on his PhD dissertation, describing how map function influences the design process; “The Nature of Maps” (1976), with Barbara Petchenik, focusing on maps as a communication device between the cartographer and map reader; and “Elements of Cartography”, a widely-used textbook even today, though the sixth and last edition was published in 1995. 

During World War II, Robinson directed the map division of the Office of Strategic Services (OSS) starting in 1941. Even though there were no formal cartographers in OSS at that time, Robinson developed a team that created 5,000 hand-drawn maps.  As chief U.S. map officer, Robinson the Allied conferences in 1943 and 1944. For his work at the OSS, Robinson received the Legion of Merit from the U.S. Army in 1946. Robinson is also noted for creating the Robinson projection in 1961 in response to a request from Rand McNally for an aesthetic, uninterrupted world projection with limited distortion.

15.Jacques Bertin

(1918-2010) Jacques Bertin is a French cartographer and theorist, known from his book “Semiologie Graphique” (Semiology of Graphics), edited in 1967. Based on his experience as a cartographer and geographer, this book presents the first and most comprehensive theoretical foundation to what we today call “Information Visualization”. Bertin provides a universally-recognized theory of graphical symbols and modes of graphics representation that allow cartographers to transform geographic information into cartographic communication.  His work is based on a clear and logical system in which symbols can be varied according to seven “graphical variables”, which included position, size, shape, value, color (hue), orientation, and texture.

His career in mapping may be said to have begun at the age of 10 when he received the first prize of cartography at his primary school! He studied geography and cartography at the Sorbonne, and in 1967 he became professor of the Sorbonne. In 1974 he became director of the Geographical Laboratory of the École des Hautes Études en Sciences Sociales, and in the 1970s he became head of research at the Centre National de la Recherche Scientifique.

16.George F. Jenks

(1916-1996) Professor George Jenks guided the cartography program at the University of Kansas for 37 years.  Two major interests of Dr. Jenks included map production and cartographic curriculum development. With a fellowship from the Fund for the Advancement of Education, he was able to developed a modern curriculum for cartography. The first atlas of a U.S. state was produced under his direction with the “Kansas Atlas” being published in 1952. 

Jenks’ research in statistical mapping, which spanned twenty years, included 3D, choropleth, dot and graduated circle maps. Perhaps his most influential research was that which focused on choropleth mapping and data classification for univariate and multivariate maps. As computer cartography advanced, his research encompassed automated line generalization. His last academic publications reflected once again his interest in curriculum development – these included a paper about academic cartography at the University of Kansas and the development of cartographic curricula over the past 33 years.

His contributions to research and teaching in cartography are still felt today and his academic progeny carry his interests forward in his absence.

17.John Snyder

(1926-1997) John P. Snyder, an American cartographer, is most well-known for his work on map projections, although he was educated as a chemical engineer.  He had a lifetime interest in map projections, though it was just a hobby for him for many years. After learning of the U.S. Geological Society’s need for a map projection that could be used for the display of their satellite imagery, he developed the space-oblique Mercator projection.  After providing the projection to the USGS at no cost, he was subsequently offered a job with this governmental agency.

His work at the USGS led to the publication of the still much-referenced technical guides to map projections titled “Map Projections: A Working Manual” (1987) and “An Album of Map Projections” (1989). He also wrote “Flattening the Earth: Two Thousand Years of Map Projections” (1993) in which Snyder discusses and illustrates hundreds of map projections created from 500 B.C. till now.

Snyder taught courses on map projections at George Mason University, he was president of the American Cartographic Association from 1990-1991, and he served as a secretary of the Washington Map Society.

相关日志

你可能不知道的灯光图

$
0
0

NASA的灯光图真的很美:

你可能也下载了原始数据,不过你下载了之后打开过了么,打开之后又去分析过了么?如果有过,那你一定能发现不少有意思的事情;如果没有,那就往下看吧。

NASA提供了一些数据供我们下载,我们可以选择分辨率最高的那张。TIFF格式是带坐标的,显然是WGS84。有了坐标系是一切美好故事的开始,没有坐标系则可能是一切怨念的源头。特别是WGS84,Mapping Center曾谈过为什么WGS84那么重要。特别对于栅格来说,简单就是王道!

NASA还提供了一个视频:

这个在旋转的Black Marble也很美。

用GIS软件来处理视频可能不太适合,但生成一个Globle还是很轻松的一件事。比如Google Earth,ArcGloble等等。Google Earth由于表现过于优异,已经被防火墙拒之门外。没事,我们可以用ArcGlobe,虽然他已沉睡了多年。

只需把数据添加到ArcGlobe中就行了,因为已经有坐标系了嘛:

可能你已经发现了,颜色似乎和NASA的原图有点不一样。没错,在10之后的ArcGIS中,你载入的影像如果灰度值整体偏小,ArcGIS会默认给图片做拉伸,调整gamma值,这样不会因为太暗而看不清楚。当然你可以调回去:

也可以做个卷帘比较下:

个人觉得ArcGIS的默认处理效果还是不错的(有点意外),因而后面均已拉伸过的为例吧。

“Nothing tells us more about the spread of humans across the Earth than city lights.”NOAA的Chris Elvidge说,他研究这个问题将近20年了。那么我们也可以通过一些简单的数据叠加来看看灯光与人类的活动有什么关系呢?

1.全球国界

2.全球国界与时区

3.全球交通

4.全球机场

5.全球云图

5.中国苏南与浙江的城市(数据是Web服务,颜色改不了)

6.中国中部与东部的路网

7.中国沿海排污?(全世界只有中国的沿海是这样的!!!)

8.南北朝鲜(崔成浩说,“保证充足的睡眠是节约粮食的主要办法”。嗯。)

9.这是哪儿?海上之国吗?

不是!这是渔民在捕鱼

这只是非常简单的数据叠加而已,如果你有更好的数据以及合适的想法,我感觉是能分析出一些东西来的。这方面我并不擅长了,就到此为止了。

需要说明的是,通过平面图片去观察,并不能体现出Globe的优势来。因为从球到平面本身就是经过投影的(General Perspective projection),而且还看不全整个地球。要有好的体验,要自己打开ArcGloble去操作,所以我将所有数据与文档放在这里,有兴趣的同学可以下载。

其实还是有很多事情可以在ArcGlobe上做到,比如考虑考虑高程、日照;旋转地球保存为视频,NASA的视频我们也能做。当然还有更多,要发挥想象力啦。

以上叠加的数据均来自 arcgis.com,有web服务,也有lpk。感谢这些上传数据的人们。

NASA的James Gleason说,这几张图引起的巨大反响是他们所料未及的。因为他们已经观测、研究了将近20年了,这次只不过发布了新卫星(Suomi NPP)的数据,当然是配上了更先进的传感器啦。NASA网上能看到的最早的灯光图,是94年的:

或许这就能解释NASA为什么自己会想不到有那么轰动吧,他们只不过是在例行公事而已。

这不仅仅是一个简单的可视化,也不仅仅是一个科学数据源,这更是一种合理的科研方法,以及执着的科学精神的体现吧。

不同投影视角下的灯光图

$
0
0

上篇提到了球面上的灯光图,但一张球面图片不能完全展示地球的全貌。这次再来看看不同投影视角下的灯光图,或许会有不一样的体会。直接上图(右击图片可以打开大图哦):

1.plate carree

2.mercator

3.robinson

4.winkel tripel

5.gall stereographic

6.equidistant cylindrical

7.cylindrical equal area

8.times

9.sinusoidal

10.mollweide

11.aitoff

12.loximuthual

13.equidistant conic

14.polyconic

15.azimuthual equidistant

16.two point equidistant

17.van der grinten

18.stereographic

19.berghaus star aag

20.bonne

21.cube

22.fuller

22.goode homolosine(land)

23.goode homolosine(ocean)

24.hotine

元芳,你怎么看?

相关日志

用ArcGIS来绘制你的小星球

$
0
0

最近看地图投影,在检索Stereographic Projection时,无意中看到flickr上有很多这样的图片(在Google第一页,不让我看到都难啊):

直观的感受是将空间扭曲成了一个小星球,夸大和缩小都十分巧妙(等角的)。虽然以前也见到过,但一直觉得只是设计师的小把戏而已,与GIS没有半毛钱关系。

学过地图投影的都应当认识Stereographic Projection,翻译过来有好多种译法,比如球极投影、球面投影(直译过来是“立体投影”,这是为什么呢?),学名应该叫等角方位透视投影吧。透视投影原理很简单,推导的话初中几何的知识就够用了。

投影原点必须在球面上(在球心是日晷投影,在无穷远是正射投影),比如南极点,经纬网坐标原点,或者地球上任意一点。

Stereographic Projection绘图步骤

既然是投影,是不是可以用GIS的方法去做这种图呢?比如ArcGIS?答案显然是可以的。地球可以看成一个球体,球体上的坐标用经纬度来刻画。经度的跨度是360度,纬度的跨度是180度。显然,经度的范围是纬度的两倍。那么,我们找一张横纵比是2:1的图片,配准后是不是就能将地球包络起来了?

下面我介绍一下具体过程,以南京玄武湖为例:

选择3个角点做控制点,这样对应点是显而易见的。千万不要去地图上点,要在链接表里面输入,用完保存,这样下次还能用。

配好控制点之后要Update,重采样就算了,没必要。

这样坐标配对了,但还是没有空间参考的,所以要define一个。(注:这里选WGS84的椭球,虽然说理论上是要用正球的(sphere),但这点偏差眼睛根本看不出来。用WGS84只是为了方便在Globe中叠加,不然datum从sphere到spheroid是一次transform,这对于栅格来说,代价很大。)

叠加到Globe中查看一下,配上经纬网。看一下“南北极点”,以及“赤道”视角。注意,现在这不是一张照片了,这是一张有空间参考的栅格“地图”!

改变一下dataframe的空间参考属性,将显示投影改为Stereographic(没必要去重新project数据,因为我们只需要显示就够了。)。当然要改一下投影参数,原点设为(0,-90),也就是“南极点”。这就像你是站在南极点往北极点方向看。

这是结果:

大图点这里

全景Stereographic Projection绘法

如果你理解了上面所说的,那你会发现上图还是有一些不恰当的地方,或者可以改进的地方。比如:图片不是“圆融”的,中轴线下半段是明显的“边界”。因为上面的照片不是全景照片,panorama。全景是你站立的地方,上下左右等能看到的意思。如果是全景照片,那照片的左右是“连续”的。比如这张南京照片:

可以想象,如果将全景照片进行投影,可以得到“圆融”的效果,更像一个小星球。但是,你肯定也发现了,这种照片横纵比明显不是2:1的。这不是问题,重新计算一下配准点就行了,还是选择“南极点”为原点。我给出一个通用公式:

W是宽度,H是高度。

那这幅2048×461的照片的配准点文件就是这样的:

球面上是这样:

显然只能从“南极点”覆盖到“赤道以南”附近。整个“北半球”都没有啦。

同样按上述步骤操作,可见:

大图点这里

更多

  • 再进一步,如果你有兴趣,可以利用ArcPy写一个脚本,让这个过程自动化了。或者脱离ArcGIS,完全用开源的东西也肯定是可能的。因为我发现那些设计师做这个图真的好累,这难得让我在江湖中体会到GIS的一丁点优势呀:P
  • 改变投影参数还会有很多玩法,特别是把“北极点”作为原点。以及Scale Factor也是有用的,自己挖掘啦。
  • 另外,原始照片不能太宽,也就是尽量保持2:1吧。不然投影完后都缩成一团里,这应该挺好理解的。
  • 关于数据,google panorama可以找到一些图片,但很多都是360度全景展示的,而且显然是瓦片式的,这样的图片你抓了也没用,街景也应该是这个意思吧,没研究过。而且panorama不是全指360度的视角,有些广角图也叫panorama。反正360度全景图片不好找!这里有个网站里面分享了不少:http://www.wpanorama.com/panoramas.php
  • 在ArcGISOnline上放了一个地图包,有兴趣的同学自取:http://www.arcgis.com/home/item.html?id=e7d10b20ad5c4dbeb7aab8e785779cf1

2012

$
0
0

写一下去年小结,恰逢今天还是生日,那么以后都在这一天写小结吧:

一、年初实验室重点基金要结题,帮忙做了点小事。体会了封闭的滋味,也算是明白了点科研那会事儿。后来帮老板写本子,感受就又深了一层,中不中那是另外一回事。简言之,没我想的那么自由。

二、从前年暑假一直在做水动力模型和GIS的集成,以POM为例。上半年算是把技术路线走通了,可实现自动网格化,数据准备,模型计算以及结果显示,都是在Web上完成的。这是个跨专业的事情,做起来实在是太费劲了,我对水动力模型的原理、求解都不了解,也没有多大兴趣去了解。但这确实是一个很有意义的事情,如果有人能整合好的话。

三、寝室四人参加软考,全部一次性通过。话说这考试含金量真不高,但跟GIS专业能靠上点边的证,想来想去也就这个了。

四、在苏州待了两个月,做SIP的智能交通项目。用Flexviewer这种先前一点都没碰过的玩意。很幸苦但是一段难忘的经历。特别是苏州,确实很美,古典气质和现代化融合得那么好。自古上有天堂,下有苏杭,不是随便说说的啊。

五、参加了一下ArcGIS的征文活动,发在csdn上,结果写跑题了,没得奖。但没想到的是有那么多人浏览,CSDN上大概将近有1万次阅读了吧,还不算3sNews上的。没人提出不同意见,指出错误,这让我略感不安。对了,先前还抓了3sNews上一些招聘数据,做了个demo,大家都挺喜欢,我也蛮开心的。

六、把几个一直困扰我的问题尽量搞清楚了,比如HeatMap的原理、Web Mercator的来龙去脉、空间参考及坐标转换在GIS软件中的实现原理、数据分类的原理以及实现(Jenks-Fisher自然断点分类法还没实现,我会记得的)。当你把一个问题搞清楚的时候,特别是困扰你很多年的问题,那是一种很爽的感觉。虽然这些问题都没有任何创新性,都是很基础的问题。反过来想,那些能拿到PHD的人是世界上最幸福的人,因为他们把一件事情,一样东西,一种方法从出现在人类知识中以来的所有细枝末节都搞清楚了,然后还能提出一种新的东东来。我猜他们搞定PHD论文时心里一定在说,“愚蠢的人类啊!”,哈哈。

七、去浙大参加了一个可视化论坛,很偶然的机会。明白了平日那些很炫的可视化作品背后是有多么复杂的数据和精妙的方法在支撑啊,完全不是一个设计师随便PS下就出来的。空间数据在可视化领域还是比较薄弱,今后有待加强,GIS也要多多吸收别的领域的知识。

八、去年书看得还是不多,从Kindle升级到iPad有很好的阅读体验,很方便,但还是要加量啊!

九、开学后一直在乱折腾,直到老大说该搞搞论文了,才想起来论文才是最重要的。打算把做过的东西揉合起来,凑成一篇论文,这很理想,但真的有点难,所以要抓紧了。

十、个人生活,就如猪所说,“就是一杯具”。洗洗睡吧。

The Look of Map APIs

$
0
0

这两天试用了几个主流的Map API,比如Google、百度、天地图、OpenLayers、Bing、Here等。虽然花得时间不多,而且我对JS所知甚少,但还是写了点代码:http://lab.hmfly.info/map_api/index.html这个东西很简单,就是各个API的基本用途。通过拖动虚线红框内的Google地图(左上)可以使各个地图联动起来,反之不行。这个2×3的表格内,哪块是哪家地图还是很明显的。

比如南京新街口:

又如伦敦格林尼治:

通过两个全图就能发现:(1)各家在中国大陆的地图都是有偏移的,而且各不相同。(2)国外是没有偏移的,当然百度没有国外数据,天地图没有国外大比例尺数据。 几乎所有的地图API都是地图控件加上Web服务。一个地图控件怎么写,这本书有介绍。Web服务无外乎Geocoding、Direction、Place等等。坐标系一般用Web Mercator,天地图是CGCS2000,无投影。

下面详细介绍(相对)下:

Google:目前地球上最强大的在线地图,瓦片地图、Web Mercator坐标系都是Google发明的,而且也已经成为了事实上的标准。Google地图比较独特的功能有:(1)Styled Maps,可以自定义Road地图的样式,包括地物和注记的颜色等等style。应该是服务器实时根据样式切图的。同样的地图,Styled Maps的响应时间比普通的慢一些,大概一秒钟的样子。例子中的Google地图Style是文档中抄过来的,墨绿的样子。(2)自定义瓦片投影,自定义投影对WebGIS来说不算什么,但普通Map API中支持自定义瓦片投影的貌似只有Google。当然,瓦片是要在服务器上切好的,前端要定义投影函数等等。(3)Visualization库,支持Fusiontable、Google Earth等等。Google的一大优势就是产品丰富,想做Mashup之类在自己的生态系统内就能玩得很好,而且像KML这些都已经成为了标准。还有别的像Google公交换乘计划,可以自己根据Google定义的格式提交本地公交数据,被采纳之后,所在地就能使用公交换乘了。Google的所有作为都是为了让信息流动更便利,并且自己也能从流量中获利,地图也是。

百度:国内做得最好的地图,主要是本土化做得很好。百度地图API没给我留下太深印象,可能是因为模仿Google模仿的比较好。文档里面这句话倒是让我记了:“国际经纬度坐标标准为WGS-84,国内必须至少使用国测局制定的GCJ-02,对地理位置进行首次加密。百度坐标在此基础上,进行了BD-09二次加密措施,更加保护了个人隐私。”我不明白地图偏移(加密)和个人隐私有什么关系,你把地图偏移了,相应的个人位置也会偏移(比如GPS点),这不是负负得正,相对位置还是没有变么。比如你在新街口,百度地图的新街口和Google地图的新街口坐标位置是不一样,但却是都是在新街口啊。个人用户谁关心坐标位置,有多少人连什么是经纬度都不清楚呢。还是我太愚钝了,不明白偏移的用意?

天地图:国家测绘局做的。瓦片格式自定义的,前端API是在OpenLayers上改的。天地图从任何方面都比不上任何互联网地图,除了在数据上可能会保持一定的独特性,比如资源3号卫星。天地图如果能在测绘成果共享上做出突破就好了,而不是着力在公共服务上,这是无用功。例子中的天地图用了国家节点和南京规划局节点的服务,也就是天地图·南京的服务。

OpenLayers:因为是纯粹的API,而且是开源的,所以可以支持各种各样的地图服务,从ArcGIS到Google Maps等等,也可以自己写扩展。OpenLayers是FreeBSD许可,基本可以随便拿来用,天地图的API就是在这上面改的,所以自主知识产权之类的事情还是少谈点安全。OpenLayers发布的很早,大概有5、6年来,类库显得有点凌乱。而且功能上也有点跟不上时代节奏了,特别是HTML5的趋势。OpenLayers 3将是一个完全重构的新版本,很期待。我例子中调用的是OpenStreetMap的服务,很简单。

Here:Nokia的地图服务,以前叫Ovi Maps。诺基亚转型失败后又取了这么个名字,还算不错吧。API是德国人做的,代码风格完全有点奇怪。Here本身功能强大,特别是三维效果很赞,用的C3的技术。可视化部分做的很强大,一个热图都有好几种方式。开发文档里面的示例浏览器也很有创意。

Bing:以前的Vitural Earth,整合到Bing里面就叫Bing Maps了。Bing Maps一直是一个很文艺的地图。比较独特的功能有:(1)最早支持航拍图,显然比影像更清晰,角度也更多。(2)MapType里面有一种auto模式,可以根据比例尺自动变换地图类型。(3)Venue,场馆地图,也就是室内地图。(4)英国地区支持collinsBartordnanceSurvey地图。Ordance Survey就是英国测绘局,测绘局的资料通过商业公司发布出来,省去了自己开发的麻烦,反正也做不好,这种模式不错呀。另外,Bing的相关背景资料做到不错,学习的好资源。比较蛋疼的是Bing的中国地图不是更全球同步的,Bing Maps API已经更新到7.0了,国内还停留在6.2上。我用的全球API,没有中国区的道路图,影像是有的。 下次再介绍一点非主流的API。

—————————————————————————————————————————

2.2更新,地址没变:http://lab.hmfly.info/map_api/index.html去掉了Openlayers,地方有限,而且天地图的API已经可以代表OL了,等OL更新3.0吧。

Leaflet:号称最好的前端API,简单用了下,确实不错,很清爽,有插件机制。瓦片是Cloudmade样式化过的OSM,红色,很喜欢。

Modest:很简单,就如其名字,谦虚的地图,连Attribute都不标上,真是低调!瓦片是MapBox的,MapBox也是个金矿!

Polymaps:比较早的矢量地图API,支持geojson和svg。还是statmen出品,但貌似不怎么更新了。

Osmbuildings:有意思的东西,通过调用要素服务,获得矢量数据,在瓦片上呈现出“三维”的感觉。作者强调这不是WebGL,应该是简单的几何透视吧,百度地图那些放大到最大都有这样的效果,只不过百度是预先切好的图片。例子是叠加美国人口数据(json),棱柱图。

Kartograph:法国人的东西,romantic!例子很精美。基于几个开源库开发的,略复杂,我只是简单的加载了意大利的svg而已。他支持一些高级聚合算法、投影等等。

D3:最牛逼的数据可视化库了,最早是9月份在浙大听报告的时候听说的,现在3.0了。我关注geo部分,他支持几十种投影,还是正反算都有的!这让我等giser情何以堪啊!当然别的voronoi、cartogram等等也都有,巨大的金矿!例子是网站上抄的一个方位投影,化简了一下,可交互。 先告一段落,地图API主要是传统的和可视化的两部分吧,也很好区分,支持瓦片的肯定是传统过来的,支持矢量的肯定是偏向可视化的,当然两者是在不断融合的。基于WebGL的三维也会很普遍吧,比如cesium。

js写得真蛋疼!

—————————————————————————————————————————

3.27更新,地址没变:

主要是天地图更新了,1.0的api无效,更新了2.0的api。

可视化的api应该单独拿出来,等以后熟悉了之后吧。

增加了阿里云地图,拿来看看偏移量不错的。

貌似有点卡?

南京奥体学区地图

$
0
0

南京奥体位于河西中部(应天大街以南,河西大街以北),河西又位于大南京(江北开发后)的中部。

奥体周边规划

作为未来城市中心地带,且是高端服务业、金融业聚集的地区,奥体周边的居住区,以及为其配套的学区,在可以遇见的未来会体现出应有的价值。

王祥房产统计资料

借用王祥房产事务所的统计,以及网上相关资料整理制图如下(大图pdf):

奥体学区地图

图中所示均为公办的学校,民办的学校没有学区的概念,但不乏好的学校如致远外国语小学等。

小学部分,目前共有6所小学,分别为新城小学、中华附小、金中实小、新城小学南校区、建邺实小、小红花小学。

中学部分,目前有3所中学,分别为新城中学、新城中学南校区、中华中学。

以上数据、地图截止于2014年4月,之后政府在规划和学区政策上肯定会有所“作为”,如近期的青奥村小学、新城北小区等等。

个人整理,能力有限,难免有所疏漏,敬请批评指正!

而且数据具有很强的时效性,随时可能变化,力所能及之内会及时更新。

Viewing all 11 articles
Browse latest View live