Using open-source software to build a WebGIS System (2) simplest demo

Source: Internet
Author: User


[The copyright of this article is owned by the xiaotie@vip.sina.com, reproduced by the author's consent.]

1. First install j2sdk-rj4_2_04-windows-i586-p.exe (assuming it is installed in c: \ j2sdk1.4.2 _ 04), set the environment variable java_home = c: \ drivers, and then install geoserver.

What about geotools? Why didn't we see geotools? You can see that geotools is already in the installation directory of geoserver. You can see from the geoserver API that geoserver accesses the data source through geotools and processes GEO queries.

2. Tomcat + geoserver Configuration:

Add a configuration line before the $ atathome/CONF/server. xml configuration file

<Context Path = "/geoserver" docbase = "D: \ Program Files \ geoserver \ Server \ geoserver "DEBUG =" 0 "reloadable =" true "crosscontext =" true "> </context>

Note: I installed geoserver on disk D.

In this way, you can access geoserver through http: // localhost: [port]/geoserver.

Geoserver is very easy to use. Just read the documentation for details. The interface is as follows:

3. Configure the Web Map Service in geoserver:

Place the desired shapefile in the $ geoserverhome/Server/geoserver/data/featuretype folder, and then modify catalog under the $ geoserverhome/Server/geoserver/WEB-INF folder. in the xml configuration file, add the configuration in the <datastores> </datastores> section:

<Datastore id = "bc_shapefile"

Enabled = "true"

Namespace = "Topp">

<Description> British Columbia sample road shapefiles </description>

<Connectionparams>

<! -- For now the URL value is relative to where geoserver moves the -->

<! -- Featuretypes directory. Everything in featuretypes moves to -->

<! -- Data, so just put the relative location. -->

<Parameter name = "url"

Value = "file: Data/featuretypes/bc_roads/bc_roads.shp"/>

</Connectionparams>

</Datastore>

In this way, an image configuration is added. Http: // localhost: [port]/geoserver/WMS? Request = getmap & layers = bc_roads & bBox = [Minx, miny, Maxx, maxy] & width = [width] & Height = [height] & SRS = [CRS] & styles = [style] & format = [mimetype] to access the image.

[] Content is configured according to the data source.

The demo provided in the geoserver document uses the configured SHP file. For example, http: // localhost: 8080/geoserver/WMS? BBox =-130,24,-66,50 & styles = Population & format = image/PNG & request = getmap & layers = states & width = 550 & Height = 250 & SRS = epsg: 4326, you can get:

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.