Preface
Nowadays, web mapping is all over the Internet. User friendly-interfaces and efficiency are mandatory requirements for GIS, as for any other system. If you are going to start a new web mapping application, you will not start from scratch. GeoServer is one of the biggest players in the web mapping field. It has a solid developer community and a high maturity level. Although it's not an easy piece of software to master, the latest releases have greatly improved stability and ease of management.
GeoServer Beginner's Guide offers you a practical introduction to GeoServer. Beginning with the installation and basic usage, you will learn to use the administration interface for adding data, configuring layers, customizing OGC services, and securing your site. You will find included lots of step-by-step examples, covering topics from data store configuration to layer publication and style customization. If all this sounds new and strange to you, don't worry; GeoServer Beginner's Guide will introduce you to the fundamentals of GIS and will then clearly explain all the basic tasks performed in order to build maps.
This book is meant to expand your knowledge of web mapping from something you have either heard of or have practised a little, into something you can apply at any level to meet your needs in incorporate maps for a site. I hope you will enjoy reading this book as much as I did writing it.
What this book covers
Chapter 1, GIS Fundamentals, introduces you to GIS concepts. It guides you through spatial data types and maps. You will discover how spatial information is stored and how to set up a map. You may want to skip this chapter if you already have a solid background in GIS.
Chapter 2, Getting Started with GeoServer, guides you in setting up your first GeoServer instance. It shows you, step by step, how to download the most recent version of the software and its requirements, that is, JAVA and a servlet container. For each component, a detailed description about how to install it is included.
Chapter 3, Exploring the Administrative Interface, covers GeoServer's web administration interface. It explains how to log in and access each section. You will familiarize yourself with data configuration following a common workflow that starts by adding data to GeoServer and guides you through to publication. Included in this chapter are screen captures that define the main areas of the program and menu items—all of which is very helpful when accessing the interface for the first time.
Chapter 4, Accessing Layers, guides you through data publication. The chapter covers in detail all output types offered by GeoServer for your data. Raster formats such as JPEG and PNG are discussed for maps, while vector formats such as GeoRSS and GEOJSON are explained for vector output. We will also explore OpenLayers, a JavaScript framework that GeoServer includes in its output format, when you want to serve your data as an application.
Chapter 5, Adding Your Data, demonstrates how you can configure data in GeoServer. The examples included will show you how to add and publish shapefiles and PostGIS tables, two of the most common formats, which are also natively supported by GeoServer. The extensions for Oracle and MySQL are also discussed.
Chapter 6, Styling Your Layers, explains how to apply styles to your layers. Styles let you render your data according to attributes, in order to build pretty maps. SLD's syntax, the standard for data rendering, will be explained in detail, with examples for different geometry types such as point, polyline, and polygons. The chapter also illustrates how to build scale-dependent symbology and how to compose different rendering in a group, to mimic a map in WMS.
Chapter 7, Building a Simple Map for Your Site Using OpenLayers, Google Maps, and Your Geospatial Data, describes how to build client applications with the JavaScript framework. JavaScript is a powerful and widespread language and, unsurprisingly, it is one of the best choices when developing a web application. We will build some sample maps using Google Maps API, OpenLayers, and Leaflet.
Chapter 8, Performance and Caching, covers the use of integrated GeoWebCache. Caching maps is a common strategy with map servers; it allows you to serve pretty complex maps without running out of resources. The GeoServer 2.2 release introduces a great change: you can fully administer the integrated GeoWebCache from the web admin interface. In the examples included, you will configure cache with different strategies, optimizing performance, or disk usage.
Chapter 9, Automating Tasks: GeoServer REST Interface, explains how to control the GeoServer configuration from a remote location through the REST interface. This may prove a great help if you have to administer a GeoServer site without the possibility of using the web admin interface, or if you want to automatize, in an external procedure, some admin tasks. The included examples will let you add data, configure styles and layers, and publish them. All the operations are demonstrated with Python and cURL syntaxes.
Chapter 10, Securing GeoServer Before Production, covers the GeoServer security module. The chapter first discusses general configuration for security, that is, password encryption, and then the security model is explained. A case history shows you how to create a configuration where different users are in charge of administration, editing, and publication tasks.
Chapter 11, Tuning GeoServer in a Production Environment, explains the advanced considerations for running a successful GeoServer site. It covers Java Runtime tuning and data and services optimization. Finally, a high availability configuration is detailed, with instructions for configuring a balanced GeoServer installation.
Chapter 12, Going Further: Getting Help and Troubleshooting, shows you how to access community tools and help for going further than what you will learn from this book. It also covers a concise introduction to other data publication standards implemented in GeoServer, WCS, and WFS. With WCS and WFS, you can serve vector and raster data to clients that not only need to show a map but have to perform some processing on the data.
What you need for this book
Installation and download instructions are described for all the software packages you will need. You just need to have access to a computer with an online connection for downloading packages. The instructions cover both Linux and Windows operating systems, so you may select the one you prefer.
All the software used in this book is freely available, most of the time as an open source project. Hardware requirements for development purposes are not very high. A relatively modern laptop or desktop will be enough for running examples. Source code and data used in this book are freely available on the Packt Publishing site.
Who this book is for
If you are going to use maps on your site, incorporate spatial data in a desktop application, or you are just curious about web mapping, this book offers you a fast-paced and practical introduction.
Particularly if you need to develop a web application supporting maps, you will find that GeoServer is one of the best solutions you can choose.
Analysts will discover how GIS works and how it can be integrated in complex systems. System administrators may also find this book useful for planning installation, tuning, and maintenance.
Conventions
In this book, you will find several headings appearing frequently.
To give clear instructions of how to complete a procedure or task, we use:
Time for action – heading
Action 1
Action 2
Action 3
Instructions often need some extra explanation so that they make sense, so they are followed with:
What just happened?
This heading explains the working of tasks or instructions that you have just completed.
You will also find some other learning aids in the book, including:
Pop quiz – heading
These are short multiple-choice questions intended to help you test your own understanding.
Have a go hero – heading
These practical challenges and give you ideas for experimenting with what you have learned.
You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "Get the 6686_05_mysql_usacounties.sql.zip
file and unzip it. Create a new database in MySQL. Call it geoserver
."
A block of code is set as follows:
_=id:Integer,code:String,name:String,country:Geometry:srid=4326 places.1=1|Rome|Italy|POINT(12.492 41.890) places.2=2|Grand Canyon|Usa|POINT(-112.122 36.055) places.3=3|Paris|France|POINT(2.294 48.858) places.4=4|Iguazu National Park|Argentina|POINT(-54.442 -25.688) places.5=5|Ayers Rock|Australia|POINT(131.036 -25.345)
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Start Tomcat service and then log in to the GeoServer administration interface. Go to the Data | Stores section and click on Add new store. You can now see some new options. Select MySQL".
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>
, and mention the book title through the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Downloading the color images of this book
We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/6686OS_Graphics.pdf.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <questions@packtpub.com>
if you are having a problem with any aspect of the book, and we will do our best to address it.