Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out

GeoServer workshop

VIEWS: 48 PAGES: 15

									  GeoServer
  workshop
practical sessions
  GeoNetwork conference
  Rome, November 7 2007

       Andrea Aime
  The Open Planning Project




              1
Summary
GeoServer UI quick walkthrough...............................................................................3
  Start GeoServer and reach the configuration interface..............................................3
  Login.................................................................................................................3
  DataStores and FeatureType           ..................................................................................4
  Configure your own data set.................................................................................5
WMS walkthrough...................................................................................................7
  Play with previews...............................................................................................7
  A quick look at SLD styles.....................................................................................8
WFS walkthrough..................................................................................................10
  View and edit data with uDig...............................................................................10
Raster data hands on practice.................................................................................13
  Looking at available raster data...........................................................................13
Bonus track: Google Earth advanced customization....................................................15




                                                            2
GeoServer UI quick walk through

Start GeoServer and reach the configuration interface
From the Windows menu
•   locate GeoServer 1.5.4, start GeoServer, watch the logs flow by
•   go back to GeoServer 1.5.4 in the Windows menu and start “GeoServer administration”
•   take a minute to examine the window and its links




        Status,
        everything fine



         GeoServer
         configuration
         and demos




                                                   Your entry point
                                                   to the services




Login
•   Enter config, login with admin/geoserver




                                               3
DataStores and FeatureType
•   Enter “Config”, “Data”
•   Look around, you can see
    •   Namespaces: allow to configure the XML namespaces used when serving data with
        WFS (each datastore lives in a namespace)
    •   DataStore and FeatureType: your vector data connections and the data you want to
        serve
    •   CoverageStores and Coverages: your raster data connections and the data you
        want to serve
    •   Styles: the SLD specification to turn your data into a nice looking map
    •   Enter DataStore section, select “state_shapefile”, press edit, and have a look at the
        connection configurations (each kind of datastore has a different set of parameters)




