Implementing an Open Source GIS Server

Prepared By: Scott Qualls & Austin Williams

Access to information is becoming more vital to companies around the world. As this information becomes geographic in nature, servers must be implemented to provide the data to governments, businesses, and consumers. Cost plays a large factor in the implementation of a GIS Server for most people. While ESRI’s ArcGIS for Server is a popular option for businesses that have a budget for that software, smaller operations are turning to open-source alternatives. Though open-source options may cost less or nothing at all, as with this project, they tend to have a steeper learning curve. Communities and forums become the only tech support available.

Follow this guide as best as possible, constant changes in hardware and software may alter its relevance. This guide is the implementation of the WKU Spring 2015 Internet GIS server.

Hardware

Intel Xeon CPU X5450 @ 3.00GHZ –Quad-core

BIOS Version/Date Dell Inc. A02, 3/22/2008

RAM: 1x4 GB DDR2, 667Mhz, PC2-5300, Fully Buffered ECC, 1.8v

250GB Hard Drive – SATA 2, 5400RPM

Software

Windows Server 2008 R2

  • Server Operating System
  • A license can be purchased from Microsoft

PostgreSQL - v9.4

  • Object-relational database system

PostGIS - v2.1.5

  • Spatial Database Extender (SDE) for PostgreSQL

QGIS - v2.6.1

  • Desktop Client, can be used to access WMS & WFS

GeoServer - v2.7.0

  • Java-based software server

Operating System Installation & Configuration

Power the device on and ensure that it is booting properly. If no operating system is currently installed in the primary hard drive, it should ask for a bootable disk/drive. To setup the computer to accept the bootable USB drive and/or DVD/CD Drive press the applicable setup key during the boot sequence to enter the BIOS. The BIOS, Basic Input Output System, is a basic set of instructions for the computer. Typically the F12 key is used to enter this mode, but that may vary based on the motherboard manufacturer.

Enter the BIOS and configure the device boot list in the following order

  • USB, if supported
  • DVD/CD Drive
  • Primary Hard Drive

This will confirm that the machine is first trying to boot from either the USB or DVD that contains the Operating System, before checking the Primary Hard Drive. The original plan for this server was to install Windows Server 2012 on this computer, but due to the incompatibility of chipsetdrivers with Windows Server 2012, forced to install Windows Server 2008 RS instead.

Window Server 2008 R2 is different in many different ways from the run of the mill end-user version of Windows. Windows Server allows for many different roles and user settings that allow for web hosting and bridging connections. Windows Server also allows for many extra security features not typically available.

During the Windows Server 2008 Installation, the wizard is used to complete the process. A Server Password, Computer Name, and Workgroup for the Computer must be established. Once the Operating System is installed, Windows Update must run and install updates. Depending on the number of updates available this could take some time.

Figures 1-4 (Starting clockwise from top left) Installation wizard for windows server

A static IP (internet protocol) address must be established in order to connect with an external machine. A static IP places a permanent address for the server to be reached. Without a static IP it is unable to complete a secure and stable connection to the server. To ensure that a static IP isn’t already set use Command Prompt and type the command ipconfig/all. This output contains the information needed to set your static IP settings.

Figure 5. Command Prompt, IPCONFIG/ALL Results

Access the control panel, network connections, local area connection (right click), select properties, select Internet Protocol (TCP/IP), properties, and change the radial from “Obtain IP address automatically” to “Use the following IP Address.” Set a static IP and notate this for future use as it is used to access the server. IP Address must match similar to the one found through the ipconfig results the last quartet can be changed from 1-255. The subnet mask, default gateway, and preferred DNS server information all needs to be entered as well.

Figure 6. Location of Properties for the Local Area Connection

Figure 7. IPv4 Properties

The next step in configuring the server is to provide inbound and outbound rules for ports. This will allow for the firewall to remain active and only allow unmonitored traffic on the ports that are defined. GeoServer’s default port is 8080. Both an inbound and outbound rules to allow traffic will be created for port 8080 and named appropriately for future reference. The firewall properties can be accessed through the start menu or the control panel. Access the advanced settings to set the rules. Rules can also be implemented to block traffic on various ports or from accessing certain websites.

Figure 8. Setting Inbound-Outbound Rules

PostgreSQL

