exercise 1: starting geoserver & previewing a few...

10
smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services 1 smeSpire - Exercises for the Hands-on Training on INSPIRE Network Services April 2014 Jacxsens Paul SADL KU Leuven These exercises aim at people who already have some basic knowledge of INSPIRE Network Services. Therefore, we would like to recommend participants who do not have a basic knowledge of INSPIRE Network Services to have a look at the material of the seminar on ‘Basics of INSPIRE Network Services’: - The presentation can be found here: http://www.sadl.kuleuven.be/docs/Smespire_training_presentation_bas3_Basics_of_INSPIRE_Network_Services.pdf - First part of the web lecture: https://videolab.avnet.kuleuven.be/video/?id=a8d6c6053f424d3000a6886c79bb7527&height=388&width=640&autostart=false - Second part of the web lecture: https://videolab.avnet.kuleuven.be/video/?id=ba7dba6d8947a35e8a2de930945717fe&height=388&width=640&autostart=false Exercise 1: Starting GeoServer & previewing a few layers * Start “OpenGeo Suite Dashboard” by clicking the Windows Start Menu & * Click on the “Configure” (under “GeoServer”) A browser tabpage should open containing the URL http://localhost:8080/geoserver/web/; of course you could type this directly in your browser or bookmark it. “localhost” refers to your own PC. In the future this could be a server on your network or a remote webserver. You get the GeoServer Welcome page * Log in using the default administration credentials: Username = admin , password = geoserver (I will tell you how to change the password later) After logging in, many more options will be displayed. (if you do nothing for a while you automatically logout and have to relogin) * You can use the “Layer Preview” link (in the left panel) to view layers currently being served by GeoServer. Preview the preloaded layers by clicking on the “Go” (after “OpenLayers”) link next to each layer. OpenLayers is an open source web map viewer where you can of course zoom in/out, pan… Remember from the ‘Basics of INSPIRE Network Services’ web lecture: the map images come from a Web Mapping Service (WMS) (in this case GeoServer is the tool used to create the WMS) (do not close your GeoServer)

Upload: others

Post on 23-Apr-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services

1

smeSpire - Exercises for the Hands-on Training on INSPIRE Network Services

April 2014 Jacxsens Paul SADL KU Leuven

These exercises aim at people who already have some basic knowledge of INSPIRE Network Services. Therefore, we would like to recommend participants who do not have a basic knowledge of INSPIRE Network Services to have a look at the material of the seminar on ‘Basics of INSPIRE Network Services’: - The presentation can be found here:

http://www.sadl.kuleuven.be/docs/Smespire_training_presentation_bas3_Basics_of_INSPIRE_Network_Services.pdf - First part of the web lecture:

https://videolab.avnet.kuleuven.be/video/?id=a8d6c6053f424d3000a6886c79bb7527&height=388&width=640&autostart=false - Second part of the web lecture:

https://videolab.avnet.kuleuven.be/video/?id=ba7dba6d8947a35e8a2de930945717fe&height=388&width=640&autostart=false Exercise 1: Starting GeoServer & previewing a few l ayers

* Start “OpenGeo Suite Dashboard” by clicking the Windows Start Menu & * Click on the “Configure” (under “GeoServer”) A browser tabpage should open containing the URL http://localhost:8080/geoserver/web/; of course you could type this directly in your browser or bookmark it. “localhost” refers to your own PC. In the future this could be a server on your network or a remote webserver. � You get the GeoServer Welcome page * Log in using the default administration credentials:

Username = admin , password = geoserver (I will tell you how to change the password later) After logging in, many more options will be displayed. (if you do nothing for a while you automatically logout and have to relogin) * You can use the “Layer Preview” link (in the left panel) to view layers currently being served by GeoServer. Preview the preloaded layers by clicking on the “Go” (after “OpenLayers”) link next to each layer. OpenLayers is an open source web map viewer where you can of course zoom in/out, pan… Remember from the ‘Basics of INSPIRE Network Services’ web lecture: the map images come from a Web Mapping Service (WMS) (in this case GeoServer is the tool used to create the WMS) (do not close your GeoServer)

Page 2: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services

2

