webgis系统实现

简介: webgis系统实现

开发环境搭建

城市地下电力管线管理系统是基于B/ S 架构的应用管理系统,其系统开发平台的软件

环境配置要求如下:

(1)操作系统: Windows 系列。

(2) Java 运行环境: JDK 1. 6 及以上版本。

(3) Web 服务器: Tomcat 7. 0 服务器。

(4)数据库: PostgreSQL 9. 2 和PostGIS 2. 0 及以上版本。

(5)地图服务器: GeoServer 2. 3 及以上版本。

(6) J2EE 开发平台使用: Eclipse 4.2 及以上版本。系统在Eclipse 平台下使用Java 、HTML 和JavaScript 等语言进行J2EE 开发。系统的开发平台使用开源的GIS 框架: GeoServer 、PostGIS 和OpenLayers 。GeoServer 是系统的GIS 服务器,主要作为GIS 服务的发布平台; PostGIS 为系统空间数据的存储提供支持;

OpenLayers 为网页端的GIS 开发框架,能够快速进行网页端GIS 功能的开发和维护。

(1)项目开发的第一步是搭建项目环境及项目集成框架等,在此之前需要将Spring2 、Structs2 、Hibernate 及系统应用的其他jar 包导人到项目的lib 文件下。

接下来需要对Struts 、Spring 、Hibernate 以及web. xml 文件进行配置。这些配置文件

的配置过程如下。

(2)配置Struts2 :在项目的ClassPath 下创建Struts. xml 文件,其配置代码如下。

<?xrnlversion =”1. 0 ” encoding = ” UTF - 8 ”?>
<!OOCTYPEstrutsPUBLIC
~//ApacheSoftwareFoundation//DTD StrutsConfiguration2 . 。//四”
” http: I I struts. apache. org/ dtd s/ struts - 2. 0. dtd ”>
<struts>
< constant name = ” struts. devMode” value= "false”/>
< constant name =” struts.multipart.saveDir” value =”/tmp"></constant >
< constant name =” struts . multipart.maxSize” value =”20971520 ”/>
〈! 一树目录及侧栏配置一〉
< package name =” tree" extends =”struts - default ”>
< action name =” initTree” class =” treeAction” method z ” execute”>
< result name = "error”>/ wrong. jsp </result>
</action>
<action n臼ne =”getSideBarJson” class =” getSideBarJson ”『『teth od =”execute”>
< result name =飞rror ”>/ wrong . jsp</result>
</action>
< action name =”getSideBarJJson” class =”getSideBarJJson” method =” execute ”>
< result name =” error”>/wrong. jsp</result>
</action>
</package>
〈! -- 地图相关配置-一〉
< package name =” property” extends =”struts - default ”>
< interceptors >
< interceptor name =” loginCheck'’ class =” loginChecl♂〉
</interceptor >
< interceptor - stackname =”myStack”>
< interceptor - ref name =” loginCheck"/>
< interceptor - ref name = "defaul tStack”/>
</interceptor - stack>
</interceptors >
<default - interceptor - refname = "myStack”></default - interceptor - ref>
< global - results >
< result name =”unlogin ”>/ template/relogin. jsp </result>
</global - results >
<action n田ne =”getProperty” class =”getProperty” method =” execute”>
<result n四e =” 1010203 ”>/ template/property/ transformer. j sp </result>
··.〈!省略的配置信息〉
</action>
< action name =” getPropertyJson” class =” getPropertyJson” method =” execute”>
< result name =” input">/ template/ common/ error. jsp </result >
</action>
< action name =”getPropertiesJson” class =”getPropertiesJson”
method =” execute”>
< result name =” input”>/template/common/error . jsp </result>
</action>
</package>
〈!--系统功能配置--〉
<package n出ne =”system” extends =” struts - default”>
< interceptors >
< interceptor n副ne =”loginCheck” class =” loginCheck”>
</interceptor >
</interceptors >
<global - results>
< result name =”unlogin”>/template/relogin. jsp </result>
</global - results>
<action n副ne = ” home" class =” home " method =”execute”>
<result n四e =” success”>/ template/home. jsp </result>
<result 旦出e =” unl 吨川、/template/login. jsp </result>
< interceptor - ref name =” defaultStack”/>
< interceptor - refname =” loginCheck”/>
</action>
〈!省略的配置信息〉
</package>
</struts>

配置Hibernate

: 在Hibernate 的配置文件中配置数据库的连接信息、数据库方言

及打印SQL 语句等属性,其关键代码如下。

