opengeosuite_geoserver

23
WORKSHOP On CAPACITY BUILDING ON WEBGIS (22-26 February, 2011) OpenGeo Suite-GeoServer GeoServer Data Concepts GeoServer is a piece of middleware, that provides various data sources (shape files, database tables, images) to network users as internet services (WMS , WFS , etc). This conversion of file formats and database drivers into simple services makes web application development simpler – web developers no longer have to care what formats or projections the source data are in, because the service abstracts that complexity away. The abstraction is built on some core concepts that all data sources and services in GeoServer share: Workspaces: A workspace name-space is just a tag, a logical folder, under which feature types are grouped. The work-space in GeoServer affects how WMS/WFS layers are named, and the XML of the GML features emitted by GeoServer. Stores: Each source data, whether it be a directory full of shape files, or a database instance, is considered a “Stores”. File directories are configured by providing a path. Databases are configured by providing connection information. Layers: Each individual shape file, or spatial database table, is considered a “Layer”. Layer Groups: Multiple Layers can be bound into groups, that can then be referenced by a single name. Useful for creating base maps or other cartographic outputs that are composed of multiple layers. Styles: A style is applied to a Layer to create a cartographic output. The output might be an image, or it might be a KML file, or it might be some other format (like SVG) that provides a way of viewing data for end-users. GeoServer Web Administration GeoServer includes a web-based administration interface for configuration. Most GeoServer configuration can be done through this interface, without the need to edit configuration files by hand. Viewing The GeoServer web administration interface can be loaded from the OpenGeo Suite Dashboard by clicking on the Configure link underneath the GeoServer header. You can also browse to the web address where GeoServer is served. The default location of the GeoServer admin interface is http://localhost:8080/geoserver. Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad. 1

Upload: narmathagce3424

Post on 30-Apr-2017

212 views

Category:

Documents


0 download

TRANSCRIPT

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

OpenGeo Suite-GeoServer

GeoServer Data Concepts

GeoServer is a piece of middleware, that provides various data sources (shape files, database tables, images) to network users as internet services (WMS, WFS, etc). This conversion of file formats and database drivers into simple services makes web application development simpler – web developers no longer have to care what formats or projections the source data are in, because the service abstracts that complexity away.

The abstraction is built on some core concepts that all data sources and services in GeoServer share:

Workspaces:A workspace name-space is just a tag, a logical folder, under which feature types are grouped. The work-space in GeoServer affects how WMS/WFS layers are named, and the XML of the GML features emitted by GeoServer.

Stores:Each source data, whether it be a directory full of shape files, or a database instance, is considered a “Stores”. File directories are configured by providing a path. Databases are configured by providing connection information.

Layers:Each individual shape file, or spatial database table, is considered a “Layer”.

Layer Groups: Multiple Layers can be bound into groups, that can then be referenced by a single name. Useful for creating base maps or other cartographic outputs that are composed of multiple layers.

Styles:A style is applied to a Layer to create a cartographic output. The output might be an image, or it might be a KML file, or it might be some other format (like SVG) that provides a way of viewing data for end-users.

GeoServer Web Administration

GeoServer includes a web-based administration interface for configuration. Most GeoServer configuration can be done through this interface, without the need to edit configuration files by hand.

Viewing

The GeoServer web administration interface can be loaded from the OpenGeo Suite Dashboard by clicking on the Configure link underneath the GeoServer header. You can also browse to the web address where GeoServer is served. The default location of the GeoServer admin interface is http://localhost:8080/geoserver.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

1

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

Fig.1 Loading GeoServer web administration from the Dashboard

Authentication

Most GeoServer configuration tasks require a username and password to log in. By default, the GeoServer credentials are admin and geoserver, although this can be changed.

Log in using your credentials.

Fig2. Logging in with default credentials

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

2

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

After logging in, more options will be displayed.

Fig3 GeoServer Welcome page with administrative options

Workspaces

A workspace is the name for a notional container to group similar data together. We will first create a workspace for all of the data that we will be loading into GeoServer.

Add or Remove a Workspace

