丁小丰(26107513)已认领 
 

Install Documentation


Table of Contents----目录

1. Welcome

2. Installing Java

3. Installing a Servlet Container

4. Installing a Database

5. Installing GeoServer

6. Configuring GeoServer

7. Adding Data to GeoServer

8. Obtaining Test Data

9. Testing GeoServer

10. Visualizing your Data

1. Welcome

There is more help available at the Geoserver WIKI. IT IS STRONGLY RECOMMENDED YOU VISIT HERE BECAUSE USERS UPDATE THESE PAGES!

更多帮助信息请点击  Geoserver WIKI强烈推荐访问此页因为这里的信息会及时更新。

The GeoServer project is a Java implementation of the 1.0 Web Feature Server specification from the OpenGIS Consortium. GeoServer aspires to be the Apache of OpenGIS data serving and its mission is to enable greater geographic interoperability by enforcing OpenGIS standards and lowering the barriers to entry for geographic data providers.

GEOSERVER方案是来自OPENGIS CONSORTIUM1.0 WEB FEATURE 服务器型号的JAVA语言实施系统。GEOSERVER希望能发展成为OPENGIS数据服务的APACHE,其目的是通过执行OPENGIS标准让更广阔的区域能协同工作,同时减少区域数据提供者进入的障碍。

Before you can use GeoServer, you must successfully install Java, and optionally Java Servlet container such as Tomcat or Jetty. A spatially enabled database, such as the freely available PostGIS, is also recommended, but GeoServer will work with Shapefiles. This is by far the hardest part of the installation process, but the documentation to install these components is quite good. Our testing has occurred on JDK 1.4.1 or 1.4.2, Tomcat 5.0.19, Resin 2.1.13 or Jetty 4.1.27, and PostGIS 0.8.1 with GEOS on top of Postgresql 7.4. The latest stable versions of these components should work fine. This document assumes you are working with the downloaded geoserver.war file. If you wish to work with the source download please consult the developers build document

在使用GEOSERVER之前,请先成功安装JAVA, 可以随意选择JAVA SERVLET 容器,例如TOMCAT 或者JETTY。我们也推荐空间激活数据库,例如免费提供的POSTGIS, 但是GEOSERVER 将同SHAPEFILES一起运行。到目前为止这是安装程序中最难的一部分,但是安装这些零件的文件却是好的。我们的测试可以在JDK1.4.1或者1.4.2TOMCAT 5.0.19, RESIN 2.1.13或者JETTY 4.1.27,或者在POSTGRESQ17.4的顶端上的带有GEOSPPOSTGIS0.8.1上运行,这些组成部分的最新稳定的版本可以很好的运行。这个文件可以让您觉得是在下载的GEOSERVER.WAR文件下工作。如果您希望在下载的信息资源处工作,请与文件的开发商联系。

 

GeoServer has an active user community that you can engage by joining the GeoServer mailing list and asking questions or making suggestions. If you create a user account at this site, you may participate in forums and vote in polls as well. We also strongly encourage you to submit bugs and improvements you would like to see to our tracker, as the only way we can improve GeoServer is with your feedback. You will have to create an account to use it, but your email address will not be used except to notify you when your issue is worked on.

GEOSERVER 有一个活跃的用户集团,您可以通过加入GEOSERVERMAILING LIST这样的方式来参加这个集团,也可以询问问题或者提供建议。如果您在这个网页上建立一个用户帐号,您可以参加论坛,也可以进行投票。同时我们也非常鼓励您向我们指出程序中的错误和提高的建议,详细情况请见我们的TRACKER,因为我们能提高GEOSERVER的唯一途径就是您的反馈信息。您需要创建一个帐号以便您的使用,但是不会用到您的邮箱地址,除了通知您的ISSUE正在运行或使用中。

2. Installing Java

GeoServer is built against the JDK1.4. If you do not have the JDK1.4 installed on your machine, you should download it from Sun and point to the root install directory with the JAVA_HOME environment variable (set JAVA_HOME = C:\j2sdk1.4.2). Most of our testing occurred against JDK1.4.2. If your not sure if you have java, or not sure what version, type java -version from the command line. If the command doesn't work or if the version is less than 1.4 then you'll have to download, install, and set JAVA_HOME.  If you wish to use the visualization portion of GeoServer we recommend you install the Java Advanced Imaging API, which can be downloaded here.

GEOSERVER支持(against意为反对,应该是不支持,但翻译为不支持与后面句意不符合)JDK1.4。如果您的电脑上没有安装JDK1.4, 您应该从SUN处下载,并且在可变的JAVA_HOME环境下指向根目录安装(set JAVA_HOME = C:\j2sdk1.4.2)。目前我们大部分测试系统不支持JDK1.4.2。如果您不确认是否已经安装JAVA, 或者不确认哪个版本,您可以从命令栏测试JAVA版本。如果命令栏不运行或者版本低于1.4,您不得不下载安装运行JAVA_HOME。如果您希望应用GEOSERVER的可见部分,我们建议您安装JAVA ADVANCED IMAGING, (API) API可以在这里下载。

