Sunday, September 13, 2009

GeoServer and WMS

Geoserver is a truly fabulous open source geospatial server. Much easier to set and configure than Mapserver. The documentation provided is extremely comprehensive. See:

http://docs.geoserver.org/1.7.6/user/getting-started/web-admin-quickstart/index.html

Here are the notes I made as I walked through setting things up.

a) Setting up geoserver

I am using the portable gis control panel (see earlier blog entry). Once installed it sits directly under c:/.When you open it you have the option (under web modules) to start Geoserver.
Access Geoserver via:

http://localhost:8080/geoserver

admin/password are the default credentials. If you need to change them look at:

C:\Program Files\GeoServer 1.7.6\data_dir\security\user.properties

b) Adding shapefile

Under the data directory for geoserver add some new data in the data directory:

C:\Program Files\GeoServer 1.7.6\data_dir\data\

In the web interface click on data -> datastores -> new. Add name and type. Next screen add path to data and data name eg. nyc_roads.shp. Now click submit. The next screen should be the featuretype editor. Now from drop down select the type eg. line add the srs, then click generate. Now click submit and finally apply. Note these two steps in this order are critical in the process.

In the web interface under data->datastores you should now see your new data

You can view the data in welcome->demo->map preview

c) WMS

In config screen choose wms. Next choose contents and add the layer you just created in this screen. You can get the SRS info from the featuretype editor under data

One of the amazingly cool things about geoserver is the demos page in the web interface. From here you can view the results of various requests. Choose sample requests to see these options; wms, wfs etc. Also from here you can select map preview. From here you can see your newly loaded data. Another terrific thing about geoserver is the integration of openlayers. Data can be viewed directly in the geoserver interface with openlayers

d) Geowebcache

Another terrific part of geoserver is the integration of geowebcache. There is a nice guide to this here:
http://geoserver.org/display/GEOSDOC/GeoServer+GeoWebCache+Configuration

Key directory is C:\Program Files\GeoServer 1.7.6\data_dir\gwc. Go to:

http://localhost:8080/geoserver/gwc/demo


Here you can see all of your layers and ‘seed this layer’. Seeding is generating tiles. When you select seed this layer you will see under the gwc directory your newly generated tiles.
If you go to the demo page and view your data. In openlayers you have the option to view the data as a single image or tiled. The latter will show your newly generated tiles.

If you wish to see the data in google earth. Open Google earth, choose add->network link. Add a name and the url below to the pop up.

http://localhost:8080/geoserver/gwc/service/kml/topp:nyc_roads.png.kml

By selecting the named link in google earth (under my places) you should see your data.

3 comments:

A. Maracini said...

Matt, thanks for your blog. I've got Geoserver up and running and have a simple map of my data. How does one move beyond the localhost? I have a wireless router with a PC and Mac. The Mac is where the Geoserver is running and I'd just like to put a demo map "out there" so to speak.

Matt Sheehan said...

You have two choices:
- You'll need your home server to be available to the world, which means with an externally accessible IP.
- Or you can use a service provider to host your server.
The latter has its advantages since security and admin are done by the provider. But it can be potentially more challenging and expensive. Good luck. I think Geoserver is the way to go.

rb said...

Hi,

i have set up geoserver on my webserver, and everything seems to working fine. i would also like to put a wms/wfs/ etc service outside in the web beyond localhost. I am haveing diffulty though because i don´t know how to configure the xml files to get geoserver over the web.Is this done in the geoserver interface under localhost, or do I have to configure geoserver/webapps/WEB-INF/web.xml?

any help would be great!

yours,
Robert