•   Go back to “Data”, select FeatureType, choose states_shapefile:states
    (datastore:featureType) and press edit again
    •   look at the styles (for the moment, they are just names, and you are supposed to
        know what they will do on the data, we'll explore them later). Select polygon in the
        drop down list (it's a simple solid filled polygonal style)
    •   look at the SRS, see the SRS List to have a look at which coordinate reference


                                              4
        systems GeoServer knows about (be patient, the list is long)
    •   compare and contrast native and declared SRS
    •   look at the lat/lon bounding box (try to click on “generate”)
    •   look at the list of attributes and their types
    •   press submit and apply (when you press submit the configuration gets stored in
        memory but not used so far, press apply to make GeoServer use it for good,
        eventually press save to store it into the data directory so that it will survive a
        GeoServer restart)
•   Let's see something more about this data set. Locate and click Welcome, Demo, Map
    preview, and finally click on topp:states. Click on some polygon to gather more
    information, zoom and pan around.




Configure your own data set
•   Locate on your disk the extra data directory (ask the instructor, look on the CD or
    download the zip attached to this presentation)
•   You should find the following files:
    •   a gboundaries shapefile made of gboundaries.shp, gboundaries.dbf and
        gboundaries.shx
    •   a bluemarble.tiff GeoTiff file
•   Copy the full path to that directory in the clipboard (if you don't see it, right click
    gboundaries.shp, properties, and the select and copy the path)
•   Go to GeoServer administration, Welcome, Configuration, DataStores, New
•   Select Shapefile (Indexed), name it countries, press submit




                                                5
•   In the datastore configuration fill in the full path of your gboundaries.shp file, select
    true for index creation, and press submit.




•   Since this datastore only has one feature type inside, GeoServer redirects us directly
    on the feature type configuration page. If the datastore had multiple feature type
    inside (e.g., PostGIS) we would have had to go to Data/FeatureTypes, press New and
    select the one we wanted to configure into GeoServer.
•   In the feature type configuration page, select:
    •   style: polygon
    •   SRS: 4326 (this is something you must know since the shapefile had no associated
        .prj file, thus no coordinate reference information at all)
    •   bounding box: generate
•   Press submit, apply. Go to the preview, locate topp:gboundaries, have a look around.




                                               6
WMS walkthrough

Play with previews
•   Go to the GeoServer administration UI main page
•   Navigate to Demo, Map Preview
•   Open tiger:poly_landmarks. Now have a look at the browser URL... it's a GetMap!
    •   http://localhost:8080/geoserver/wms?bbox=-74.05415325,40.6695265,-
        73.90085175,40.8921995
        &styles=
        &Format=application/openlayers
        &request=GetMap
        &layers=tiger:poly_landmarks
        &width=429&height=550
        &srs=EPSG:4326
•   Look for the format, try to replace it with image/png, image/jpeg
•   Try to change the width and height, first with application/openlayers, then with
    image/png... what happens?




•   Try out a different style. “&style=” means “use the default style. Try out polygon, point
    and line.
•   Restore the style back to “&style=”. Add a layer that happens to be in the same area,
    such as tiger:tiger_roads (hint, turn the layers param to
    layers=tiger:poly_landmarks,tiger:tiger_roads
•   Now try to zoom in and see how styling changes with scale
•   For a final twist, change the format to “kml” and see what happens (Google Earth must
    be installed to view the layer inside of it)




                                              7
A quick look at SLD styles
•   Go to the GeoServer administration UI main page
•   Navigate to Config, Data, Styles
•   Choose polygon, edit




•   Look at the xml (hint, most of the xml there is only boilerplate, the real thing is under
    <PolygonSymbolizer>)
•   Change the fill color from “FF0000” (RGB, so it's red) to “0000FF” (blue), change the
    stroke color to “000000” (black).




•   Preview tiger:poly_landmarks using the polygon style.




                                              8
•   Go back to the style definitions, let's have a look at a complex style, population. See
    how the PERSONS attribute is used to provide a different color to each polygon. (hint:
    each Rule has a Filter that determines to which polygons its PolygonSymbolizer applies
    to)




•   Go to the map preview and see how the style applies to the topp:states map (hint, you
    may have to change the GetMap request to use “styles=population”).
    As an alternative, you may go to the feature type configuration, select topp:states and
    change its default style back to population to make it the default style again.
Finished earlier? Try adding your topp:states GetMap request &clq_filter=MALE>FEMALE
or add &cql_filter=POPULATION>1000000. Now click on the map to do a GetFeatureInfo,
see attributes and values, and try to create your own filters.




                                             9
WFS walkthrough
Warning: editing shapefiles through WFS-T is not recommended and may or may not work
depending on how fast is the machine and on the data type. For production WFS-T please
us DBMS backends such as PostGIS, Oracle spatial and the like.

View and edit data with uDig
•   Go the the GeoServer main administration page
•   Go to Demo Map Preview
•   Preview topp:tasmania_state_boundaries
•   Alter the GetMap request so that layers contains the cities too:
    •   &layer=topp:tasmania_state_boundaries,topp:tasmania_cities




•   Start up uDig
•   Locate the “catalog” tab on the lower half of the screen and press the “Import” button




                                             10
•   choose “Data”, press next
•   choose “Web Feature Server”, press next
•   now uDig wants the link to the WFS capabilities document (the response to the
    GetCapabilities request)
    •   go to the GeoServer Administration main page
    •   right click on the “WFS capabilities” link and choose “copy location”




•   paste the link into the uDig dialog. A list of layers will appear on the catalog
•   drag and drop tasmania_state_boundaries and tasmania_cities to the map area.




                                              11
•   click on the tasmania_cities_type label in the “layers” panel to select that layer for
    editing
•   click on the drop down on the side of the “create polygon tool” button (looks like an
    irregular polygon with highlighted vertexes), click on the “create point geometries tool”
    and add some cities withing the Tasmania land:




                  •
•   press on the “commit” button to save the data onto GeoServer (it's a gray arrow)
•   go back to the GeoServer preview, pan the map a little to force a new request, confirm
    the new cities are there.

Finished earlier? Go to the sample requests sections and play with the WFS sample
requests.




                                             12
Raster data hands on practice

Looking at available raster data
•   Open the GeoServer administration main page
•   Go to Demo Map Preview and have a look at nurc:imageSample and nurc:Pk50095.
    •     zoom in, see how pixels start showing up
    •     these are plain images, no styling is applied
•   Now preview nurc:Arc_Sample. This is an ArcGrid file, but styling is not very good
    looking. It's hard to interpret the data. Let's fix it.
    •     Go to the main page again, then to Config / Data / Coverages, find
          arcGridSample:Arc_Sample and edit it
    •     Find and remember the default style. While you're at it, look at the informations
          needed to configure a coverage in this page.
    •     Let's hunt down the style. Go back to Data / Style, choose raster and edit
    •     ArcGrid is in fact an annual precipitation map, each pixel represents the mm or rain
          falling down during the whole year in each pixel. Let's build a ramp that represents
          the phenomenon considering that most of the surface receives between 0 and
          200mm, but there are some spots where the rain is much more (and we want to
          locate them). The new color map will be:




        (hint: FFFFFF is white, 6666FF is a light blue, FF0000 is red).
•   submit and apply, then go back to the preview. Does it make sense now?
•   What if you overlay add the gboundaries layer we added before with a line style on it?
    Change the request so that &styles become &styles=raster,line and &layers become
    &layers=topp:Arc_Sample,topp:gboundaries



                                                 13
Finished earlier?
•   change the line style so that it's black, one pixel wide (hint, black is 000000)
•   try out the WCS sample requests in the Demo / Sample requests section




                                              14
Bonus track: Google Earth advanced customization
If you've finished earlier you can try to follow the FOSS4G 2007 Google Earth
customization trail.
The activities description can be found here:
•   http://docs.codehaus.org/display/GEOSDOC/3+Google+Earth+customizations
You'll have to adapt it to your local environment considering that:
•   you're using GeoServer 1.5.4, not GeoServer 1.6.0 beta3, so paths are slightly
    different
•   all the extra material (shapefiles) is located on your workshop CD in the ge_extra_data
    folder
•   you'll have to open the files with notepad since notepad++ won't probably be available
    on your computer.
•   if you get stuck the completed templates are available in ge_extra_data/solutions




                                            15

								
To top