3. Installing a Servlet Container

If you downloaded the binary (geoserver-1.3.*-bin.zip) or windows (.exe) release of GeoServer you do not need to install a servlet container, as GeoServer now includes an embedded Jetty servlet container. But if you want to use your servlet container then the war install works just fine.

如果您已经下载二进制(GEOSERVER-1.3*-BIN.ZIP)或者WINDOWS版本的GEOSERVER, 则没有必要安装SERVLET 容器, 因为GEOSERVER现在包含一个嵌入式的JETTY SERVLET 容器。但是如果您想用您自己的SERVLET 容器, 那么文件目录安装可以很好的运行。

Several good open source, free servlet containers and a bevy of commercial ones exist on the market. We recommend Jetty (open source, free) or Tomcat (open source, free). Most GeoServer testing has occurred on Tomcat 5, which is remarkably simple to set up and administer.. The servlet containers should have good documentation, so we shall say nothing further here about the install. We do recommend sticking with the latest stable versions. For more information on GeoServer working with specific containers see our Servlet Container Reports, and please add additional feedback to the page (it's a wiki).

目前市场上存在的是一些质量不错的公开的信息源(SOURCE),免费的DERVLET容器以及一系列商业性质的信息源。我们推荐JETTY(免费公开资源)TOMCAT (免费公开资源)。大部分GEOSERVER测试系统已经安装在TOMCAT 5上,TOMCAT 5是比较容易安装和管理的。SERVLET应该有比较好的文件说明,因此在这里我们不再对安装做进一步解释,并向您强烈推荐使用最新的稳定的版本。关于GEOSERVER在特定容器下运行的更多信息,请详见我们的SERVLET CONTAINER REPORTS (SERVLET容器报告),同时请在我们的网页上留下您的反馈信息(这是WIKI)。

4. Installing a Database安装一个数据库

The GeoServer project currently supports the Oracle, ArcSDE and Shapefile data formats, but unless you already have a running Oracle or ArcSDE installation we recommend PostGIS, an excellent extension of the venerable Postgresql relational database. PostGIS and Postgresql are open source databases that are free to all users. Postgresql was developed at Berkeley several years ago and PostGIS is a recent extension developed by the clever programmers at Refractions Research.

GeoServer目前支持的数据格式有 Oracle, ArcSDE Shapefile, 如果您没有安装运行Oracle 或者 ArcSDE, 我们推荐您安装PostGIS,这个数据库和Postgresql密切相关,同时又是PostGIS的优秀拓展。PostGIS Postgresql目前对所有的用户都是免费的。Postgresql是几年前由Berkeley开发的,而PostGIS则是最近由聪明的程序员在Refractions Research里开发的。

 

If you'd just like to get an installation up and running quickly, and don't care so much about advanced features and speed, then we recommend the Shapefile format, with installation information here. If you have an existing Oracle spatial or ArcSDE installation, and would like to use GeoServer to serve that data as GML, then check out the install information here. Be sure to fully read this installation document before trying out Oracle, ArcSDE or Shapefile DataStores, even if you are not going to use PostGIS.

如果您只是想得到安装程序并且快速运行,而不怎么考虑先进性能和速度,我们向您推荐Shapefile格式,详细安装信息,请点击 这里。如果您现在拥有ORACLE空间或者 ARCSDE 安装程序,您想用GEOSERVER来支持诸如GML之类的数据,请点击 这里 参阅安装详情。提示您在尝试安装 ORACLE,ARCSDE 或者SHAPEFILE DATESTORES之前请一定详细阅读本安装文件说明,即使您不打算使用POSTGIS.

 

Installing Postgresql and PostGIS is the most complicated part of setting up a GeoServer site and for this reason, we will supplement the documentation to do so a little here. First, you should download the full source of Postgresql. Binaries, RPMs, and other packaged builds will generally not suffice because you will need to compile the PostGIS extension and JDBC bindings into Postgresql in order for it to correctly speak with GeoServer.

安装POSTGRESQLPOSTGIS是安装GEOSERVER 中最复杂的一部分。鉴于这个原因,我们在此将补充部分文件。首先,必须下载全部的POSTGRESQL安装信息;其次,RPMS和其他打包文件一般不支持因为您需要汇编POSTGIS外延和JDBC捆绑到POSTGRESQL 以便能与GEOSERVER恰当相配。

First, download Postgresql - we have had the best luck with version 7.4. You should configure and install it, per the installation instructions. It should go something like this:

第一,下载POSTGRESQL-我们很高兴拥有7.4版本。建议您也应该下载和安装此版本。详细安装指示如下所示:

./configure
gmake
gmake install

Configuring with Java is no longer required, as we supply the JDBC jar with the installation. Be sure that it is up and running, it's best to create a database and test it using psql from the command line. Then, download PostGIS. You should place PostGIS in your Postgresql 'contrib' directory, change to the postgresql root directory and follow the directions for installation there. We highly recommend installing PostGIS 0.8 with GEOS, as it will greatly speed up spatial queries. If installing GEOS be sure to read all the directions for it and PostGIS, as you have to configure your postgresql installation to make use of it.

我们现在可以提供JDBC JAR安装,因此没有必要一定要使用JAVA. 请确信JDBC JAR已经安装并且可以运行,最好能建立一个数据库并且使用来自命令栏的PSQL进行测试。第二,下载POSTGIS, 请将POSTGIS 放在POSTGRESQL CONTRIB 目录栏,变成POSTGRESQL 根目录,并遵循那里(THERE)的安装指示。在此我们向您强烈推荐安装GEOS POSTGIS 0.8,因为它会极大的加速空间询问(QUERIES)。如果安装GEOS,请阅读所有安装指示和POSTGIS,因为您必须设置POSTGRESQL安装程序以便能够利用。

You should, of course, check to make sure that Postgresql and PostGIS are functioning correctly before you attempt to connect with then using GeoServer. After installing PostGIS attempt to create tables with geometry columns, and insert a few features. If you are a windows user a good page on installing PostGIS is available here. You can also try out the PostGIS installer on the dcmms sourceforge project, which we've had success with as well. When starting PostGIS be sure to run it with the -i option to allow other applications (i.e. GeoServer) to connect to it.

当然,在链接POSTGRESQLPOSTGIS之前,您必须确保他们都能正确运转,然后才能使用GEOSERVER. 安装POSTGIS之后,尽量用几何学中的圆柱原理(columns)建造桌面(TABLE,同时插入一些特性描述。如果您是WINDOWS用户,这里是一个安装POSTGIS的好地址。同时您也可以尝试这里:DCMMS SOURCEFORGE PROJECT, 同样我们也成功的试验过。在开始使用POSTGIS之前,请确认用-I 优先权运行以准许其他软件(如GEOSERVER)可以与其进行链接。

5. Installing GeoServer

Move the distributed geoserver.war to the war file directory of your Java Servlet container (generally named 'webapps'). If you have an existing GeoServer installation on your machine, you should backup your old geoserver/ directory before moving the new .war file. You may run a simple test by starting your container and entering this address:

将分散的GEOSERVER.WAR移到您JAVA SERVLET 容器(通常命名为WEBAPPS)中的文件目录下。如果您目前拥有可以运行的GEOSERVER安装程序,在移动新的文件目录之前请将原来的GEOSERVER/目录备份。请输入如下地址进行简单的测试:

http://SERVER_ADDRESS:SERVER_PORT/geoserver/wfs/GetCapabilities

Note that SERVER_ADDRESS and SERVER_PORT should be replaced by your server's address and port (local host:8080 will suffice for the default of tomcat or resin running on your local machine). If GeoServer is running, you should see an WFS capabilities document. If you get nothing, then you should consult your server documentation to see what has gone wrong. Some modern browser may give a warning like:

请注意用您服务器的地址和端口(当地主机:当地机器8080可以弥补猫(TOMCAT)和树脂的不足)代替SERVER-ADDRESSSERVER-PORT。如果GEOSERVER正在运行,您应该可以看到一个WFS 容量文件。如果看不到,您需要查看您的服务器文件以查看问题。许多现代的浏览器可能会提供如下警告:

This XML file does not appear to have any style information associated with it. 没有任何类型信息与这个XML文件相关联。
The document tree is shown below. 文件树展示如下。

This is not an error, it is just an indication that the document is pure XML, without a style sheet associated, which is how a WFS should respond. If a geoserver directory has not been created automatically by your server, then your server is probably not behaving as it should.

这不代表错误,只是表明这个文件是纯粹的XML文件格式, 没有与其他文件相连,这是WFS应有的反映。如果您的服务器不能自动创建GEOSERVER目录,说明您的服务器可能没有正常运转。

6. Configuring GeoServer    设置 GEOSERVER

GeoServer now includes a web based tool to configure and administer the application. It is available at the root web directory (http://localhost:8080/geoserver). The initial log in is user name: 'admin' and password: 'geoserver'. After logging in you should change the user name and password, at Config -> Server -> Password. More information on using the web admin tool can be found in the pdf user guides. Also note that help text will pop up if you place your mouse over the fields.

GEOSERVER目前包括一个网站,这个网站以设置和管理应用软件工具为基础。在根网站目录(……)中提供。原始用户名和密码分别为ADMINGEOSERVER, 登陆以后,请在CONFIG->SERVER->PASSWORD下更改用户名和密码。关于网站管理工具应用的更多信息请详见PDF用户指南。同时请注意如果将鼠标放在FIELDS上会显示帮助文本。

After logging in and changing the password the next step is to click on the configure link. This is the central place to configure GeoServer. You should work through each of the four categories, first setting your contact information and global values in Server, and then the WMS and WFS specific descriptions and contents. Contents will allow you to enable or disable each Service and WFS will also let you specify the transaction level - that is if users should be able to access the transaction operations.

登陆并更改密码后,下一步请点击设置链接。这是设置GEOSERVER的中心位置。请分别填写四类信息,首先在服务器上设定您的联系信息和全球评价(GLOBAL VALUES),然后是WMSWFS详细的描述和内容。内容将准许您或不准许您享受每项服务,WFS可以让您详细描述处理水平-就是说用户是否可以访问处理操作。

Be sure to always hit the submit button, and to then test your changes in GeoServer hit 'Apply' on the right. The changes you put in will take effect immediately. If you like the changes then hit 'Save' and they will be stored to disk permanently. If you do not like the changes you can roll back to the last saved ones by hitting 'Load'.

请确认点击提交键,然后点击右边的申请(APPLY)键以测试您在GEOSERVER里内容的修改。修改内容将即时生效。如果您想保存这些修改,请点击保存键,这些修改信息将永久保存在硬盘里。如果不想保存这些修改,请点击LOAD键,将返回到上一次的信息状态。

If you want to avoid the web admin tool then directly editing the files shall work just as well. Your work flow will just be a bit different, you will work from the source tree and rebuild the war after you have changed the options. If you choose to use the web administration interface you can skip the next section, but read up on the options that follow, as they are in the administration tool as well.

如果您想避开网站管理工具,也可以直接编辑文档。只是您的工作量稍有不同而已,改变选择权(OPTIONS)后,您需要从信息树(TREE)处开始操作,重新建立文件目录。如果您选择使用网站管理平台,您可以跳过下一部分。请阅读所有选择权,因为他们也会在管理工具中出现。

This section assumes at least passing familiarity with XML files. However, if you simply follow the test file example exactly, you should be able to create a working configuration file. The services.xml file resides at geoserver/WEB-INF. You should edit this file, and changes will be picked up when you run <i>ant war</i>. This sets the global configuration options for your server as well as the service elements of the WMS and WFS services. An example services.xml is shown here:

假设这部分至少与XML文件有相似之处。然而,如果您只是简单的按照测试文件范例,您应该建立一个工作结构。ERVICES.XML文件位于GEOSERVER/WEB-INF中。请编辑这个文件,当您运行<i></i>时这些修改都会被保存。这样为您的服务器设置以及WMSWFS的组成部分建立全球结构优先权。SERVICES.XML范例请见如下:

<?xml version="1.0" encoding="UTF-8" ?>
<serverConfiguration>
  <global>
    <loggingLevel>FINE</loggingLevel>
    <verbose value="true">
  </global>
  <services>
    <service type="WFS" enabled="true">
      <name>GeoServer</name>
      <title>The TOPP Basemap Server</title>
      <abstract>This is a test server. It contains some basemap data from New York City.</abstract>
      <keywords><keyword>New York</keyword><keyword>transportation</keyword></keywords>
      <onlineResource>http://beta.vfny.org/geoserver</onlineResource>  
      <maintainer>Vision for New York</maintainer>
      <gmlPrefixing value="true"/>
      <serviceLevel value="2"/>
    </service
  </services>
  <namespace default="true" uri="http://www.openplans.org/topp" prefix="topp"/>
  <namespace uri="http://www.opengis.net/cite/data" prefix="cdf"/>
</serverConfiguration>

You should modify the values between the tags only. All values are defined below:

请只修改标记间的数值。所有的数值定义如下:

Option Name

Description

Logging Level

How much ou put should go to the logs, one of: SEVERE, WARNING, INFO, CONFIG, FINER, FINEST

URL

The base url where geoserver will be available. If just testing on a local machine localhost should be fine. This is used in the capabilities document, which reports to clients the entry points for accessing features.

verbose

true if the xml returned should have human readable formatting

name

This is the name of your server and is arbitrary.

title

This is the title of the server and is arbitrary

abstract

This is a brief description of what your server does and is arbitrary.

keywords

A series of comma seperated keywords, describing the data and purpose of the server.

onlineResource

A unique url where information for this server resides. Even if you have no real online source it is important to put something here, for default namespace surfaces. It is fine to use the same url as the URL element.

maintainer

The name of the maintainer for this server.

gmlPrefixing

true when GML prefixing is required.

serviceLevel

The service level, 1 is basic, 2 is transactional.

For more configuration options, check the Advanced section.

更多设置选择,请查看ADVANCED部分。

7. Adding Data to GeoServer

To add new data to GeoServer go to Config -> Data. You should first define the GML name space that your features should occur in. This distinguishes your features from others on the Internet. This is not necessary if you are only working with the WMS. Defining a namespace as the 'default' allows you to request featureTypes without prepending the namespace prefix, but is not used for much else.

要在GEOSERVER上添加新数据,请进入CONFIG->DATA 首先请详细说明您GML的命名空间可能会出现的特性,用来在互联网上区别于其他用户。如果您只是单纯的用WMS工作则没有必要这么做。如果以“DEFAULT”定义一个命名空间,您将可以直接使用特征类型,而不用预先考虑命名空间的前缀。但不能作为其他使用。

Next you need to create a Data Store. This is the GeoServer terminology for the source of data. It can be a database or a file, and can contain one or more Feature Types (Layers in WMS terms). In a database each table is a FeatureType. To define a new DataStore click on the 'Stores' button, select the type from the list and input the appropriate parameters. Note that you must pick one namespace for each DataStore. If you really want different featureTypes in the same DataStore to be in different name spaces you can get around this by defining two DataStores with the same parameters and different names and name spaces.

下一步您需要建立一个数据储蓄库, 这是数据信息的GEOSERVER 术语。可以是一个数据库或者是一个文件,能包含一个和多个特征类型(FEATURE TYPES)WMS术语中的阶层)。在一个数据库中每个桌面都是一个特征类型。如果您想定义一个新的数据储蓄库, 请点击“储蓄“按钮,从列表中选择类型并输入恰当的标题。请注意您必须为每个数据储蓄库选择一个命名空间。如果您确实想在相同的数据储蓄库中拥有不同的特征类型,可以用相同的标题,不同的名称和不同的命名空间来命名两个数据储蓄库。

After creating the DataStore you may upload SLD files to serve as the Styles for GeoServer's WMS. For more on SLD see the specification. GeoServer is working to become a true SLD-WMS, but for now the SLD files must be uploaded and defined using the web administration interface. If the WMS is not needed then no additional styles are needed.

建立数据储存库以后,您可以上传SLD文件用来支持GEOSERVER’S WMS之类的文件类型。更多SLD信息,请见SPECIFICATION GEOSERVER 的运转将成为真正的SLD-WMS, 但是现在SLD文件必须通过网站管理平台上传和命名。如果不需要WMS, 那么附加类型也没有必要。

Finally you should create the appropriate FeatureTypes. Hitting the 'New' button will generate a list of all the featureTypes in all the DataStores, in the format DataStoreID::FeatureTypeName. Pick the featureType to create, and then edit the meta information. If deploying GeoServer it is important to fill out this information accurately, as it appears in the capabilities document, which gives clients about the data available. The 'generate' button currently only works if the data itself is stored in Lat Long (EPSG:4326 - which you should set for the SRS if your data is in Lat Long). Soon we will support transformation from the Spatial Reference System specified into Lat Long.

最后请建立恰当的特征类型。点击“NEW”按钮将会在所有数据储存库中产生一列特征类型,位于数据储存库ID格式中:特征类型名字。点击类型特征建立然后编辑META信息。如果配置GEOSERVER, 准确填写这些信息变得非常重要,因为这些信息将在容量文件中出现,这将为客户提供数据信息。目前“建立”(GENERATE)按钮只有当数据本身存储在LAT LONG (EPSG: 4326-如果您的数据位于LAT LONG中,您应该为SRS安装EPSG)当中时才会运行。稍后我们会支持来自空间参考系统的关于LAT LONG的详细转换信息。

After hitting submit you should be able to hit 'Apply', and then the GetCapabilities request given earlier should include your newly added FeatureType. If you are just working with the web interface, you can skip to the next section (the file information will soon be ported to the developers documentation), though some of the tables may prove helpful.

点击提交键后,您可以点击申请键,先前提供的GETCAPABILITIES请求将会包含您新加入的类型特征。如果您只是利用网站平台操作,可以直接跳到下一部分(文件信息将会快速传达给开发者的文件中),尽管很多步骤(TABLES)可能证明是有用的。

 

If working with files, data to geoserver is now centralized in the catalog.xml file, located in geoserver/WEB-INF. This file can be thought of as the central place for data in GeoServer. It contains the connection parameters to various DataStores, as well as style and namespace information. In older versions of GeoServer each featureType's info.xml file contained connection parameters, but this lead to a lot of duplication as many featureTypes are often contained in a single database. So now each featureType just references a DataStore defined in the catalog.xml file. The following sample catalog.xml file is for a PostGIS DataStore, as it is the most solid one that GeoServer supports. Shapefile, Oracle and ArcSDE DataStores are also available in various degrees of maturity; click on the hyper links for more information.

如果在文件下工作,GEOSERVER的数据目前集中在目录.XML文件中,此文件位于GEOSERVER/WEB-INF中。这个文件可以作为GEOSERVER里数据的中心位置。它包含了各种数据储蓄库的关系参数,类型记忆命名空间信息。在旧的GEOSERVER版本中,每个类型特征的INFO.XML文件都包含关系参数,但是这往往引起重复因为很多类型特征经常被包含在一个单独的数据库中。因此现在每个类型特征只代表一个在CATALOG.XML文件中被定义的数据储存库,因为这是GEOSERVER最为支持的一个。在不同成熟程度上也提供SHAPEFILE, ORACLEARCSDE 数据储存库,更多信息请点击HYPER

 <?xml version="1.0" encoding="UTF-8" ?>
<catalog>
  <!-- defines the datastores, more than one is possible -->
  <datastores>
    <datastore id="local.postgis" enabled="true" namespace="topp">
      <connectionParams>
        <parameter name="host" value="localhost"/>
        <parameter name="port" value="5432"/>
        <parameter name="database" value="testdb"/>
        <parameter name="user" value="testuser"/>
        <parameter name="passwd" value="pass"/>
        <parameter name="dbtype" value="postgis"/>
      </connectionParams>
    </datastore>
  </datastores>
 
  <!--defines the namespaces, should have at least a default -->
  <namespaces>
    <namespace default="true" uri="http://www.openplans.org/topp" prefix="topp"/> 
    <namespace uri="http://www.opengis.net/cite/data" prefix="cdf"/>
  </namespaces>
 </catalog>

This file defines a DataStore, that featureTypes will reference using its local.postgis id. The namespace attribute references the prefix of the topp namespace defined below. The enabled attribute is used to 'turn off' the DataStore, featureTypes referencing it will not be accessible to users. The connection Params for PostGIS should be as follows:

这个文件定义一个数据储存库,类型特征将推荐使用LOCAL.POSTGIS ID 命名空间将归结于TOPP命名空间的前缀参考,定义如下。激活的特性将用来关闭数据储存库,与之相关的类型特征对用户来说是很难理解的。与POSTGIS相连的PARAMS应该如下所述:

Option Name

Description

dbtype

Must be 'PostGIS' for a PostGIS DataStore.

必须是POSTGIS数据储存库的POSTGIS

host

Must match the PostGIS postmaster daemon URI exactly, port excluded. Can be a number or name – local host or 127.0.0.1 if PostGIS is on the same machine as geoserver, if not it can reference the ip address or host name.

必须与POSTGIS POSTMASTER DAEMON URI准确相配。可以是一个数字或者名字-如果POSTGISGEOSERVER 在同一个机器上,用当地主机或者127.0.0.1;如果不是,可以参考IP地址或者主机名字。

port

Must match the PostGIS postmaster daemon port exactly (generally 5432).

必须与POSTGIS POSTMASTER DAEMON PORT准确相配。(一般5432

database

Must match the PostGIS database name exactly.

必须与POSTGIS数据库名字准确相配。

user

Must match the PostGIS database user exactly.

必须与POSTGIS数据库用户准确相配。

passwd

Must match the PostGIS database user password exactly.

必须与POSTGIS数据库用户密码准确相配。

The namespace element should have a uri attribute, which just needs to be unique, it does not have to actually reference anything. Each prefix should be unique as well, as it is used internally by geoserver. The default value indicates which namespace will be used if a user asks for a typeName without specifying its namespace. It should generally be sufficient to just define one namespace, as the default, and to use it for all DataStores. If two featureTypes need to be in different namespaces but share the same DataStore then the easy solution is to just define two DataStores with the same connectionParams but different ids and namespaces.

命名空间的组成部分应该有一个URI特征,这个特征只需要是唯一的就可以,不用参考任何实际的东西。每个前缀都必须也是唯一的,因为这些前缀将在GEOSERVER的内部用到。如果一个用户请求一个特征名字而没有说明命名空间,那么默认的数值将标明哪个命名空间将会被用到。作为默认数值,通常只要定义一个命名空间就可以让所有的数据储存库使用。如果两个类型特征需要用不同的命名空间来分享相同的数据储存库,最简单的解决方法就是用相同的关联PARAMS,不同的IDS和命名空间来定义两个数据储存库。

 

 

 

Once catalog.xml is set up then individual featureTypes contained in the DataStores need to be configured. Each featureType gets its own directory in conf/featureTypes. The general convention is to name each directory has the same name as the featureType contained in it, but it does not matter. If two featureTypes have the same name then the namespace prefix should be appended (as two with different names must be in different namespaces). So if we have a featureType named rail, it should have a directory geoserver/conf/featureTypes/rail. In this directory there is one required file, info.xml, which contains a reference to the DataStore and meta information about the featureType. The meta information is only used in the returned Capabilities document, name and DataStore are the only values that affect the running of GeoServer. It looks like this:

一旦建立CATALOG.XML,需要设置包含在数据储存库里的单独的类型特征。每个类型特征在CONF/FEATURE TYPES中拥有其自己的目录。常见的惯例是指定每个目录拥有和包含在里面的特征类型相同的名字,但这个无关紧要。如果两个类型特征拥有相同的名字,那应该再附加命名空间前缀(因为两个不同的名字必须在不同的命名空间内)。因此如果我们有一个名字为RAIL类型特征,必须有一个目录如geoserver/conf/featureTypes/rail。在这个目录里有一个要求的文件,INFO.XML, 在这里包含数据储蓄库的参考和关于类型特征的META信息。META信息只在返回的容量文件中使用,名字和数据储蓄库是影响GEOSERVER运行的唯一数值。详情如下:

<?xml version="1.0" encoding="UTF-8" ?>
<featureType DataStore="local.postgis">
    <name>rail</name>
    <title>NYC Rail Centerlines</title>
    <abstract>This is a simple rail coverage from the New York City basemap.</abstract>
    <keywords>rail, railroad, World Trade Center, New York City</keywords>
    <SRS>32118</SRS>
    <latLonBoundingBox minx="-74.27000" miny="40.50000" maxx="-73.80000" maxy="40.94000" />
    <styles default="normal"/>
</featureType>

Option Name

Description

DataStore

Must reference a DataStore that contains the featureType of name.

必须参照包含冷行特征名字的数据储蓄库。

name

The name of the featureType. Must be in the referenced DataStore. For example in PostGIS it must refer to a table in the database of local.postgis.

类型特征的名字。必须在参照的数据储蓄库中。比如在POSTGIS中,必须涉及在当地POSTGIS的数据库中的一个桌面。

abstract

A brief description of what the featureType represents.

关于类型特征的简单描述。

keywords

Words to search that represent the featureType, reported in

描述类型特征的调查,报告

styles

The default style for this feature type. 类型特征的默认格式。

SRS

The EPSG code of the spatial reference system of this featureType. Other SRS's are not yet supported.

类型特征的空间参考系统的EPSG编码。不支持其他SRS系统。

latLonBoundingBox

The bounding box in LatLon coordinates.

LATLON中的捆绑盒。

There is also an optional file called schema.xml. In past versions this was required, it is a fragment of the GML schema of the featureType, returned by Describe FeatureType. As of 1.1.0 the schema.xml file is only needed if a more precise schema is needed. If the file is not present then GeoServer will automatically generate the schema for DescribeFeatureType responses - this should be sufficient for most users.

也有一个可供选择的文件名为SCHEMA.XML。旧的版本要求这个文件,市类型特征的GML SCHEMA的一个片断,由描述性的类型特征返回。只有当需要更精确的SCHEMA时,才会用到1.1.0SCHEMA.XML文件。如果没有这个文件存在,那GEOSERVER将会自动为描述性类型文件创立计划-对大多数用户来说这样已经足够。

8. Obtaining Test Data

The easiest way to get some PostGIS data to work with is to acquire shapefiles and use the shp2pgsql utility provided by PostGIS. It should be in your pgsql installation directory, under the bin subdirectory. As for acquiring shapefiles, the US census provides a lot of their data free of cost in the shape format, available here. The GeoServer also includes support for using shapefiles directly, information about this option is available in the advanced section. Using the shapefiles directly sacrifices a lot of speed and flexibility, so converting them to PostGIS is the recommended way, but the option is available for easier set up.

拥有POSTGIS数据的最简单的方法是获得SHAPEFILES和使用由POSTGIS提供的SHP2PGSQL。它应该在您的PGSQL安装目录,位于BIN目录下。关于获得SHAPEFILES, 美国人口普查提供了很多关于形态格式的免费数据,请点击这里。GEOSERVER也包含了直接使用SHAPEFILES的支持信息,详情请见ADVANCED部分。直接使用SHAPEFILES在速度和灵活性上会收到限制,因此建议您将他们转向POSTGIS,但是以易于安装为悠闲选择权。

9. Testing GeoServer――测试GEOSERVER

Testing GeoServer can be done with any standard web browser. The easiest way is to use URL encoded Key Value pairs. If GeoServer is running on the same machine as the web browser, say on a tomcat instance running on port 8080, then the Capabilities document can be tested by just typing in the location:

任何符合标准的网络浏览器都可以进行GEOSERVER测试。最简单的方法就是使用由KEY 数值PAIRS解密的RUL。如果GEOSERVER和网络浏览器在相同的机器上运行,即比如在PORT 8080上运行,那么只要打印特定区域里就可以进行容量文件的测试:

http://localhost:8080/geoserver/wfs?request=GetCapabilities, for example, or http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:rail.

The WFS specification has more information on KVP encoding. It is good for basic requests, but it falls short with more complex filters and transactions. For that we recommend using XML encoding.

WFS规格拥有关于KVP解密的更多信息。对基本的要求来说这是好的,但是对更多的复杂的筛选和传输来说还是有所欠缺的。建于此我们推荐使用XML解密。

The latest release of GeoServer also includes a great testing utility for XML post requests. It is available at http://SERVER_ADDRESS:SERVER_PORT/geoserver/wfs/TestWfsPost. There are also a number of samples in the Demo section of the web administration tool. To use of the TestWfsPost servlet just make sure that the request is going to the right location (it defaults to GetFeature), and write the XML request just as the WFS specification does it.

XML POST请求来说,GEOSERVER的最新版本也包含了一个高级的测试系统。详情请见http://SERVER_ADDRESS:SERVER_PORT/geoserver/wfs/TestWfsPost. 在网页管理工具的DEMO部分也有很多例子。使用TESTWFSPOST SERVLET, 只要确认请求被发往准确的位置(默认为GETFEATURE),写下XML请求如同WFS规格一样。

The web administration tool also now includes a 'Demo' section, which has a number of sample requests. To issue one of the sample request use the pull down request box, select one and hit the 'Change' button. Unfortunately we haven't yet figured out javascript within jsps and struts, or we would have it change automatically. After hitting change then hit 'Submit', and GeoServer will return the request. You may modify the requests to work with your server. And you may even put your own requests in the geoserver/data/demo directory. These requests make a great reference for how to make WFS and WMS requests. And please let us know if you feel any important ones are missing, and we can easily add them for the next release.

网页管理工具也包含DEMO部分,也拥有很多实例请求。发布一条实例请求请使用降低请求箱,选择其中一个点击“改变”按钮。不幸的是我们目前还没有在GSPS AND STRUTS中规划出JAVASCRIPT,不然我们可以自动改变它。点击改变按钮后请点击“提交”按钮,GEOSERVER 将返回请求。您可以修改请求以与您的服务器保持一致。您也可以在GEOSERVER/数据/DEMO目录下键入您自己的请求。这些请求对如何建立WFSWMS请求将起到很大参考作用。如果您发现遗漏了任何重要部分,请及时告诉我们,我们会在下一版本中添加遗漏的部分。

For those who do not wish to use the Demo web interface, included is a set of links for the default dataset distributed with GeoServer.

对于不想使用DEMO网页平台的用户来说,请参照一系列由GEOSERVER颁布的默认的最新版本的链接。

·         ·         http://localhost:8080/geoserver/wfs/GetCapabilities

·         ·         http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:bc_roads

·         ·         http://localhost:8080/geoserver/wfs/GetFeature?typeName=topp:bc_roads

·         ·         http://localhost:8080/geoserver/wms/GetCapabilities

·         ·         http://localhost:8080/geoserver/wms?request=GetMap&layers=topp:bc_roads&bbox=489153,5433000,529000,5460816&width=400&height=200&srs=EPSG:27354&styles=normal&Format=image/svg-xml

10. Visualizing your Data

GeoServer includes an integrated Web Map Service (WMS). For more information about setting it up see WMS section. But using the web administration interface should be pretty self explanatory, just make sure that you have Java Advanced Imaging (JAI) installed, it can be downloaded here and the Image I/O extension here. The trickiest part is figuring out the correct GetMap request to issue to the WMS. A sample request is as follows:

GEOSERVER包含一套完整的环球地图服务(WMS)。更多安装信息,请查看WMS部分。但是使用环球管理平台必须带有详细的自我说明,以此确保您已经安装JAI系统,JAI系统可以在这里下载,IMAGE I/O的延伸请见这里。其中最难的部分就是汇总出与WMS相符合的正确的GETMAP请求。详细实例如下:

To adapt it to your data the two parameters to change are 'layers' and 'bbox'. The layers param should be changed to the FeatureType that you successfully added to GeoServer. Do a GetCapabilities request:

将以上信息应用于您的数据,需要改变的两个参数是LAYERSBBOXLAYERS 参数应该变成您已经成功添加到GEOSERVER里的特征类型。GETCAPABILITIES请求如下:

 

Your feature Type should show up as one of the layers there. The name there should be the one used to use in the layers param of the GetMap request. If the Capabilities document does not contain it then try adding it again. If it does the next thing to do is to obtain the bounding box for the feature. The easiest way to do this is to issue a GetFeature request to the wfs using your featureType, for example:

您的特征类型应该表现为一个层面。名字应该就是用在GETMAP请求层面中的名字。如果容量文件不包含这个名字,请再次添加。如果包含这个名字,下一步则是给特征(FEATURE)取得捆绑盒。最简单的方法就是用您的特征类型向WFS发布一个GETFEATURE 请求。例如:

The response is a FeatureCollection, which will include a bounded By element as follows:

反应是一个特征集合,包含一个捆绑元素,内容如下:

 <gml:boundedBy>
   <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#27354">
    <gml:coordinates decimal="." cs="," ts=" ">
        -73.933217,40.78587 -73.768722,40.914404
    </gml:coordinates>
   </gml:Box>
</gml:boundedBy>

These values will be the boundingBox of all data in the featureType. If you have a very large table then you may want to not use the full bounding box, but this should give a good guideline of where the features are actually contained. The coordinates values can be used almost directly in the bbox param - you just need to make sure to change the middle space to a comma. Currently the srs param is ignored, GeoServer simply returns data as it is stored. Future versions wil do coordinate transformation based on the srs parameter. You can also change the other params to adjust the format, height and width of the image returned, as well as the style, if you have properly added the SLD files. So the final request for my_data will look like this:

这些数值在特征类型中将成为所有数据的捆绑框。如果您拥有一个很大的桌面,您也许不想使用整个捆绑框,但是必须明确标明特征的具体位置。坐标数值可以直接应用在BBOX PARAM中-您只需要确认将中间空间改成逗号。目前SRS PARAM通常是被忽视的,GEOSERVER通常可以简单的返还它所包含的数据。类型版本会根据SRS参数而调整转换。您也可以改变其他参数来调整格式,高度和宽度,以及风格,如果您已经正确的添加了SLD文件。因此我的数据的最终请求将如下所示:


欢迎大家转载收藏,但是请在转载页面明确标明本文章有丁晓峰先生翻译,转载来源等,并请在本页面留言注明。谢谢。 

posted on 2005-11-11 18:32 刘民 阅读(...) 评论(...) 编辑 收藏