Adding a GeoServer layer as overlay

We will build a basic map with data from Google Maps API and Natural Earth Data published by GeoServer. The full code of the following example is contained in the google/geoserver_wms/index.html file from the code bundle. You can use the file as a reference; we will create it from scratch in the following steps:

  1. Open your text editor and create a new file, call it map.html and save it in the webapps/ROOT/geoserver_wms folder. The root folder is exposed, via HTTP protocol, from Tomcat. So the fastest way to publish your code is putting it there. Insert the following piece of code; it contains the basic for a static HTML page and a div element that is a reference to a map object we will create further:

Get GeoServer Beginner's Guide - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.