Changes between Version 2 and Version 3 of ZooWorkshop/FOSS4GJapan/BuildingWPSClientUsingOL
- Timestamp:
- Oct 15, 2010, 9:11:34 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ZooWorkshop/FOSS4GJapan/BuildingWPSClientUsingOL
v2 v3 1 1 = Building a WPS client using !OpenLayers = 2 2 3 The next step of our workshop is to connect to the OGR Services we have created from an OpenLayers map. This will allow to apply single or multiple geometries processes on user-selected polygons and to display the new generated geometries.3 The next step of our workshop is to connect to the OGR Services we have created from an !OpenLayers map. This will allow to apply single or multiple geometries processes on user-selected polygons and to display the new generated geometries. 4 4 5 5 == Creating a simple map showing the dataset as WMS == 6 6 7 OpenLayers is also included in OSGeoLive default distribution, so it is convenient to use it for our needs. Please open your text editor and write the following HTML snippet:7 !OpenLayers is also included in OSGeoLive default distribution, so it is convenient to use it for our needs. Please open your text editor and write the following HTML snippet: 8 8 9 9 {{{ … … 25 25 }}} 26 26 27 The following JavaScript code must then be added in a <script></script> section within the <head>one. This will setup a map showing the United States data as WMS.27 The following !JavaScript code must then be added in a {{{<script></script>}}}} section within the {{{<head>}}} one. This will setup a map showing the United States data as WMS. 28 28 29 29 {{{ … … 51 51 }}} 52 52 53 Once done, please save your HTML file as zoo-ogr.html in your workshop directory, then copy it in /var/wwwand visualize it with your favorite Web browser using this link : http://localhost/zoo-ogr.html. You should obtain a map centered on the USA with the WMS layer activated.53 Once done, please save your HTML file as zoo-ogr.html in your workshop directory, then copy it in {{{/var/www}}} and visualize it with your favorite Web browser using this link : http://localhost/zoo-ogr.html. You should obtain a map centered on the USA with the WMS layer activated. 54 54 55 55 == Fetching the data layer as WFS and adding selection controls == 56 56 57 Before accessing the displayed data via WFS, you first have to create new vector layers dedicated to host the several interactions we are going to create. Please add the following lines within the init() function, and do not forget to add the newly created layer in the map.addLayersmethod:57 Before accessing the displayed data via WFS, you first have to create new vector layers dedicated to host the several interactions we are going to create. Please add the following lines within the {{{init()}}} function, and do not forget to add the newly created layer in the {{{map.addLayers}}} method: 58 58 59 59 {{{ … … 77 77 }}} 78 78 79 Then, you can now access tdata by creating new controls to select polygons, as the following. Please note that OpenLayers.Protocol.WFS.fromWMSLayer(layer)is used to access geometries and that several state of selection are declared and append to the control variable.79 Then, you can now access tdata by creating new controls to select polygons, as the following. Please note that {{{OpenLayers.Protocol.WFS.fromWMSLayer(layer)}}} is used to access geometries and that several state of selection are declared and append to the control variable. 80 80 81 81 {{{ … … 104 104 == Calling the single geometrie processes from JavaScript == 105 105 106 Now that everything is setup, we can go on and call our OGR ZOO services with JavaScript. Please add the following lines after the init()function, which will call the single geometry processes.106 Now that everything is setup, we can go on and call our OGR ZOO services with !JavaScript. Please add the following lines after the {{{init()}}} function, which will call the single geometry processes. 107 107 108 108 {{{ … … 164 164 Save your HTML file again. You should now be able to select a polygon and to launch a Buffer, ConvexHull, Boundary or Centroid on it by clicking one of the button. The result of the process should appear as GeoJSON layer on the map, in orange color. 165 165 166 == Calling the multiples geometries processes from JavaScript ==167 168 Using the same technique, you can now write a function dedicated to the multiple geometries processes. Please add the following lines after the simpleProcessing()function, we will guide you during the exercise in section 5 on how to create such a function.166 == Calling the multiples geometries processes from !JavaScript == 167 168 Using the same technique, you can now write a function dedicated to the multiple geometries processes. Please add the following lines after the {{{simpleProcessing()}}} function, we will guide you during the exercise in section 5 on how to create such a function. 169 169 170 170 {{{ … … 222 222 Note that this time we didn't use the GET method to request the ZOO Kernel but a XML POST. We did that because if you use the GET method you will get error due to the HTTP GET method limitation based on the length of your request. Using JSON string representing the geometry will make your request longer. 223 223 224 Once you get the functions to call your multiple geometries processes, you' must add some buttons to fire the request call. Here is the HTML code to add to your current zoo-ogr.htmlfile :224 Once you get the functions to call your multiple geometries processes, you' must add some buttons to fire the request call. Here is the HTML code to add to your current {{{zoo-ogr.html}}} file : 225 225 226 226 {{{