Preamble
PostGIS analysis is only one aspect of the whole picture. How about making our datasets available as maps that different clients can use and profit from? Let’s take a look at how Geoserver can be used to accomplish this. In this sense, Geoserver functions as a fully functional open source mapping server, supporting a number of OGC-compliant services like OGC Web Mapping (WMS) and Web Feature Service (WFS).
The OGC, or Open GIS Consortium, is a group of people who work to improve access to spatial information by making standards for the industry.
Here is a brief summary of the organization of this article:
- setup of a geoserver
- config. of the dataset and layers
- setting up a service
- service utilization
Geoserver setup
Setting up Geoserver as a single, non-clustered instance will be the first step. I advise using one of the available Docker images to start up quickly for our demonstration. The steps below demonstrate how to start our geoserver container with its default configuration in a tmux session after pulling our geoserver image (kartoza) first. This enables us to easily monitor geoserver’s output.
tmux docker pull kartoza/geoserver:2.18.2 docker run -it --name geoserver -p 8090:8080 -p 8600:8080 kartoza/geoserver:2.18.2
If everything goes according to plan, Apache Tomcat provides a report with
org.apache.catalina.startup.Catalina.start Server startup in XX ms
Dataset and layer configuration
Apache Tomcat will listen on port 8080 and serve Geoserver’s web-interface at http://10.0.0.216:8090/geoserver by using the defaults in the kartoza image. Therefore, let’s proceed and log in using geoserver/admin.
Geoserver Web Administrator in Diagram 1
After logging in, the Geoserver main web screen is shown in Figure 1. For our airport dataset to be made public, our PostGIS database must be registered as a store (data source). I’d like to start by introducing the idea of workspaces in Geoserver. Data stores, layers, and services are contained in workspaces. Workspaces can be configured in great detail for functionality and accessibility.
It is necessary to set up at least one workspace. Check out Figures 2 and 3 to see how simple it is to complete this.
To get back to what we were doing, let’s set up our PostGIS database as a vector data source.
1. Select PostGIS as your vector datasource by clicking on store:
Table 2 new data source added
2. Select your workspace, set up your PostGIS connection, and connect.
3. If everything runs according to plan, saving our new data source results in a list of available spatial tables. Picking airports from this list brings us one step closer to our goal.
Unfortunately, we haven’t finished setting up our initial layer yet. To put a vector layer on Geoserver, you must at least define the extent (bounding box) of the coordinate reference system and the layer. If you set up your data source correctly, Geoserver should try to get the coordinate reference system from the metadata, so you don’t have to define it by hand. The layer’s bounding box can then be figured out by using the real data from the coordinate reference systems or it can be changed. The Geoserver will force you to define these mandatory settings, so don’t worry about forgetting to define those parameters. You are rewarded for your work by discovering a “fully” configured layer item in the layers section once the task is complete.
Service configuration
Geoserver functions as a full-fledged open source mapping server, as was mentioned at the beginning. What do I mean when I say that Geoserver is fully functional? This statement is based on the huge number of supported data sources and formats and the large number of spatial services that have been implemented. The following services are prebuilt into Geoserver by default: TMS, WMS-C, WMTS, CSW, WCS, WFS, WMS, and WPS. What do all of these acronyms mean? Most of them are abbreviations for services that comply with the OGC. But don’t worry, I won’t bother you this time with specifics about OGC standards. We will examine Web Mapping Services (WMS) in more detail in this article and today, but before we do, I urge you to read the OGC standards, which are available at https://www.ogc.org/docs/is.
WMS, or Web Mapping Service, is an OGC-compliant mapping service that is mostly about making maps. Because WMS makes maps in real time, clients can change the style, size, and projection of their map requests.
We can now move forward and test our service because Geoserver’s WMS feature is always on. The good news is that Geoserver has a useful layer preview that lets us check out different services within its own ecosystem.
Pick WMS/JPEG from the formats dropdown and click the Layer preview button in the navigation pane.
This immediately sends a get request to our WMS endpoint, which sends back an image of our airports in response.
You might think that’s not very appealing, and I have to agree. Geoserver gave our airport layer the default style because we didn’t tell it how to style it or narrow it down. Another significant topic that will not be covered today is styling.
Service consumption
It’s time to ask our preferred GIS client to use our Web Mapping Service. Although Quantum GIS (QGIS), an established open-source GIS client, is a favorite of mine, any other fat or web-based client with WMS support will work just as well. We can quickly find the http address that our WMS listens to by using the layer preview to pull it out of the previously generated url.
It’s quite interesting what’s going on right now in the background. QGIS first makes a request to collect thorough service metadata. The xml document it returns contains information on projections, formats, published layers, and much more.
If everything goes as planned, QGIS processes the GetCapabilities response first, then adds our airport layer to the WMS description. Figure 3 shows the proud results of our demo, where airports are added on top of OpenStreetMap tiles to make the map look a little better overall.
Figure 3 shows airports above OSM tiles.
Conclusion and outlook
Geoserver was set up and configured to publish a specific spatial dataset via WMS. It is not a stretch to say that Geoserver is a very potent mapping server given its wide range of data sources and default OGC-compliant services. This makes establishing and expanding your spatial infrastructure simple. Things are different when it comes to productive environments because additional factors like performance and security must also be taken into account.
About Enteros
Enteros offers a patented database performance management SaaS platform. It finds the root causes of complex database scalability and performance problems that affect business across a growing number of cloud, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
Revolutionizing Healthcare IT: Leveraging Enteros, FinOps, and DevOps Tools for Superior Database Software Management
- 21 November 2024
- Database Performance Management
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
Optimizing Real Estate Operations with Enteros: Harnessing Azure Resource Groups and Advanced Database Software
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
Revolutionizing Real Estate: Enhancing Database Performance and Cost Efficiency with Enteros and Cloud FinOps
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
Enteros in Education: Leveraging AIOps for Advanced Anomaly Management and Optimized Learning Environments
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…