Exercise 2: Importing your own data (a folder of sh apefiles) Loading and publishing data is the core of GeoServer. This exercise will show how to import your own set of shapefiles. First we need to find the folder with the Burundi data. Browse with your explorer to “D:\Student\GIS_data\Burundi_data” (or where you downloaded the data) Now select the full path in the address bar of your explorer, right click on choose Copy

Go back to GeoServer (in your browser) * Click on to “Import Data” in the navigation pane. * Make sure that “Spatial Files - Files from a directory or archive” is selected Fill in the rest of the form: * Directory: paste the folder you previously copied (right click & ‘paste’ of Ctrl-V) or type D:\Student\GIS_data\Burundi_data (you can try to use the Browse button but it is not so handy) * Workspace: select “Create new” and type “Burundi” * Store: Create New (I will explain to you what workspace and a store is soon) * Click Next to continue. * You will see a list of shapefiles contained in that directory. Select the following shapefiles (we don’t need them all) & click on <Import> (do not click on <Done>, this will save your settings but not import anything) (be careful to select 'road_mda' and not 'bu_road') * The importer will load and publish each shapefiles as a layer. * You can preview your newly imported layers.

Page 3: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services

3

Exercise 3: Creating a layer group * From the left side of the page click on the “Layer Groups” link * Click on “Add new layer group” at the top of the page. Fill in the form: * Name = Burundi_all Workspace = Burundi * Click “Add Layer” 4x: add the following layers in this sequence:

bu-landform-agg, BDI_water_lines, road_mcla, all_stations Note: layer order is important. The top layer in the list will be drawn first, the bottom last (this is opposite to standard GIS applications). You can change the order of your list with the green arrow buttons. * Click on the button <Generate bounds> to generate a bounding box for the layer group. Note: The coordinates that will be generated will be the union of every layer’s bounding box. This button will also determine the projection of the layer group, equal to the top layer’s projection by default. * Click Save when done. * Preview the layer by going to the Layer Preview (on the left of your screen) Note1: It’s possible that you have to click on “>” (go to the next page) to access your new layer group Note2: the URL you see in your browser can be used in any webpage you make! http://localhost:8080/geoserver/Burundi/wms?service=WMS&version=1.1.0&request=GetMap&layers=Burundi_all&styles=&bbox=28.99234957210153,-4.469315528869629,30.849794387817383,-2.3088531494140625&width=440&height=512&srs=EPSG:4326&format=application/openlayers The result should look something like this:

You can zoom and pan like any interactive map. Try to click on an area, river, road, station and you get its attributes. Since this is a layer group you can get multiple attribute tables and the map application creates a small buffer around the point you click. Remember from Remember from the ‘Basics of INSPIRE Network Services’ web lecture: when you to click on a map and get feature attributes the map viewer is sending a “GetFeatureInfo” request to the Web Mapping Service (WMS).

Page 4: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services

4

Exercise 4: Adding your Web Map Service to desktop applications PART 1: add your Burundi Web Mapping Service to Quantum GIS (QGIS) • Copy the URL from the layer preview (the part before the ?) • Add WMS layers to QGIS

o hint: use this button and create a new WMS connection Remember from the ‘Basics of INSPIRE Network Services’ web lecture: when you to click on <Connect> QGIS is sending a “GetCapabilities” request to the Web Mapping Service (to GeoServer in our case). Part 2: add your Burundi Web Mapping Service to Google Earth (you can use the presentation slide that is still projected) • Automatically add the rivers of Burundi to Google Earth (layer in GeoServer = Burundi:BDI_water_lines) • Manually add the stations: layers=Burundi:all_stations Until you get something like this: If you have time:

• You can check if the geo data of our WMS are correct by zooming in Google Earth and checking if the rivers of the satellite images are close to the rivers of the WMS layer

• You can also click on a river or station in Google Earth to get it’s attributes Exercise 5: GeoServer settings PART 1: Go to the WMS – settings in GeoServer and change the WMS service metadata to your own personal settings (your name, organisation…). Be creative and fill in the: • Maintainer • Online resource: URL of the service = http://localhost:8080/geoserver/wms • Title • Abstract Click <Submit> (at the bottom of a long webpage) PART 2: Changing the admin password

