Configure the development environment of geoserver, openlayers, and PostgreSQL

Source: Internet
Author: User
Tags postgis
1. Preparations

(1) PostgreSQL http://www.postgresql.org/

2) geoserver http://geoserver.org/display/GEOS/Download

3) openlayers http://trac.openlayers.org/wiki/HowToDownload

4) JDK http://java.sun.com/javase/downloads/index.jsp

5) Tomcat http://tomcat.apache.org/download-60.cgi


2. JDK environment Configuration

Set in system variables:

Classpath.; C: \ Program Files \ Java \ JDK 1.6.0 _ 10 \ Lib \ tools. Jar
Java_home c: \ Program Files \ Java \ jdk1.6.0 _ 10
Path c: \ Program Files \ Java \ jdk1.6.0 _ 10 \ bin;

Modify the installation path and version accordingly.


3. Summary of steps for PostgreSQL to install and install postgis and use postgis to import shapefile

1) run the installation file and follow the Wizard to install it.

2) After the installation is complete, the system prompts whether to configure Application Stack builder. check and confirm.

3) in the stack builder wizard, select PostgreSQL 8.3 on port 5432 and click Next.

4) Select the application you want to install in the Application List, here you must check the postgis-pg83-setup- 1.3

. 5 -1.exe

5) Next, select the download server and install the corresponding application after the download is complete.

6) during installation, you must set a password in either of the two fields. Do not set the password to null.

"Error opening file for writing:
C: \ Program Files \ PostgreSQL \ 8.3 \ bin \ libiconv-2.dll "prompt, here we can ignore it

4. Import shapefile data to postgis

1) Run pgadmin III, enter the password, and log on

2. Run cmd.exe and switch it to the directory c: \ ProgramFiles \ PostgreSQL \ 8.3 \ bin.

3) First, generate the corresponding SQL script for SHP, and type the following characters

Shp2pgsql-W "GBK" D: \ test. SHP testtable> D: \ test. SQL

Here-W "GBK" represents the conversion of character encoding. D: \ test. SHP is the SHP file for generating SQL scripts. testtable is the name of the table that creates the data table,> not less, D: \ test. SQL is the path of the SQL file to be generated

After the command is successfully generated, the prompt is displayed as follows:

Shapefile type: Point
Postgis type: point [2]

4) execute the SQL statement file and import the data to the template_postgis database.

Psql-D template_postgis-f d: \ test. SQ Postgres

Template_postgis indicates the Database Name and Postgres indicates the database user.

After the execution is successful, refresh the database and you will see the testtable table

5. geoserver configuration (ZIP) References

1) decompress geoserver- 2. 0.0a -Bin.zip to the first directory, where E: \ GIS \ geoserver,

Run E: \ GIS \ geoserver \ bin \ Startup. bat

2) configure the map:

Open your browser and access: http: // localhost: 8080/geoserver/

Login: username 'admin', password 'geoserver'

Add new store in data/stores, and then add the vector/raster data sources in the data directory or database

Add a new resource in date/layers, select the target layer, configure parameters such as declared SRS and bounding boxes, and then release

Select a layer in the layer preview and select the preview mode, such as JPEG, shapefile, and openlayers.

3) test page:

Openlayers contains the browsing function of the layer, save its source file as HTML, put to the directory of. geoserver-2.0.0 \ webapps \ geoserver, can be opened as a test page.

6. Deploy geoserver (WAR) on Tomcat)

Install the Tomcat application server, decompress the Tomcat package, and copy the geoserver. war package to the webapp directory of Tomcat and start Tomcat. the following line shows the port number: My port number is 8081 (manually changed to avoid affecting other services ). During startup, Tomcat will automatically deploy geoserver. After the startup is complete, Use http: // ip: Port Number/geoserver to enter the geoserver graphic configuration page, which is the same as the above.

7. Deploy geoserver (WAR) on WebSphere)

Install websphere, start the service, and open the console. Click "install new application" under "application" to view the downloaded geoserver. war, the context root field/geoserver, of course, you can also fill in other content. The content entered here will be used when you enter the geoserver interface after the deployment is successful. Click "Next" in the following steps. All the items are set by default. Click the enterprise application in the application to start the geoserver service. Enter http: // ip: 9080/geoserver/welcome. Do to enter the main interface.

8. openlayers Configuration

Decompress the package and copy the openlayer under the directory. the lib directory under JS, root directory, and IMG directory are under the scripts directory of the website (ensure openlayers. JS,/lib,/IMG can be in the same directory ). then, import openlayers. JS.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.