GeoServer

completemiscreantΔιαχείριση Δεδομένων

28 Νοε 2012 (πριν από 4 χρόνια και 4 μήνες)

787 εμφανίσεις

1

Installing GeoS
erver


(
DT249,DT228,DT211
)

Lecturer Pat Browne


This note describe how to set up GeoServer on your own Windows machine, it

is

not
to
done in the labs
.

We will cover.

1)

Install GeoServer

on your own machine

2)

Study Demos

3
)

Publish some ma
ps



You will need PostgreSQL/PostGIS with the tables

from previous labs loaded

on your
machine
.

Also, you will need the PostGIS tables from previous Labs.

The GeoServer manual is at;

http://docs.ge
oserver.org/stable/en/user/




1) Install GeoServer

From the Web or studentdistrib
, c
l
ick on

Windows Installer

version of GeoS
erver
:

geoserver
-
2.0.1
-
ng
.exe


OR

install latest
GeoServer 2.1.2
: User Name: admin , Password: geoserver



For Apple
-
M
ac see

http://docs.geoserver.org/2.0.0/user/installation/osx.html


Install

follow
ing

the usual dialogs
. Note
, that data and web pages will be stored
under the
installation folder

C:
\
Program

Files
\
GeoServer 2.0.1
\

2


Make sure that any other servers on port 8080 are stopped.


S
tart GeoServer from
Windows Start | All Programs




Point your web browser
t
o:

http://localhost:8080/geoserver/web/





2
)
Study

D
emos
.

From

the Demos

|
Demo requests
, s
elect

WMS_GetMap.url and the Submit
.

You should get the map below.



Experiment with WMS_GetMapOpenLayers.url


2.1
) Examine

demos and

layers

From
Layer Preview

select
to
p
p:states
|
OpenLayers

3



Exp
eriment with the OpenLayers controls



Other formats are available (explore Select one)


In the GeoServer Layer Preview

page
c
lick on

Layer

Preview > sf:archsites

> Open Layers



Examine some of the
OpenLayers
functionality available.

4



Do the followin
g query Filter=FeatureID and
archsites.10

in adjacent text box. Then
press the arrow on the right. You should see just one point.

To reset the map set Filter=OGC and text box blank.

Note there is little in the way of
error checking.
View source with CT
R
L/
U
notice s
ome styling, JavaScript and HTML.


3) Publish some maps

3.1
) L
ogin to GeoServer

The defaults are username=admin,password=geoserver.






3
.
2
) Create a Work
space

Work
spaces a
re a way to logically group

data sets.

A

WS

consists of a name and a
Nam
espace URI

In GeoServer, a workspace is often used to group similar layers
together. Individual layers are often referred to by their workspace name, colon, then
store. (Ex: topp:states) Two different layers having the same name can exist as long as
they
exist in different workspaces. (Ex: sf:states, topp:states).

Select Data | Workspace | New Workspace

5



See:
http://docs.geoserver.org/2.0.0/user/webadmin/data/workspaces.h
tml

When you c
lick submit your new Workspace
should appear as follows;




3.3
) Add new Store

Assume that the Ireland
2

WS has be
en

created in 2.3.



Select Store
s

| New data source

| PostGIS

Fill out form as follows and Save.

6


On Saving you should be

presented with a list of all the tables in the
postgis

database
(you could also use
testdb
)




3.4) Publish some maps.

Click on publish for county

This will present you with detailed layer information for

the
county

table/layer
.


7


You should let the sys
tem compute the bounding boxes by clicking on “Computer from
data” and “Compute from native bounds”.


When you click Save, you should get:






3.5
)

Add a Layer Group



8

By viewing the map in

Layer Preview

you should get.







3.6
)
Styling with SLD

GeoS
erver has several built in styles that can be viewed from the Style option.

For a style tutorial
see:

http://docs.geoserver.org/2.0.x/en/user/styling/sld
-
cookbook/index.html



3.7
) Create a Data S
tore

for shapefile

Data stores can host spatial data from a
variety of sources (e.g. PostGIS or shapefiles).

We need to create a data for each shapefile
. Later we will see that a PostGIS data store
can reference all the

tables in a database instance. Before we start we need to c
opy
county
.*


from the CD
files

to;


C:
\
Program Files
\
GeoServer 2.0.1
\
data_dir
\
Ireland


Make a new Source | New data source | Shapefile (*.shp)


Select the appropriate Workspace/Namespace

For the

URL, typ
e
file:data_dir/Ire
land/county
.shp


Cl
ick Submit, and then click Save
.


3.8
) WMS Ge
tCapabilities

Past
e

the following as one
single

string into your browser

http://localhost:8080
/geoserver/wms?service=WMS&version=1.1.1&request=GetCapabilities


Everything before the question ma
u
rk is the web address of the server.

In the query string
:

9


ser
vice=WMS specifies the service we’re interested in.


version= 1.1.1 specifies the version of the service you’d like to know about.


request=GetCapabilities asks for the capabilities document.

You should examine the returned
XML
file

in TextPad or Notepad/
.



3.9)

WMS
GetMap
.

Using this approach only layers from a single host can be displayed.

Paste or type
the following as one single string into your browser


http://localhost:8080/geoserver/wms?version=1.1.1&request=GetMap&srs=EPSG:29900&bbox=0.0,
0.0,50000
0.0,500000.0&width=500&height=285&layers=Ireland:county&styles=polygon&format=im
age/png

But what is wrong

with the image
?

Need to keep bounding box and coordinate window in the same proportions.

How would you get the image to display correctly?

Do the foll
owing

http://localhost:8080/geoserver/wms?version=1.1.1&request=GetMap&srs=EPSG:29900
&bbox=0.0,0.0,500000.0,500000.0&width=500&height=500&layers=Ireland:county&st
yles=polygon&format=image/png


Have a look at
the capabilities of
these sites.

http://mesonet.
agron.iastate.edu/cgi
-
bin/wms/nexrad/n0r.cgi?service=wms&version=1.1.1&request=GetCapabilities

http://wms.jpl.nasa.gov/wms.cgi?service=wms&version=1.1.1&request=GetCapabilities

A lot of information about the server, layers,
projections
, bo
unding boxes shou
ld be
returned in a file called
wms.cgi
.