1. Navigate to the main GeoServer Web Administration page.

2. Click on the Workspaces link on the left side, under Data.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

3

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

Click this link to go to the Workspaces pageClick on the “Add new workspace” link at the top center of the page.

The Workspaces page

A workspace consists of a name and a Namespace URI (Uniform Resource Identifier). The workspace name has a maximum of ten characters and may not contain space. A URI is similar to URLs, except URIs need not point to a location on the web, and only need to be a unique identifier. For a Workspace URI, we recommend using a URL associated with your project, with perhaps a different trailing identifier, such as http://www.osgeo.in/rjahmundry for the “rjahmundry” workspace.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

4

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

In order to remove a workspace, click on the workspace’s corresponding check box. As with the layer deletion process, multiple workspaces can be checked for removal on a single results page. Click the Remove selected workspaces(s) button. You will be asked to confirm or cancel the deletion. Clicking OK will remove the workspace.

Workspace removal confirmation

Stores

A store connects to a data source that contains raster or vector data. A data source can be a file or group of files such as a table in a database, a single file (such as a shape file), or a directory (such as Vector Product Format library). The store construct is used so that connection parameters are defined once, rather than for each piece of data in a source. As such, it is necessary to register a store before loading any data.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

5

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

Stores View

Adding a store

1. From the GeoServer Web Administration page, click on the Stores link on the left side, under

2. Data.

3. Click this link to go to the Stores page

4. Click on Add new store.

5. Select PostGIS under Vector Data Sources

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

6

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

6. Fill out the following form using the following information (leaving all other information unchanged):

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

7

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

Filling out the New PostGIS store form (Part 1)

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

8

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

Filling out the New PostGIS store form (Part 2)

7. When done, click Save.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

9

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

Loaded store with no layers published

Adding a Shapefile

1. From the GeoServer Web Administration page, click on the Stores link on the left side, under Data.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

10

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

2. Click on Add new store.

3. select Shapefile: ESRI(tm) Shapefiles (.shp).

4. Select the workspace rajahmundry from the drop down menu, enter churches in the field name and enter a brief description, such as churches in Rajahmundry.

5. Under the Connections Parameters specify the location of the shapefile–file:data/shapefiles/churches.shp.

6. Press Save. You will be redirected to New Layer chooser page in order to configure churches layer.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

11

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

Loading a directory of shape files

1. From the GeoServer Web Administration page, click on the Stores link on the left side, under Data.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

12

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

2. Click on Add new store.

3. Select Directory of spatial files.