Go to Security \ • Click on the tab page “Users/Groups” • Click on the user “admin” • You can but please do NOT edit the password (so other students can access GeoServer after you) • Click <Cancel>

Page 5: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services

5

Exercise 6: Web Feature Services PART 1: changing the settings of WFS in GeoServer * Go to the WFS – settings in GeoServer and change the WFS Service Level from Transactional or Complete to Basic PART 2: adding WFS to Quantum GIS

* Go to the Add WFS layer button in QGIS * Add a new connection, URL = http://localhost:8080/geoserver/Burundi/wfs (you choose a name) * Click on <Connect> and add the “bu-landform-agg” layer to your QGIS project * Right click this added layer and view its attribute table * Right click the layer again and save it as a ESRI shapefile (now you have exported the data from a (online) WFS to a local file) Extra: go to the layer properties – tab “General”: it’s interesting (according to me anyway) to see the Layer source: http://localhost:8080/geoserver/Burundi/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature &TYPENAME=Burundi:bu-landform-agg&SRSNAME=EPSG:4326 There you can see the GetFeature request (remember from the ‘Basics of INSPIRE Network Services’ web lecture)

Page 6: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services

6

Exercise 7 - Styles PART 1: Create a backup of your styles

* Go to the GeoServer Server Status * Copy the GeoServer data directory to your clipboard * Open your Windows File Explorer, browse to the data directory, copy and paste the “styles” folder to a backup location on your hard drive (on D:\Student for example) PART 2: creating categorized geo data in QGIS and saving it as a SLD file * Open QGIS * Add the “bu-landform-agg” WFS layer to your QGIS project (see previous exercise) * Right click the layer, choose properties and click on the page “Style” * Go from Single Symbol to “Categorized” on Column “L_FORM_DES” & Color ramp = “Random colors” * Click on <Classify> * Click on <Apply> * If you are not happy with a certain color of a category, you can change it by double clicking on the color * Before you click <OK> save your style as a SLD- file by clicking on

(in the right bottom corner of the property window) (remember where you saved your SLD file) * Click on <OK>

* It’s now a good idea to save your QGIS project for later. Click in the main QGIS window on or Project – Save. PART 3: Upload your SLD-file in GeoServer * Go back to GeoServer and go to the Styles settings: * Click on the style for “Burundi_bu-landform-agg” * Have a look at the current/default style description if you are interested (created by the data importer) * Click on <Choose File> & open the SLD file you created in QGIS * Click on “Upload…” and now you can see a much longer style description in the editor * Click on <Validate> (at the top you should see “No validation errors.”) * Click on <Submit> * Go to and have a look at your work Extra PART 4: WMS in QGIS

To make the exercise complete, go to QGIS, start a new blank project , add a WMS layer (like you did before, don’t use WFS). Have a look at “bu-landform-agg”, now you see an image created by the Web Mapping Service but in the new style you made. Since it is WMS the user can’t change the styling in QGIS.

Page 7: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services

7

(extra) Exercise 8 – Styles with GeoExplorer

* Go to the “OpenGeo Suite Dashboard ” and launch GeoExplorer

* To add a new layer click , in the Available Layers panel double click the layer “road_mcla”

* Go back to the layer overview by clicking on “Layers”

* Right click the layer “road_mcla” and choose “Layer Styles”

* Add a new rule (not a new style): * Click on the untitled new rule & choose <Edit> Name = Trail Choose a new color with the Color Picker Click on Advanced & select “Limit by condition” with the condition F_CODE_DES = Trail (F_CODE_DES is a column from the attribute table) Click again on Add a new rule but leave it blank (now you are sure the your first rule is saved) Click back on the tab page Basic to see the result (you should see 2 colors of roads in the map) * Edit the original rule: Change the name to Road Limit by condition: F_CODE_DES = Road

In the end you should see something like this: * Styling with GeoExplorer is directly saved in GeoServer (one of the reasons to back-up your styles)

Extra: you can have a look at the SLD of “ road_mcla” in GeoServer

Page 8: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services

8