<?xmlversion =” 1. 。” encoding =” utf- 8”?>
<! OOCTYPEhibernate - configurationPUBLIC
”- I /Hibernate/HibernateConf igurationDTD 3. O I /EN”
” http: //www.hibernate.org/dtd /hibernate configuration- 3 . 0 . dtd ”>
<hibernate - configuration>
<session - factory>
<property nne =”hibernate.bytecode.use_reflection_optimizer”> false
</property >
<property nne =”hibernate . connection. driver_class”>
org. postgresql. Driver</ property>
< property name =”hibernate. connection. password "> admin </property>
< property name =” hibernate.connection.url”>
jdbc: postgresql: //localhost : 5432/0pengisData Base </property>
< property name =” hibernate.connection.usern四e ”> postgres </property>
<property nne =”hibernate.dialect”>
org. hibernate. spatial. dialect. postgis. PostgisDialec t </property>
< property name =” hibernate. format sql ”> true </property >
<property nne =” hibernate. search.autoregister_ listeners ”> false
</property>
< property name =飞ibernate. show_sql ”> true </property>
< property name =” hibernate.connection.pool_size”> 20 </property>
<property n皿e =” hibernate. proxool. pool_alias 与pooll </property>
< property name =” hibernate.max_fetch_depth ”> 1 </property>
< property name =”hibernate. jdbc.batch versioned_data”> true </property >
<property n四e =” hibernate . jdbc . use_streams for binary”> true </property >
<property n四e =” hibernate.cache . region_prefix”> hibernate. test </property>
<property n副ne =”hibernate.cache . provider_class ”>
org. hibernate. cache. Hashtable CacheProv ider </property>
< mapping resource =”org/resource/object/PdEwPpBuried.hbm. xml ”/>
.... <!省略的映射信息〉
</session - factory>
</hibernate - configuration>

配置Spring :利用Spring 加载Hibernate 的配置文件及Session 管理类,在配置

Spring 时只需要配置Spring 的核心配置文件applicationContex. xml ,其代码如下。

<?xmlversion =” 1. 。” encoding =” UTF- 8 ”?>
< beansxmlns =” http : //阳w springframework. 口rg/sch四a/beans"
xmlns:xsi =” http: //www.w3.org/2001/XMLSchema- instance"
xmlns:aop =”http : //www.springframework.org/schema/aop”
xmlns :tx =飞ttp://www.springframework.org/schema/tx ”
xsi: schemaLocation =” http : //www. springframework. org/schema/beanshttp://www.
springframework. org/schema/beans/spring - beans - 2 . 5. xsdhttp://www. springframework. org/
schema/ aophttp: I I www. springframework. org/ schema/ aop/ spring - aop - 2 . 5. xsdhttp: I I www.
springframework. org/ schema/txhttp : I /www. springframework. org/ sch四a/tx/ spring - tx - 2 . 5.
xsd”>
〈! 一Service 服务层配置
######################################-->
〈! 一树目录一〉
<bean name =” treeService" class =”。rg . ldw.service.treeService">
< property name =” treeDao”>
<ref bean =” treeDa。”/〉
</property>
</bean>
〈!--登录一- 〉
<bean n四e =” loginService” class =” org. ldw.service.loginService”>
< property name =” userDa。”〉
<ref bean =” systemUser”/>
</property>
</bean>
<I --属性--〉
<bean name =”propertyService” class =”org.ldw.service.propertyService”>
<property name =”daoSelect”>
<ref bean =” selectRecordAll ”/>
</property>
<property n缸ne =” daoSave”>
<ref bean =电aveProperty”/〉
</property>
</bean>
〈!--系统用户管理--〉
<bean n四e =” systemUserService ” class =” org. ldw. service. systemUserService、
<property n缸ne = ” userDa。”〉
<ref bean =飞ystemUser ”/〉
</property>
</be皿〉
〈!一文件数据导人一〉
<bean name =”import ExcelService” class =”org. ldw. service. import
Excel Service” scope =”prototype”>
< property name =” import Da。”〉
<ref bean =” import Da。”/〉
</property>
<property n缸ne =” import DaoEle”>
<ref bean =” import DaoEle”/>
</property >
<property n缸ne =” import DaoWirecable”>
<ref bean =” import DaoWirecable”/>
</property>
<property n四e =” import DaoObj ">
<ref bean =” import DaoObj ”/>
</property>
</be四〉
〈!一一图片导人--〉
<bean name =飞ploadsPhotoService"
class =” org.ldw. service.uploadsPhotoService” scope =”prototype”>
<property name= "jpegTool ">
<ref bean =” jpegTool”/>
</property>
<property name =” daoSave”>
<ref bean =”SaveProperty”/>
</property>
< property name =”photo”>
<ref bean =” photo”/>
</property >
</bean>
<!一拦截器一〉
<bean n四e =” loginCheck ” class =飞rg. ldw.action. logininterceptor”/>
<! -- Action 视图层配置
######################################-->
<bean name =” home" class =” org.ldw.action . homeAction”/>
<bean n副ne =” login” class =” org.ldw.action. login且ct ion” scope =”prototype">
<property n缸ne =” loginService”>
<ref bean =” loginService”/>
</property>
</bean>
</servlet>
< serv let - mapping>
< servlet - name> default </servlet - name>
< url - pattern >/</url - pattern>
</ servlet - mapping>
< servlet - mapping>
< servlet - name> cgi </ servlet - name>
< url - pattern >/cgi /祷</url - pattern>
</servlet - mapping>
〈! 一strut2 的配置一- 〉
<session - config >
<session - timeout> 3600 </session - timeout>
</session - c口nfig>
<filter>
< filter - name> struts2 </filter - name>
<filter - class>
第7章城市地下电力管线GIS 系统|’ 297
org. apache. struts2.dispatcher. ng. filter . StrutsPrepareAndExecuteFilter
</filter - class>
</filter>
< filter - mapping>
< filter - name> struts2 </filter - name>
< url - pattern > 替. action</ url - pattern>
< dispatcher >阻QUEST</ dispatcher>
< dispatcher> FORWARD</ dispatcher>
</filter - mapping>
< filter - mapping>
< filter - name> struts2 </ filter - name>
< ur 1 - pattern >普. jsp </url - pattern>
< dispatcher> REQUEST</ dispatcher>
< dispatcher> FORWARD</ dispatcher>
</filter - mapping>
〈! 一spring 监听- -〉
<listener>
< listener - class >
org.springframework.web.context.ContextLoaderListener
</listener - class>
</listener>
</web - app>