PostgreSQL is a free open-source object-relational database management system. The primary function of this database management system is to store and retrieve data. PostgreSQL by itself is not good for an Enterprise GIS environment, because PostgreSQL does not allow for spatially-enabled databases, unless a PostGIS extension is enabled for PostgreSQL.

PostgreSQL Installation Instructions:

  • Visit Hover over the Products Tab > PostgreSQL Overview and click the Download PostgreSQL link.
  • Select the version that corresponds with the Operating System in use.
  • Once downloaded, execute the PostgreSQL application to begin the installation of the software.
  • An Installation Wizard guides the remainder of the installation process:
  • Specify the installation directory. Ideally directly into its own folder on the primary hard drive, i.e. C:\PostgreSQL.
  • Specify a Data directory. This is where PostgreSQL stores the created databases.
  • Create a password for the PostgreSQL database.
  • Specify a port number. This is generally left at its default value of 5432.
  • Specify a Database Cluster. Leave this value as the default directory.
  • Make sure that StackBuilder is installed by making sure the option is checked in the Wizard. StackBuilder allows for easier installation of PostgreSQL components.
  • Once PostgreSQL is installed, StackBuilder will launch to continue installing additional components. These components are necessary to allow for the storage of geographic and spatial data within PostgreSQL databases.
  • Within the StackBuilder Wizard, specify that the additional software will accompany PostgreSQL using port 5432. Then select the following applications to install:
  • Add-ons, tools, and utilities:
  • pgAgent (a scheduling agent used with PostgreSQL.)
  • pgBouncer (a connection pooling utility that can be used to limit connections)
  • Database Drivers
  • psqlODBC (the official Open Database Connection driver for PostgreSQL)
  • Spatial Extensions
  • PostGIS (allows for spatially enabling PostgreSQL databases. Very Important)
  • Specify the download directory for the additional packages.
  • Verify the details for pgAgent.
  • Host: Set to “localhost”.
  • Username: Choose the username you wish to use to access the database.
  • Password: Choose a secure password
  • Port: 5432
  • Verify the details for the Account using the Agent
  • Operating System Username: The username of the OS account using PostgreSQL
  • System User Password: The password of the OS account using PostgreSQL
  • Retype Password
  • Verify Details – pgBounder
  • Fill in the same values here as in the details for pgAgent.
  • Listening port configuration
  • Use the default value, which should be 5432 in order to conform to previous selections.

PostGIS Installation Instructions

  • Accept the License Terms and move on.
  • Specify Components to install
  • PostGIS (Installs the PostGIS software)
  • Specify the directory to install PostGIS
  • Pop-Up window asking to register the GDAL_DATA environment variable. Click Yes.
  • Pop-Up Window asking to enable Raster Drivers. Click Yes.
  • Pop-Up Windows asking to enable Out of DB Rasters. Click Yes.
  • Restart the Computer to finalize the installation.

Creating a Spatial Database

Now that both PostgreSQL and PostGIS are installed, you can create a database using PostgreSQL and spatially enable it using PostGIS. This allows for the computer to host a database that can contain spatial information. Without spatially enabling a database using PostGIS, geographic data cannot be stored within the database. The process for creating a spatial database is simple.

  • Start the pgAdmin III application. This is the main PostgreSQL management application.
  • A server was already created during the installation process.
  • Under Servers, right-click “Databases” and create a new database.
  • Properties Tab
  • Name: Name the database.
  • Owner: Name the owner of the database
  • Comment: Input any additional information about the database.
  • Definition Tab
  • Set the encoding to UTF8, Tablespace to pg_default and leave the connection limit at -1, -1 allows an unlimited number of connections to the database.
  • Variables Tab
  • Variable Name: application_name
  • Variable Value: DEFAULT
  • User Name: Username for PostgreSQL.
  • Privileges Tab
  • Select which privileges each user for PostgreSQL has for this database.
  • Security Labels
  • Leave all Values blank.
  • SQL Tab
  • Do not modify

To spatially enable the database, select the database and click the “SQL” button in pgAdmin.

Create an SQL query that reads:

CREATE EXTENSION postgis;

Then press F5 to run the query. This spatially enables the database.

Adding shapefiles to PostgreSQL

A spatial database has been established and data needs to be added. With pgAdminIII use the plug-in features to select the Shapefile and DBF loader to add content to the database. The IP address, name of the database you want to add information to as well as the username and password must be known in order to add the data.