Exercise 9: Installing GeoServer INSPIRE extension * Browse to http://geoserver.org/display/GEOS/Stable * Click on the INSPIRE link under Extensions\Data store to download * Extract "geoserver-2.5-inspire-plugin.zip" (right mouse click and use 7-zip) and copy the contents into the <GEOSERVER_ROOT>/WEB-INF/lib directory Standard root folder of GeoServer in a OpenGeo Suite installation =

"C:\Program Files (x86)\Boundless\OpenGeo\jetty\webapps\geoserver\WEB-INF\lib"

Restart GeoServer by clicking the Windows Start Menu & first 'Stop', than 'Start' under OpenGeo Suite 4.0.2\GeoServer Exercise 10: Adding a INSPIRE metadata link to the WMS PART 1: the catalog service First get the metadata link from a catalog service (as an example we are going to use a GeoNetwork catalog service hosted by GeoSolutions): - Go to http://demo1.geo-solutions.it/geonetwork/srv/en/

- Under free text type WMS - Uncheck [ ] interactive only and [ ] download only

- Press the search button

- Click on “Metadata” to see all the metadata about the WMS service - In order to build a request linking the WMS service with the catalog we are going to need the identifier

of that metadata record - The metadata link (in ISO 19139) = http://demo1.geo-

solutions.it/geonetwork/srv/en/iso19139.xml?uuid=f8dcfaba-4c5d-4750-905e-d1780ec5124f PART 2: GeoServer Go to the WMS – settings in GeoServer Scroll down to the INSPIRE block and paste the metadata link in the 'Service Metadata URL' element

Page 9: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services

9

Extra Exercise #1: change the language of GeoServer : GeoServer takes over the language settings of your browser, there is no language setting you can change in GeoServer itself. If you use Internet Explorer (IE):

• Go to the menu of Internet Explorer and click on Tools – Internet options • Click on the button <Languages> (in the tab “General”) • Add English and move it up to the top of the list • Click on <OK> twice • Close and restart Internet Explorer

Google Chrome:

• Go to the menu button (top - right) • Click on Show advanced settings... • Scroll down and click on the <Language and input settings…> button • Go to or add the language you want (English US for example) and move it (by drag & drop) to the top, if you

wish you can also click on <Display Google Chrome in this language> • Close and restart Google Chrome

Extra Exercise #2: change the language of QGIS: QGIS takes over the language of your Windows, but you can change the language setting in QGIS itself. * Go to (in your language) the menu “Settings – Options” * Go to the page “Locale” * Select [x] Override system locale * Locale to use instead: en_US (= US English)

Page 10: Exercise 1: Starting GeoServer & previewing a few layerssadl.kuleuven.be/docs/smeSpire_training_presentation_adv... · 2014-05-08 · * Copy the GeoServer data directory to your clipboard

smeSpire - SADL KU Leuven – Hands-on Training on INSPIRE Network Services 10

Extra Exercise #3: Web Coverage Service (WCS) PART 1: importing the raster data To get some free raster data :

• Go to the Earth explorer website at http://earthexplorer.usgs.gov/ • Register (menu on top – right of the webpage) (after registration you will be logged in) • Mark an area you are interested in

• Choose data set and download a result • Unzip the download

* Go to the GeoServer data importer and import the raster data you just downloaded from the Earth explorer website * Make sure that “Spatial Files - Files from a directory or archive” is selected * Choose a file or directory = the folder of your raster data * Workspace: select “Create new” and type “Raster_data” * Store: Create New * Click Next to continue, select the raster file and & click on <Import> * You can preview your newly imported layers. PART 2: enabling WCS Make sure that the Web Coverage Service (WCS) is in GeoServer is running (is enabled)

* Go to and check that this flag is on * If you want you can edit the WCS service metadata to your own personal settings (your name, organisation…). (the online resource: URL of the service = http://localhost:8080/geoserver/wcs) PART 3: QGIS again * Go to QGIS and Add WCS layer * URL = http://localhost:8080/geoserver/wcs (or http://localhost:8080/geoserver/Raster_data/wcs to filter on workspace) * When you add the layer in QGIS please be patient because raster files can be large and take a while to download and show * Go to the properties of the layer, page Histogram en compute the histogram to view pixel values (= height in meters) and frequency * Extra: try a raster operation like Terrain analysis – Relief (the output layer is a file location of the new geo tiff, press … to specify the path)