配置完以上文件,整个项目的框架就搭建好了

目录
相关文章
|
2月前
|
数据采集 SQL 数据可视化
大数据可视化技巧:借助PowerBI提升数据故事讲述力
【4月更文挑战第8天】Power BI助力大数据可视化,支持多种数据源连接,如SQL Server、Excel,提供数据清洗与转换功能。通过选择合适图表类型、运用颜色和大小强化表达,创建交互式仪表板。讲述数据故事时,注重故事主线设计,利用叙事技巧引导观众,并添加文本说明。分享已完成报告,提升数据驱动决策能力。动手实践,体验Power BI的强大与易用。
83 0
|
2月前
|
数据安全/隐私保护 Windows
刚发现的5款实用性拉满的软件
每次分享实用的软件,都会给人一种踏实和喜悦的感觉,这也是我热衷于搜集和推荐高效工具软件的原因。
38 1
|
21天前
|
监控 安全 Linux
十分好用的5款软件,实用性拉满
分享爱,分享时光,分享精彩瞬间,大家好,我是互联网的搬运工,今天继续给大家带来几款好用的软件。
22 0
|
2月前
|
前端开发 关系型数据库 定位技术
WEBGIS系统整体设计
WEBGIS系统整体设计
59 6
WEBGIS系统整体设计
|
9月前
|
存储 数据采集 数据挖掘
webGIS的功能
webGIS的功能
94 0
|
2月前
|
Linux 数据安全/隐私保护 Android开发
分享5款实用性拉满的小软件
如今,工作和学习都离不开电脑,所以电脑里的软件自然也是必不可少的,但是电脑软件那么多,不可能每个都装上吧,所以我们要装好用的、实用的,下面给大家分享5款好用到爆的软件,很多懂电脑的人都在用。
75 1
|
9月前
|
监控 前端开发 JavaScript
Webgis系统调试与发布
Webgis系统调试与发布
63 0
|
12月前
|
监控 算法 安全
转:图像识别算法在电脑屏幕监控软件中的优势与实用性
在电脑屏幕监控软件中,图像识别算法就像是一个电脑版的侦探,用着最先进的计算机视觉技术,自动监视和分析屏幕上的图像内容。图像识别算法可以轻松地识别出屏幕上的物体、文字、图案等等,不管它们是多么复杂或是隐蔽。无论你是在监控系统里还是在视频编辑软件中使用它,都会让你感觉到“嗯,这真的是太强大了!”下面就为大家简单的介绍一下图像识别算法在电脑屏幕监控软件中优势与实用性。
86 1
|
Web App开发 Linux 数据安全/隐私保护
亮个相吧小宝贝儿,五款压箱底的软件
今天要给大家推荐5款压箱底的宝贝软件了,百度搜索一下就能找到下载链接了。
128 0
亮个相吧小宝贝儿,五款压箱底的软件
收藏!5款超级好用的小工具推荐,各个都是同类软件中的翘楚
今天要给大家推荐的是5款软件,每个都是同类软件中的个中翘楚,请大家给我高调的使用起来,不用替我藏着掖着。
167 0
收藏!5款超级好用的小工具推荐,各个都是同类软件中的翘楚