Friday, September 2, 2011

Spatial Wiki 9 - Add PostGIS Layer to GeoServer

This is Part 9 on building a Spatial Wiki, we've just Installed GeoServer and we're ready to add a new layer in GeoServer that serves up points from our PostGIS Database.

To get started login to the GeoServer web interface with something like:

http://[your server]/geoserver/web

Or if you're operating with port 8080 then use:

http://[your server]:8080/geoserver/web

From the GeoServer main screen use the option to create a new Workspace called "spatialwiki" and associate it with a URI also named spatialwiki.  In general we'll be creating a Workspace that contains a database connection called a Store (data), and a Layer with symbology that references data in a particular  Store.














After creating the Workspace select the option to create a new Store, this will be a connection to our PostGIS database.  Select the PostGIS connection type, just use the regular one, not the JNDI option.  Fill in the connection parameters, changing the workspace to the spatialwiki workspace that we just created. Use the postgres user to connect to the database.  Save the new Data Store.  When you create the data Store you will be forwarded to a screen to create a new layer with the Data Store or you can start a new layer using the Layers menu option on the left.












Either after creating a new Data Store, or via picking the Layers menu option and adding a new resource you can select the newly created spatialwiki:spatialwiki Workspace:Store and publish the view_wikipts view which is our previously created view that contains the points from our wiki.  You can use all the defaults when creating the layer, and you will have to click the options to calculate a native and lat-long bounding box from the data.  If you click the "Publishing" tab you can change the symbology for the points, the default is a small red box.

After creating the Layer select the Layer Preview menu on the left to preview the new layer in OpenLayers, or via KML or GML.  The test points of FOSS4G meeting locations are shown below in an OpenLayers preview.











See the next article on Installing OpenLayers.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home