GeoServer + PostGIS

 

TGIS 503 WebGIS Fall 2016

Homework 

Installing GeoServer and using it to create a PostGIS db and styling it

GeoServer + PostGIS

 

example in action

 

  • PostGIS - A spatially enabled object-relational database.
  • GeoServer - A software server for loading and sharing geospatial data.
  • GeoWebCache - A tile cache server that accelerates the serving of maps (built into GeoServer).
  • GeoExplorer - A web application for composing, styling, and publishing maps.
  • QGIS - A complete desktop application for working with geospatial data and maps.

GeoServer plays well with others.

http://docs.geoserver.org/stable/en/user/data/database/index.html

GeoServer is written in Java

It offers highly scalable and standard web-mapping engine implementation, with a nice user interface and web admin interface.

PostGIS Cookbook

Somethings possible with PostGIS
Moving data in and out of PostGIS
  • import data tabular data using PostGIS or GDAL
  • Import shapefiles with shp2pgsql
  • import and exporting data using ogr2ogr GDAL command
  • exporting data to a shp file using pgsql2shp PostGIS command
  • importing raster data with the raster2pgsql  PostGIS command
  • importing and exporting multiple rasters at a time

PostGIS

"most popular and most capable of all the open source relational databases with spatial capabilities, and its features are constantly increasing...not an easy horse to ride." 
(GeoServer Beginner's Guide 2013 by Brian Youngblood and Stefano Iacovello page 110)
                            

Getting Started with PostGIS

Let's create a database!

Follow directions found here using pgAdmin

Alternatively, you may use command line, but I will not be providing you support with at this time.

Helpful tool to find info required for formatting your data on GeoServer

http://prj2epsg.org/search

Similar to adding a shapefile

This is what the GUI looks like when you have inserted the XML and clicked "preview legend"

Warning

  • If you change the color HEX and click preview legend, it might not appear, but it will change the color
  • to make sure - click submit then click style again and when you bring up that style, the next time you click preview legend, it should work! :)

designing maps and software, think carefully.

Adding Style with XML

<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor
                                    xmlns="http://www.opengis.net/sld"
                                    xmlns:sld="http://www.opengis.net/sld"
                                    xmlns:ogc="http://www.opengis.net/ogc"
                                    xmlns:gml="http://www.opengis.net/gml" version="1.0.0">
  <sld:NamedLayer>
    <sld:Name>county_classificiation</sld:Name>
    <sld:UserStyle>
      <sld:Name>county_classification</sld:Name>
      <sld:Title>County area classification</sld:Title>
        <sld:FeatureTypeStyle>
          <sld:Name>name</sld:Name>
          <sld:Rule>
            <sld:Title>Large counties</sld:Title>
            <ogc:Filter>
              <ogc:PropertyIsGreaterThanOrEqualTo>
              <ogc:PropertyName>square_mil</ogc:PropertyName>
              <ogc:Literal>5000</ogc:Literal>
               </ogc:PropertyIsGreaterThanOrEqualTo>
              </ogc:Filter>
              <sld:PolygonSymbolizer>
                <sld:Fill>
                  <sld:CssParameter
                                    name="fill">#FF0000</sld:CssParameter>
                  </sld:Fill>
                <sld:Stroke/>
                </sld:PolygonSymbolizer>
          </sld:Rule>
           <sld:Rule>
             <sld:Title>Small counties</sld:Title>
             <ogc:Filter>
               <ogc:PropertyIsLessThan>
                 <ogc:PropertyName>square_mil</ogc:PropertyName>
                 <ogc:Literal>5000</ogc:Literal>
                 </ogc:PropertyIsLessThan>
                 </ogc:Filter>
                 <sld:PolygonSymbolizer>
                <sld:Fill>
                  <sld:CssParameter
                                    name="fill">#0000FF</sld:CssParameter>
                  </sld:Fill>
                <sld:Stroke/>
                </sld:PolygonSymbolizer>
          </sld:Rule>
             </sld:FeatureTypeStyle>
          </sld:UserStyle>
      </sld:NamedLayer>
    </sld:StyledLayerDescriptor>
               
             
                
                                      
                      
                                

OGC schemes if you have validation errors

GeoServer_2016

By Britta Ricker

GeoServer_2016

This week we are going to set up a GeoServer!

  • 1,051