4. Fill out the following form. Select the rajahmundry Workspace, create a Data Source Name (can be anything, but we’ll call it rjy_data, and add a description if you’d like. In the box marked URL, type in the full path to the directory of shapefiles:

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

13

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

Configuring a directory of shapefiles store

5. When finished, click Save.

Publishing the layers

Layers

A layer is a grouping of geospatial data. Usually a layer contains one type of data (points, lines, polygons, raster) and has a single identifiable content (streets, houses, country boundaries, etc.). A layer is the smallest grouping of geospatial data.

We have already loaded a store, so we now need to publish the layers contained inside the store.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

14

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

Publishing a layer involves providing information on projection (if necessary), bounding box, default style, and much more.

Publishing a Layer

1. Return to the GeoServer Web Administration page.

2. Click on the Layers link on the left side, under Data.

3. Click this link to go to the Layers page

4. Click on Add new resource.

5. Select the resource called rajahmundry:rajahmundry_data from the drop down list. This is the store created in the previous section

.

6. Selecting our store

7. Select the first layer, banks_and_atms click Publish.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

15

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

8. Now we will enter information required to publish the layer. There are two tabs to the layer settings page. The Data tab contains settings for how GeoServer handles the data, and the Publishing tab contains settings for how GeoServer presents the data.

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

16

WORKSHOPOn

CAPACITY BUILDING ON WEBGIS(22-26 February, 2011)

GeoServer Layer Editor Explained

Salim Ali Centre For Ornithology And Natural History (SACON), Hyderabad.

17

Data Tab

The Layer editor page is very, very, very long and includes some pretty obscure entries. Here is a quick description of each entry, starting at the top:

Name This is the default name as read from the data source. For databases, it will be the table name. For shape files, it will be the filename part prior to the “.shp” suffix.

Title This allows you to over-ride the default name to some human-readable other name. The Title is used for public things like the WMS layer names, WFS feature-type names, and so on, so having a non-confusing Title is important.

Abstract, Keywords This is information that will appear in the WMS capabilities file, get crawled by cataloguing spiders and so on. The more useful information you can put in about your layer, the better.

Metadata Links WMS capabilities files can contain links to external metadata, like catalogue entries. This is a great place to link your layer to more metadata.

Coordinate Reference Systems The “Native SRS” is the spatial reference your raw data (in the database or files) is stored in. The “Declared SRS” is how the outside world will see it, as published via WFS. Because GeoServer supports on-the-fly re-projection, you can publish your data in any SRS you like, as long as you declare your native SRS.

Bounding Boxes The “Native Bounding Box” is the box calculated directly off the raw data, and will be in the native SRS coordinates. The “Lat/Lon Bounding Box” will be converted from the native box. You can manually over-ride either value, or simply auto-calculate them with the “Compute” links. Note that auto-calculate on very large tables will take some time.

Publishing Tab

Name The name will be read from the data, by default.

Enabled If you un-check “Enabled” the layer will not be visible in WMS or WFS services.

HTTP-Settings If you turn on “Response Cache Headers”, you can ensure that cache-control information is sent to clients, to advise them how long to cache information generated by GeoServer. For data which isn’t changing much, setting a long cache time can be a good idea.

WFS Settings To keep the server from being overloaded with large data requests, you might want to set a maximum “Per Request Feature Limit”. To keep your GML output file size

down, you can round off the coordinates using “Maximum number of decimals”. Round to remove unnecessary precision, but be careful not to degrade accuracy.

Default Style The style that will be applied if no style is specified.

Additional Styles It is possible to make layers available with multiple colorings, so that you can have a “yellow roads” a “grey roads” and a “blue roads” style, if you so desire. Clients can then switch between styles simply by specifying one of the styles in their map request URL.

Default WMS Path The GeoServer WMS path is, by default, /geoserver/wms. However you can change it to /geoserver/anythingyouwant

WMS Attribution Each Layer in a WMS service can have unique attribution, which client software can opt to display. Attribution might be an organization name, a link to a license page, and a logo image to overlay.

KML, Default Regionating Attribute GeoServer allows “regionated KML” to be published. Regionation allows users to browser very large KML data sets. At the top zoom levels, only a few of the “most important” features are displayed. At the bottom ones, all are displayed. The regionating attribute is used to figure out the “importance”. The attribute must be numeric and higher numbers must indicate more “importance”.

KML, Default Regionating Method

In the absence of a usable regionating attribute, an automatic strategy will be attempted:

• best_guess: When this strategy is selected, the strategy is actually determined by the type of data being operated on. If the data consists of points, the random strategy is used. If the data consists of lines or polygons, the geometry strategy is used.

• external-sorting: This strategy creates a temporary auxiliary database within GeoServer. It takes slightly extra time to build the index upon first request.

• geometry: This strategy externally sorts by length (if lines) or area (if polygons).

• native-sorting: This strategy uses the default sorting algorithm of the backend where the data is hosted. It is faster than external-sorting, but will only work with PostGIS datastores.

• random: This strategy uses the existing order of the data and does not sort.

KML, Features per Regionated Tile

The maximum number of features to deliver to the client as vectors. If higher than this, use an image-based KML strategy.

9. When you are finished configuring your layer click Save at the bottom of the page.

Previwe the layer

The layer is now published and is now being served by GeoServer. To preview this layer, navigate to the Layer Preview page. Click on Layer Preview link

After clicking, it will displays list of layers.

Select the OpenLayers preview for rjahmundry:churches.

Well done!! You have successfully completed OpenGeo-Suite (GeoServer) lessons.