GeoServer

GeoServer is a java based web server for handling WCS, WMS, and WMF operations with a PostgreSQL backend. WMS, Web Media Services, are most commonly used by websites such as google maps and bing to display road data as well as raster information.

Begin by going to the GeoServer website

  • Near the right side of the webpage, there is a Download title
  • The one we use in this project is the Stable version
  • Then click the 2.7.0 hyperlink underneath the Stable button
  • Under the packages section Choose the OS you prefer to use
  • For demonstration purposes, we will choose the windows platform installer
  • Once downloaded, double-click the executable to launch the installation of GeoServer

A setup wizard appears: Follow through each wizard screen

  • I Agree agreement terms
  • Specify the installation directory
  • Specify a Start Menu folder for this program
  • Choose the Java Runtime Environment, the default should point at a valid JRE, if it does not follow this next step, if it already shows that the path contains a valid JRE, skip this step.
  • Setting up a JRE
  • Locate the JRE installation directory under program files, if one does not exist download the latest JRE from
  • Right-Click My Computer
  • Select Properties
  • Select Advanced
  • Click Environment Variables
  • Under System Variables, select New
  • Enter the variable names as JAVA_HOME
  • Enter the variable value as the installation path for the Java Development Kit
  • For example (C:\Progra~1\Java\jre6)
  • Click Ok
  • Click Apply Changes
  • Since this is the first time installing and/or using GeoServer a default data directory is preferred.
  • Set a Username and Password that will be used when accessing the GeoServer
  • Set a web server port: The default of 8080 is kept the same. The inbound/outbound rules set prior were for this particular reason.
  • Choose to install the GeoServer as a service rather than running manually. This allows the GeoServer to start when the server starts rather than having to manually start the service after every restart.
  • GeoServer should be successfully installed.

To view recently implemented GeoServer open any web browser and type the static IP address assigned earlier, followed by the port number and GeoServer, i.e. This will be the portal for interacting with GeoServer. Use the password and username established in the installation of GeoServer to access it.

From this point you can add the data stored on your PostgreSQL database to your server. The server supports many different formats for input as well as many different outputs ranging from WMS options such as OpenLayers and KML files, to WFS options such as geoJSON for web page embedding and compatibility with QGIS and various thick clients.

With GeoServer data is stored as a layer and each layer has its own native longitude and latitude bounding box, when adding new data these will be set based on either user inputs or the calculated boundary of the vector file. The projection will also be setting using the EPSG, European Petroleum Survey Group, standards. Multiple layers can be added to a group layer and shown as a WMS.

Figure . WMS of a layer group for WKU campus Buildings and

QGIS

QGIS is a thick client that is open-source and is similar to ArcGIS Desktop. QGIS can be used to access the full WFS features of the GeoServer and can also directly connect to the PostgreSQL database if on the same machine. With WFS functionality through QGIS, once the connection to the GeoServer has been established you can edit, add, and delete data on the server. Since the data on the GeoServer is linked with the PostgreSQL server, the data will also be changed at that point. ArcGIS can still access the GeoServer WFS but only through the Interoperability Connection. Through this connection you can download the shapefiles to the local machine and upload the new file using QGIS. This allows for analysis to be performed in the ArcGIS for desktop environment if it is the more comfortable or known software.

Security

GeoServer offers many different ways of publishing data as well as multiple users. While there is always an admin/super user who can see all available datasets and manage the data, it is possible to store data for multiple operations in different groups on the server known as roles. These roles can be set to public or private. If they are set to private only a user with the set permissions to view the dataset can view the dataset. It is also possible to set users who can view and edit data of a particular set. If data is left as public others can view the data on the GeoServer though depending on the level of access declared for the user account they may not able to add/delete/edit the datasets.

Conclusions

In conclusion, there are many ways to improve and expand upon the current setup. Raster integration was never fully realized. The only methods to add rasters were command line based and did not provide accurate results. OGR2OGR as well as raster2pgsql were two of the many tried during this project.

Running this server on a Linux distribution such as Ubuntu would truly make this an open-source from start to finish project. The only paid software in this build is the Windows Server 2008 licensing. A true DNS server was not established either, so rather than being able to point the data saved in GeoServer to a domain and established Java rendering environment such as Leaflet, the uploaded vectors were stand-alone and referenced only by the layer preview method.