《毕业论文(设计)基于MapObjects 的地名公共服务系统开发.doc》由会员分享,可在线阅读,更多相关《毕业论文(设计)基于MapObjects 的地名公共服务系统开发.doc(5页珍藏版)》请在三一办公上搜索。
1、基于MapObjects的地名公共服务系统开发王耿峰 朱岩 周莎 宋华伟解放军信息工程大学测绘学院 郑州 450052Email:shame2摘要:本文介绍了GIS组件MapObjects的特点,并以许昌市地名公共服务系统为例,探讨了基于组件式GIS开发城市基础地理信息系统的方法。关键词:地名服务;MapObjects;GIS;ABSTRACT: This article introduces the characteristic of GIS COMMapObjects; and takes the Xuchang Placename Service System for example,
2、talks about the method of developing City Basic GIS based on ComGIS. Keywords: Placename Service; MapObjects; GIS;1. 引言:随着国民经济的飞速发展,地理信息系统(Geographic Information System,简称GIS)的应用已经遍及生活的各个方面,除了传统的地理、地质、交通、测绘等领域外,在气象、环境、水利、电力、建筑以及以往和地理毫无关系的政务管理等领域也有了很大的应用,可以毫不夸张的说GIS的时代已经来临!目前,城市地理信息系统的建设在全国各大、中型城市中已经
3、如火如荼的展开,其建设的好坏,也是一个城市信息化水平的重要标志。地名查询服务系统作为城市地理信息系统的一种,主要为民众提供出行参考、地名查找、风景名胜区查询等方面的空间信息服务,经过笔者所参与开发的许昌市地名公共服务系统的投入使用,证明具有很好的现实应用意义。2. 组件MapObjects简介:GIS开发分为三种方法:(1)独立开发, 指开发者在一定的操作系统平台上利用可视化的编程语言,不依赖于任何GIS工具软件,从空间数据的采集、编辑到数据的处理分析及结果输出,所有的算法都由开发者独立设计,但这种开发方式对于大多数开发者来说,能力、时间、财力方面的限制使其开发出来的产品很难在功能上与商业化G
4、IS工具软件相比;(2)二次开发,指在专业GIS软件平台下,利用其提供的二次开发脚本语言进行GIS开发,但专业软件相对独立封闭,随着功能的增多而日益庞大,用户难以掌握,且价格昂贵;(3)组件式GIS开发,允许开发人员在可视化的开发环境中(如Delphi、VB、VC+等)直接进行GIS功能的开发,既不需要学习新的GIS二次开发语言,又可以和一般的应用程序集成,很好地满足了广大GIS用户的需要。组件技术是组件式GIS开发的基础,COM(Components Objects Mode,组件式对象模型)是一种开发对象组件的二进制形式的标准,可理解为一种体系结构或框架模型。COM要求基于这种标准所开发出
5、的组件应由若干对象和对象的接口组成,接口在形式上表现为对象的属性、方法和事件,基于这种模型开发出的组件称为COM组件。组件式GIS的基本思想就是把GIS各大功能模块划分为几个具有不同功能的控件,各控件之间可以方便地通过开发工具集成起来,形成最终的GIS应用。MapObjects是全球最大的GIS软件供应商ESRI公司在业界最早推出的GIS软件组件,是基于COM技术的地图应用组件,也是全球范围内使用最广的GIS组件。MapObjects由一个称为Map的ActiveX控件和一组大约45个自动化对象组成,在标准的Windows编程环境下,能够与其他图形、多媒体、数据库开发技术组成完全独立的综合性应
6、用软件,是基于前端应用业务的良好的地图开发环境。2.1 MapObjects的数据结构:在MapObjects中一个综合性的地图由多个图层构成,图层可以是GIS矢量图层,也可以是CAD图层或者影像数据。对于GIS和CAD的矢量图层,其内部统一用记录集(Recordset)来表达。记录集如同关系数据库中的二维表,行表示每个要素、列表示每个属性。如果含有名称为 “Shape”的列,则该记录集表示的是地图要素,否则表示的是普通的数据库表格。Shape字段以面向对象的技术封装了要素的图形部分,它把图形划分为点、线、面三种类型并且引入了部件(Part)的概念,由点构成部件,线和面则由部件构成。2.2 M
7、apObjects的体系结构:MapObjects的可编程对象根据其功能的不同可分为6大组:(1)地址匹配对象组、(2)数据访问对象组、(3)地图显示对象组、(4)几何图形对象组、(5)投影对象组、(6)实用对象组。每组对象组又包括一系列对象,一个对象负责地图一方面的功能。2.3 MapObjects的基本功能:依据MapObjects所提供的功能接口,常用的地图功能基本都能实现:(1)显示、浏览(放大、缩小、漫游)一张多图层地图(道路,河流,居民地);(2)显示、生成、选择、识别图形组件(如点,线,圆,多边形等);(3)显示、编辑地图要素的属性数据、标注、说明、字符等;(4)按照名称、距离、
8、SQL描述、要素属性值查询要素;(5)绘制专题图、点密度图和饼状柱状图表;(6)显示多种格式的地图数据(矢量、栅格等);(7)动态地图数据的显示、查询和分析;(8)转换地图数据的坐标系统;(9)输出地址匹配的地理对象;(10)基本统计、空间分析算子(Buffer,Union等)。3.基于MapObjects的许昌市地名公共服务系统开发:3.1、系统功能设计:图(1) 系统应用界面系统的主要目的是为了服务市民,为市民提供城市公共地理信息服务,主要为市民提供出行参考、地名查询及目标地物属性显示等方面的服务。系统包括电子地图控制模块、电子地图显示模块、地名查询模块、在线帮助模块四部分。电子地图控制模
9、块实现控制地图和图层的显示功能,可以根据实际需要来选择所要显示的图层;电子地图显示模块实现地图的放大、缩小、漫游、刷新以及地图鹰眼等功能;地名查询模块是该系统的核心部分,实现通过地名查找、点选、框选等方式选择并查询目标地物的信息,以及查询最近目标、距离量算、面积量算、地名定位等功能,其中,我们将着重讨论一下通过地名查找目标地物并在地图上定位及目标地物属性显示的实现方法;用户帮助模块解决用户使用时的疑问。系统应用界面如图(1)所示。3.2、系统数据组织:系统的数据分为地理空间数据和属性数据,分别以SHAPE文件格式和关系型数据库的形式存储。由于系统的数据量并不算太大,系统采用了Microsoft
10、 Access数据库管理工具管理属性数据。在数据库中分层次建立了党政机关图层信息表、事业单位图层信息表、企业图层信息表、医疗卫生图层信息表、文化教育图层信息表、交通运输图层信息表、商业服务图层信息表等多个表,通过这些表可以实现查询目标地物的相关属性信息。3.3、系统功能实现:系统采用Visual Studio.NET 2003作为开发平台,整个系统使用MapObjects+C#模式编程。MapObjects的使用较为简单,在Visual Basic、Delphi、Visual C+、Visual C等能够支持控件开发的编程环境下,将MapObjects插入到编程环境中,即可通过调用接口实现控件
11、的各种方法。在.NET框架下的Visual C开发环境中引用MapObjects,在成功安装MapObjects后,在编程环境中新建一个Windows应用工程,从Project菜单中选择Add Reference命令打开工程的添加引用对话框,并切换到COM标签页,在标签页的列表框选项中选择ESRI MapObjects2.3单击OK按钮将MapObjects组件的引用添加到工程中。在完成添加后,选择View菜单中的Toolbox命令,激活工具箱窗口,然后在Toolbox窗口切换到General选项页,在其中单击右键选择弹出的Customize Toolbox命令打开自定义工具箱的对话框,在对话
12、框中选中MapObjects2.3 Map Control前面的复选框,确定后将MapObjects的地图控件加入到工具箱中。这样即可在编程环境中如同引用其他控件一样引用MapObjects的地图控件。下面着重讨论一下系统部分功能的实现:(1)图层的加载与显示:MapObjects2.DataConnection dc=new MapObjects2 .DataConnectionClass ();dc.Database =E:许昌地名Data;if(dc.Connect() ) MapObjects2.MapLayer layer1=new MapObjects2.MapLayerClass
13、 ();layer1.Symbol.Color =(uint)MapObjects2.ColorConstants.moLightYellow ; layer1.GeoDataset =dc.FindGeoDataset (CITYMAP);this.axMap1 .Layers .Add (layer1); this.axMap1 .CtlRefresh (); (2)图层的放大、缩小、漫游与全图显示:放大:axMap1.Extent = axMap1.TrackRectangle();/拉框放大缩小: MapObjects2.Rectangle rect = axMap1.Extent ;
14、 rect.ScaleRectangle(2);漫游: axMap1.pan();全图显示: axMap1.Extent=axMap1.FullExtent;(3)地名查询:地名查询是该系统的核心部分,它包括两个方面:其一是通过选择列表框中目标地物的名称来对目标地物进行定位,并闪烁显示;其二是在地图上点击目标地物,从而显示目标地物的属性信息。其中点击地物显示相关属性信息的实施步骤为:捕获目标地物点、连接相关图层信息表、读取相关字段,在此就不做过多的介绍。通过地名在地图上定位目标地物的实现代码如下:private void listBox1_SelectedIndexChanged(object
15、 sender, System.EventArgs e)string s=listBox1.SelectedItem.ToString();MapObjects2.Recordset rf=null; MapObjects2.Point shp=new MapObjects2.PointClass(); MapObjects2.MapLayer lf=new MapObjects2.MapObjects2.MapLayerClass();lf=(MapObjects2.MapLayer)axMap1.Layers .Item (L-Point);rf=lyf.SearchExpression(
16、NAME=+s);shp=rf.Fields.Item(“shape”).Value; axMap1.FlashShape(shp,3); axMap1. CtlRefresh ();4. 结语:一方面,随着城市的发展、人民生活水平的进步,公众对城市基础地理信息系统的需求不断增加;另一方面,随着组件式GIS的出现与发展,基于GIS组件的地理信息系统开发方法把GIS带入了一个新的发展时期。正所谓“技术推动,需求牵引”,相信随着基于组件式GIS进行地理信息系统开发技术的进一步成熟,更多的服务于广大市民的公众的、基础性的GIS会相继的出现。参考文献 1 边馥苓. GIS地理信息系统原理和方法 北京:
17、测绘出版社,1996 2 邬伦. 地理信息系统原理、方法和应用.科学出版社,2001 3 宋关福,钟耳顺. 组件式地理信息系统研究与开发中国图形图像学报,1998 4 薛 伟. MapObjects地理信息系统程序设计北京:国防工业出版社,2004 5 刘光地理信息系统二次开发实例教程 C#和MapObjects实现北京:清华大学出版社, 2003 6 刘光,刘小东地理信息系统二次开发教程 组件篇北京:清华大学出版社, 2004 7 Mickey Williams. Microsoft Visual C#.NET Core Reference . 北京:清华大学出版社, 2003 8 ESRI
18、Inc. http:wwwesricom更多测绘论文请登录测绘网论文频道查询:http:/ Editors note: Judson Jones is a meteorologist, journalist and photographer. He has freelanced with CNN for four years, covering severe weather from tornadoes to typhoons. Follow him on Twitter: jnjonesjr (CNN) - I will always wonder what it was like to h
19、uddle around a shortwave radio and through the crackling static from space hear the faint beeps of the worlds first satellite - Sputnik. I also missed watching Neil Armstrong step foot on the moon and the first space shuttle take off for the stars. Those events were way before my time.As a kid, I wa
20、s fascinated with what goes on in the sky, and when NASA pulled the plug on the shuttle program I was heartbroken. Yet the privatized space race has renewed my childhood dreams to reach for the stars.As a meteorologist, Ive still seen many important weather and space events, but right now, if you we
21、re sitting next to me, youd hear my foot tapping rapidly under my desk. Im anxious for the next one: a space capsule hanging from a crane in the New Mexico desert.Its like the set for a George Lucas movie floating to the edge of space.You and I will have the chance to watch a man take a leap into an
22、 unimaginable free fall from the edge of space - live.The (lack of) air up there Watch man jump from 96,000 feet Tuesday, I sat at work glued to the live stream of the Red Bull Stratos Mission. I watched the balloons positioned at different altitudes in the sky to test the winds, knowing that if the
23、y would just line up in a vertical straight line we would be go for launch.I feel this mission was created for me because I am also a journalist and a photographer, but above all I live for taking a leap of faith - the feeling of pushing the envelope into uncharted territory.The guy who is going to
24、do this, Felix Baumgartner, must have that same feeling, at a level I will never reach. However, it did not stop me from feeling his pain when a gust of swirling wind kicked up and twisted the partially filled balloon that would take him to the upper end of our atmosphere. As soon as the 40-acre bal
25、loon, with skin no thicker than a dry cleaning bag, scraped the ground I knew it was over.How claustrophobia almost grounded supersonic skydiverWith each twist, you could see the wrinkles of disappointment on the face of the current record holder and capcom (capsule communications), Col. Joe Kitting
26、er. He hung his head low in mission control as he told Baumgartner the disappointing news: Mission aborted.The supersonic descent could happen as early as Sunday.The weather plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with
27、 no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher th
28、an the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause), he can expect a lot of turbulence.The balloon will slowly drift to the edge of space at 120,000 feet (22.7 miles/36.53 kilometers). Here,
29、Fearless Felix will unclip. He will roll back the door.Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform.Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so desp
30、ite the distance, it will not be like diving into the deep end of a pool. It will be like he is diving into the shallow end.Skydiver preps for the big jumpWhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he
31、will begin to slow as he approaches the more dense air closer to Earth. But this will not be enough to stop him completely.If he goes too fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy h
32、is 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524 meters).In order to deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if eve
33、rything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).It might not be the moon, but Kittinger free fell from 102,800 feet in 1960 - at the dawn of an infamous space race that captured the hearts of many. Baumgartner will attempt to break that record, a feat that boggles the mind. This is one of those monumental moments I will always remember, because there is no way Id miss this.