8

I recently installed GeoServer and downloaded OpenLayers also. I am a bit lost about which one to use when it comes to add functionality in my web map.

For example, I want to add layer switcher, shall I try to do it from GeoServer or through OpenLayers?

Another example is opacity, shall I try to do it from GeoServer or through OpenLayers?

Does GeoServer stop when layers are imported and displayed as WMS and then OpenLayers take full responsibility for Controls, opacity, thematic maps, base layer etc?

3 Answers 3

18

Geoserver is OWS server. That is a server side application that can serve maps using standards like WMS and WFS. Being a bit more precisely WMS serve images that represent maps or layers, WFS serve features, WPS process data using predefined operations, ...

Geoserver includes a web admin interface where you can style the layers or preview it. The layer preview uses openlayers (and other techniques) to show a representation of the layers.

Openlayers is a web mapping client. That is, a a javascript library that you can use in the browser to load WMS and WFS layers, but also geojson and others kind of data. Once you have the data OL helps you in create pop up windows with the info about the content of a feature, zoom, pan,... Using WMS layers from geoserver you can also change the styles sending to the server a SLD style, or the opacity. Of course it can do a lot of other things.

As i understand you are trying to put a map in a web application with a couple of utilities

For that kind of tasks openlayers or another javacript library like leaflet is your friend.

BTW if you need a web map tool with all this options included you can try geoexplorer.

1
  • 1
    It should be noted that only WMS serves "maps". WFS returns features. Commented Feb 17, 2015 at 16:03
10

You probably do both, but mostly on OpenLayers. The GeoServer part is mostly related to styling of layers.

OpenLayers is the client, and GeoServer is the server. For basic cases, you load the data into GeoServer (and publish out whatever layers and styling you need), then use OpenLayers in your web page (javascript and HTML).

OpenLayers calls GeoServer to render a picture (e.g. PNG or JPEG) that gets shown to the user as the map. That picture might have some other stuff rendered over the top of it on the client side (e.g. a feature location, which might come from the same GeoServer instance, or some other source). The client side rendering is up to OpenLayers.

As Francisco pointed out, you can preview your layer on GeoServer, and it uses OpenLayers to show the output to you (Layer Preview is just another website). That OpenLayers isn't your web site.

You don't have to use OpenLayers on the client side - Leaflet is also good, and might be easier to learn.

You don't have to use GeoServer on the server side - there are a range of map source options (e.g. MapServer is also popular). GeoServer is a good choice though :-) You can also use tile map servers (TMS) instead of WMS, depending on your needs.

1

In addition, you can use GeoServer for some functions like intersection, clipping, buffering etc... In GeoServer Demos, you can test those functions and see what would be the result of it. After you find proper function, you can use that XML code to put it in Javascript and make some further actions.

Not the answer you're looking for? Browse other questions tagged or ask your own question.