[OpenLayers-Commits] r10946 - in sandbox/august/trunk/playground: .
webmap.wms wps
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Fri Dec 3 02:09:36 EST 2010
Author: augusttown
Date: 2010-12-02 23:09:36 -0800 (Thu, 02 Dec 2010)
New Revision: 10946
Added:
sandbox/august/trunk/playground/webmap.wms/
sandbox/august/trunk/playground/webmap.wms/webmap-wms-epsg3857.html
sandbox/august/trunk/playground/webmap.wms/webmap-wms-epsg3857.js
sandbox/august/trunk/playground/webmap.wms/webmap-wms-reqrecorder.html
sandbox/august/trunk/playground/webmap.wms/webmap-wms-reqrecorder.js
sandbox/august/trunk/playground/wps/pywps-wps-client.html
sandbox/august/trunk/playground/wps/pywps-wps-client.js
sandbox/august/trunk/playground/wps/wps-process.html
sandbox/august/trunk/playground/wps/wps-process.js
sandbox/august/trunk/playground/wps/wps-zooapi.html
sandbox/august/trunk/playground/wps/wps-zooapi.js
sandbox/august/trunk/playground/wps/wps.html
sandbox/august/trunk/playground/wps/wps.js
Log:
Add more WPS related samples e.g. zooapi, pywps openlayers client; add ArcGIS.com WebMap WMS sample and utility recorder.
Added: sandbox/august/trunk/playground/webmap.wms/webmap-wms-epsg3857.html
===================================================================
--- sandbox/august/trunk/playground/webmap.wms/webmap-wms-epsg3857.html (rev 0)
+++ sandbox/august/trunk/playground/webmap.wms/webmap-wms-epsg3857.html 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>OpenLayers (GeoWebCache) WMTS Example</title>
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css"/>
+ <link rel="stylesheet" href="../style.css" type="text/css" />
+ <script type="text/javascript" src="../../lib/Firebug/firebug.js"></script>
+ <script type="text/javascript" src="../../lib/OpenLayers.js"></script>
+
+ <script type="text/javascript" src="webmap-wms-epsg3857.js"></script>
+ </head>
+ <body onload="init();">
+ <div id="map" class="bigmap"></div>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/webmap.wms/webmap-wms-epsg3857.js
===================================================================
--- sandbox/august/trunk/playground/webmap.wms/webmap-wms-epsg3857.js (rev 0)
+++ sandbox/august/trunk/playground/webmap.wms/webmap-wms-epsg3857.js 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,84 @@
+var map = null;
+
+function init() {
+
+ OpenLayers.ProxyHost= function(url) {
+ return "/openlayers-trunk/ApacheProxyServlet?url=" + url;
+ };
+
+ // San Francisco
+ //var lon = -122.391667;
+ //var lat = 37.760628;
+ //var zoom = 5;
+
+ // Portland
+ var lon = -122.838493;
+ var lat = 45.432976;
+ var zoom = 9;
+
+ var options = {
+ //panMethod: null, // set 'panMethod' to null to disable animated panning
+ controls: [
+ new OpenLayers.Control.LayerSwitcher(),
+ new OpenLayers.Control.PanZoomBar(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.MousePosition()
+ ],
+ projection: "EPSG:900913",
+ units: "m",
+ maxResolution: 156543.0339,
+ numZoomLevels: 20, // default allowed zoom levels is 16 so change it to 20
+ maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)
+ };
+
+ map = new OpenLayers.Map('map', options);
+
+ var base_layer = new OpenLayers.Layer.AgsTiled(
+ //"World Topo Map",
+ //"http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/",
+ "World Imagery Map",
+ "http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/",
+ {
+ tileSize: new OpenLayers.Size(256,256),
+ tileFormat:'jpg',
+ tileOrigin: new OpenLayers.LonLat(-20037508.342789, 20037508.342789),
+ tileFullExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
+ isBaseLayer: true,
+ singleTile: false
+ }
+ );
+
+ // OSM base layer
+ //var base_layer = new OpenLayers.Layer.OSM();
+ map.addLayer(base_layer);
+
+ // transform lon/lat to coordinate in EPSG:900913
+ map.setCenter(
+ new OpenLayers.LonLat(lon, lat).transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ map.getProjectionObject()
+ ),
+ zoom
+ );
+
+ /*
+ * sample.webmap.baselayer
+ * http://www.arcgis.com/home/item.html?id=20073e9d0da04708b54091b6726e2dda
+ *
+ */
+
+ var webmap_baselayer = new OpenLayers.Layer.WMS(
+ "webmap_baselayer",
+ "",
+ {
+ layers: '',
+ styles: "",
+ format: "image/png",
+ transparency: false
+ },
+ {
+ singleTile: true
+ }
+ );
+ map.addLayer(webmap_baselayer);
+}
Added: sandbox/august/trunk/playground/webmap.wms/webmap-wms-reqrecorder.html
===================================================================
--- sandbox/august/trunk/playground/webmap.wms/webmap-wms-reqrecorder.html (rev 0)
+++ sandbox/august/trunk/playground/webmap.wms/webmap-wms-reqrecorder.html 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,127 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>WebMap WMS Request Recorder</title>
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css"/>
+ <link rel="stylesheet" href="../style.css" type="text/css" />
+ <script type="text/javascript" src="../../lib/Firebug/firebug.js"></script>
+ <script type="text/javascript" src="../../OpenLayers.js"></script>
+ <script type="text/javascript" src="webmap-wms-reqrecorder.js"></script>
+ <style type="text/css">
+ .standardinput {
+ width: 256px;
+ font-family: "Lucida Grande", Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
+ color: #aaa;
+ }
+ .standard {
+ font-family: "Lucida Grande", Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
+ font-size: 80%;
+ color: #666;
+ }
+ </style>
+ </head>
+ <body onload="init();">
+ <table>
+ <tr>
+ <td>
+ <div id="map" style="width:768px; height:512px; border:1px solid #ccc;"></div>
+ </td>
+ <td>
+ <table class="standard">
+ <tr>
+ <td valign="top"><b> NAME: </b></td>
+ <td valign="top"><input id="name_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> DESCRIPTION: </b></td>
+ <td valign="top"><input id="description_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> SERVICE: </b></td>
+ <td valign="top"><input id="service_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> VERSION: </b></td>
+ <td valign="top"><input id="version_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> REQUEST: </b></td>
+ <td valign="top"><input id="request_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> LAYERS: </b></td>
+ <td valign="top"><input id="layers_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> STYLES: </b></td>
+ <td valign="top"><input id="styles_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> FORMAT: </b></td>
+ <td valign="top"><input id="format_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> EXCEPTIONS: </b></td>
+ <td valign="top"><input id="exceptions_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> BGCOLOR: </b></td>
+ <td valign="top"><input id="bgcolor_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> TRANSPARENT: </b></td>
+ <td valign="top"><input id="transparent_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> CRS: </b></td>
+ <td valign="top"><input id="crs_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> SRS: </b></td>
+ <td valign="top"><input id="_srs_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> BBOX: </b></td>
+ <td valign="top"><input id="bbox_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> WIDTH: </b></td>
+ <td valign="top"><input id="width_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> HEIGHT: </b></td>
+ <td valign="top"><input id="height_input" type="text" value="NULL" class="standardinput"></input></td>
+ <td valign="top"></td>
+ </tr>
+ <tr>
+ <td valign="top"><b> </b></td>
+ <td valign="top">
+ <input type="button" value="Update" onclick="updateWmsParams();"></input>
+ <input type="button" value="View" onclick="recordWmsReq(true);"></input>
+ <input type="button" value="Record" onclick="recordWmsReq(false);"></input>
+ </td>
+ <td valign="top">
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+
+ </body>
+</html>
Added: sandbox/august/trunk/playground/webmap.wms/webmap-wms-reqrecorder.js
===================================================================
--- sandbox/august/trunk/playground/webmap.wms/webmap-wms-reqrecorder.js (rev 0)
+++ sandbox/august/trunk/playground/webmap.wms/webmap-wms-reqrecorder.js 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,185 @@
+var map = null;
+var wms_layer = null;
+
+function init() {
+
+ OpenLayers.ProxyHost= function(url) {
+ return "/openlayers-trunk/ApacheProxyServlet?url=" + url;
+ };
+
+ // San Francisco
+ //var lon = -122.391667;
+ //var lat = 37.760628;
+ //var zoom = 5;
+
+ // Portland
+ //var lon = -122.838493;
+ //var lat = 45.432976;
+ //var zoom = 9;
+
+ // U.S.
+ var lon = -109.6335;
+ var lat = 45.4447;
+ var zoom = 2;
+
+ var options = {
+ //panMethod: null, // set 'panMethod' to null to disable animated panning
+ controls: [
+ new OpenLayers.Control.LayerSwitcher(),
+ new OpenLayers.Control.PanZoomBar(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.MousePosition()
+ ],
+ numZoomLevels: 20, // default allowed zoom levels is 16 so change it to 20
+ /*
+ projection: "EPSG:900913",
+ units: "m",
+ maxResolution: 156543.0339,
+ maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)
+ */
+ projection: "EPSG:4326",
+ units: "degree",
+ maxResolution: 0.3515625,
+ maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90)
+ };
+ map = new OpenLayers.Map('map', options);
+
+ /*
+ var base_layer = new OpenLayers.Layer.AgsTiled(
+ "World Topo Map",
+ "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/",
+ //"World Imagery Map",
+ //"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/",
+ {
+ tileSize: new OpenLayers.Size(256,256),
+ tileFormat:'jpg',
+ tileOrigin: new OpenLayers.LonLat(-20037508.342789, 20037508.342789),
+ tileFullExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
+ isBaseLayer: true,
+ singleTile: false
+ }
+ );
+ */
+
+ var base_layer = new OpenLayers.Layer.AgsTiled(
+ "World Imagery Map",
+ "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/",
+ {
+ tileSize: new OpenLayers.Size(512, 512),
+ tileFormat:'jpg',
+ tileOrigin: new OpenLayers.LonLat(-180, 90),
+ tileFullExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
+ isBaseLayer: true,
+ singleTile: false
+ }
+ );
+ map.addLayer(base_layer);
+
+ // transform lon/lat to coordinate in EPSG:900913
+ map.setCenter(
+ new OpenLayers.LonLat(lon, lat).transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ map.getProjectionObject()
+ ),
+ zoom
+ );
+
+ /*
+ * sample.webmap.baselayer
+ * http://www.arcgis.com/home/item.html?id=20073e9d0da04708b54091b6726e2dda
+ *
+ */
+ wms_layer = new OpenLayers.Layer.WMS(
+ "webmap wms",
+ "http://java2:8080/WMSWebMap/OGC/content/items/f9b03992b484464dabb225fc705ede86",
+ {
+ NAME: 'random test',
+ DESCRIPTION: 'random test',
+ SERVICE: 'WMS',
+ VERSION: '1.3.0',
+ REQUEST: 'GetMap',
+ LAYERS: '1',
+ STYLES: '',
+ EXCEPTIONS: 'text/xml',
+ BGCOLOR: '0xFFFFFF',
+ FORMAT: 'image/png',
+ CRS: 'CRS:84',
+ _SRS: 'EPSG:4326',
+ TRANSPARENT: 'TRUE'
+ },
+ {
+ yx: {},
+ isBaseLayer: false,
+ singleTile: true,
+ buffer: 0,
+ getURL: function(bounds) {
+ bounds = this.adjustBounds(bounds);
+ var imageSize = this.getImageSize();
+ var newParams = {};
+ var reverseAxisOrder = this.reverseAxisOrder();
+ newParams.BBOX = this.encodeBBOX ?
+ bounds.toBBOX(null, reverseAxisOrder) :
+ bounds.toArray(reverseAxisOrder);
+ newParams.WIDTH = imageSize.w;
+ newParams.HEIGHT = imageSize.h;
+ document.getElementById("bbox_input").value = newParams.BBOX;
+ document.getElementById("width_input").value = newParams.WIDTH;
+ document.getElementById("height_input").value = newParams.HEIGHT;
+ var requestString = this.getFullRequestString(newParams);
+ return requestString;
+ }
+ }
+ );
+ //wms_layer.setVisibility(false);
+ map.addLayer(wms_layer);
+ populateForms(wms_layer);
+}
+
+function populateForms() {
+ for(var param in wms_layer.params) {
+ var input = document.getElementById(param.toString().toLowerCase()+"_input");
+ if(input) {
+ input.value = wms_layer.params[param];
+ }
+ }
+}
+
+function updateWmsParams() {
+ var newParams = {};
+ for(var param in wms_layer.params) {
+ var input = document.getElementById(param.toString().toLowerCase()+"_input");
+ if(input) {
+ newParams[param.toString().toUpperCase()] = input.value;
+ }
+ }
+ wms_layer.mergeNewParams(newParams);
+}
+
+function recordWmsReq(viewOnly) {
+ var newParams = {};
+ for(var param in wms_layer.params) {
+ var input = document.getElementById(param.toString().toLowerCase()+"_input");
+ if(input) {
+ newParams[param.toString().toUpperCase()] = input.value;
+ }
+ }
+ newParams['BBOX'] = document.getElementById("bbox_input").value;
+ newParams['WIDTH'] = document.getElementById("width_input").value;
+ newParams['HEIGHT'] = document.getElementById("height_input").value;
+ newParams['SRS'] = document.getElementById("_srs_input").value;
+ if(viewOnly == true) {
+ var reqStr = "";
+ for(var key in newParams) {
+ reqStr = reqStr + "&" + key + "=" + newParams[key];
+ }
+ alert(reqStr);
+ } else {
+ OpenLayers.Request.GET({
+ url: "/openlayers-trunk/WMSReqJDBCRecorder?",
+ params: newParams,
+ success: function(request) {alert("record succeeded");},
+ failure: function(request) {alert("record failed");}
+ });
+ }
+}
+
Added: sandbox/august/trunk/playground/wps/pywps-wps-client.html
===================================================================
--- sandbox/august/trunk/playground/wps/pywps-wps-client.html (rev 0)
+++ sandbox/august/trunk/playground/wps/pywps-wps-client.html 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
+ xml:lang="en">
+ <head>
+ <title>WPS Client</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css"/>
+ <link rel="stylesheet" href="../style.css" type="text/css" />
+ <script type="text/javascript" src="../../lib/Firebug/firebug.js"></script>
+ <script type="text/javascript" src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript" src="http://alex-js-lib.appspot.com/pywps.openlayers/3.1.0/WPS.js"></script>
+ <script type="text/javascript" src="pywps-wps-client.js"></script>
+ </head>
+ <body>
+ <h1>WPS JavaScript Client for (Py)WPS</h1>
+ <p>Example of usage of the <a href="WPS.js">WPS.js</a> file and it's OWS.WPS class.</p>
+ <p>There are two types of usage: You can let OWS.WPS go though the whole GetCapabilities->DescribeProcess->Execute chain, or if you alreay know, what kind of in- and outputs, you just have to defined them.</p>
+ <div id="wps">
+ <div id="url">URL: <input type="text" id="capsUrl"
+ value="http://giv-wps.uni-muenster.de:8080/wps/WebProcessingService"></input><br />
+ <input type="button" onclick="makeWPS()" value="GetCapabilities"></input>
+ <input type="button" onclick="executeOnlyProcess()"
+ value="Jdi rovnou na Lines Of Sight"></input></div>
+ <div id="server"></div>
+ <div id="processes" style="display: none">Processes: <select
+ id="processesSelect" onchange="onProcessChanged()"></select> <input
+ id="describeProcessButton" type="button" onclick="onProcessChanged()"
+ value="DescribeProcess" disabled="disabled"></input></div>
+ <div id="process"></div>
+ <div id="statusmsg"></div>
+ <div id="outputs"></div>
+ </div>
+
+ <div id="data" style="display: none">
+ <h2>If you need some data, here are some examples</h2>
+ <ul>
+ <li>http://openlayers.org/dev/examples/gml/polygon.xml</li>
+ <li>
+ http://sigma.openplans.org/geoserver/wfs?typename=topp%3Atasmania_cities&SERVICE=WFS&VERSION=1.0.0&REQUEST
+ =GetFeature&SRS=EPSG%3A4326&BBOX=135.015,-47.235,157.515,-35.985</li>
+ <li><gml:featureMember xmlns:gml="http://www.opengis.net/gml"
+ xsi:schemaLocation="http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <feature:feature xmlns:feature="http://example.com/feature">
+ <feature:geometry>
+ <gml:LineString>
+ <gml:posList>0 25.6640625 21.09375 1.7578125 39.375 29.1796875 59.765625 -0.3515625</gml:posList>
+ </gml:LineString>
+ </feature:geometry>
+ </feature:feature>
+ </gml:featureMember></li>
+ <li>
+ http://geo.sazp.sk/cgi-bin/sazp?service=WCS&request=getCoverage&crs=epsg:102067&coverage=dem&resx=706&resy=706&format=image/tiff16&bbox=-366407,-1247121,-333951,-1219604
+ </li>
+ <li>easting: -350179 northing: -1233362
+ </div>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/wps/pywps-wps-client.js
===================================================================
--- sandbox/august/trunk/playground/wps/pywps-wps-client.js (rev 0)
+++ sandbox/august/trunk/playground/wps/pywps-wps-client.js 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,313 @@
+var wps;
+var selectedProcess;
+
+OpenLayers.ProxyHost= "/openlayers-trunk/ApacheProxyServlet?resourceUrl=";
+
+/**************************************************************
+ * This is the first possible approach, how to use WPS class: *
+ * You have to call GetCapabilites->DescribeProcess->Execute *
+ * chain. The webpage content should guide you through the *
+ * proces *
+ **************************************************************/
+
+/**
+ * Function makeWPS
+ * will create the wps object and call getCapabilities
+ */
+var makeWPS = function () {
+ var url = document.getElementById("capsUrl").value;
+ wps = new OpenLayers.WPS(
+ url,
+ {
+ onGotCapabilities:onCapabilitiesParsed,
+ onDescribedProcess:onDescribeProcessParsed,
+ onStatusChanged:onStatusChanged,
+ onSucceeded: onExecuted
+ }
+ );
+ wps.getCapabilities(url);
+};
+
+/**
+ * Function: onCapabilitiesParsed
+ * Called after GetCapabilities is parsed
+ *
+ * This function will generate form with <select> object with
+ * all processes available on the server, so the user can
+ * choose the processes, she is interested in.
+ */
+var onCapabilitiesParsed = function() {
+ document.getElementById("server").innerHTML =
+ "<h1>"+this.title+"</h1><div>"+this.abstract+"</div>";
+ for (var i = 0; i < this.processes.length; i++) {
+ var option = document.createElement("option");
+ option.value = this.processes[i].identifier;
+ option.appendChild(document.createTextNode(this.processes[i].title));
+
+ document.getElementById("processesSelect").appendChild(option);
+
+ if (i == 0) {
+ wps.describeProcess(this.processes[i].identifier);
+ }
+ }
+ document.getElementById("describeProcessButton").disabled = null;
+};
+
+/**
+ * Function: onProcessChanged
+ * This function is called, when the user changes the content of
+ * <select> input.
+ *
+ */
+var onProcessChanged = function() {
+ wps.describeProcess(document.getElementById("processesSelect").value);
+};
+
+/**
+ * Function: onDescribeProcessParsed
+ *
+ * Will try to generate the form of inputs for the Execute
+ * request
+ *
+ * This 'could' be coded in more nicer way...
+ */
+var onDescribeProcessParsed = function(process) {
+ document.getElementById("processes").style.display="block";
+ document.getElementById("data").style.display="block";
+ var processDiv = document.getElementById("process");
+ processDiv.innerHTML = '';
+ document.getElementById("outputs").innerHTML = '';
+
+ var titleDiv = document.createElement("div");
+ titleDiv.id ="process.title";
+ titleDiv.innerHTML = "<h2>"+process.title+"</h2>";
+
+ var absDiv = document.createElement("div");
+ absDiv.id ="process.abstract";
+ absDiv.innerHTML = process.abstract;
+
+ var versionDiv = document.createElement("div");
+ versionDiv.id ="process.abstract";
+ versionDiv.innerHTML = "Version: "+process.version;
+
+ var inputsDiv = document.createElement("div");
+ versionDiv.id ="process.inputs";
+
+ processDiv.appendChild(titleDiv);
+ processDiv.appendChild(absDiv);
+ processDiv.appendChild(versionDiv);
+
+ /* For each input, generate <input>
+ */
+ for (var i = 0; i < process.inputs.length; i++) {
+ var inputDiv = document.createElement("div");
+ var label = document.createElement("label")
+ label.appendChild(document.createTextNode(process.inputs[i].title));
+ label.style.width = "200px";
+ var postLabel = document.createTextNode(process.inputs[i].abstract);
+ inputDiv.appendChild(label);
+
+ if (process.inputs[i].CLASS_NAME.search("Complex") > -1) {
+ var input = document.createElement("textarea");
+ var checkbox = document.createElement("input");
+ label.setAttribute("for",process.inputs[i].identifier);
+ input.id = process.inputs[i].identifier;
+ checkbox.setAttribute("type","checkbox");
+ process.inputs[i].complexInput = input;
+ process.inputs[i].asReferenceInput = checkbox;
+ inputDiv.appendChild(document.createElement("br"));
+ inputDiv.appendChild(document.createTextNode("asReference"));
+ inputDiv.appendChild(checkbox);
+ inputDiv.appendChild(document.createElement("br"));
+ inputDiv.appendChild(input);
+ }
+ else if (process.inputs[i].CLASS_NAME.search("Literal") > -1) {
+ var input = document.createElement("input");
+ label.setAttribute("for",process.inputs[i].identifier);
+ input.id = process.inputs[i].identifier;
+ inputDiv.appendChild(input);
+ process.inputs[i].literalInput = input;
+ }
+ else if (process.inputs[i].CLASS_NAME.search("BoundingBox") > -1) {
+ var minx = document.createElement("input");
+ minx.id = process.inputs[i].identifier+".minx";
+ label.setAttribute("for",process.inputs[i].identifier+"minx");
+ var miny = document.createElement("input");
+ minx.id = process.inputs[i].identifier+".miny";
+ var maxx = document.createElement("input");
+ minx.id = process.inputs[i].identifier+".maxx";
+ var maxy = document.createElement("input");
+ minx.id = process.inputs[i].identifier+".maxy";
+ inputDiv.appendChild(minx);
+ inputDiv.appendChild(miny);
+ inputDiv.appendChild(maxx);
+ inputDiv.appendChild(maxy);
+ process.inputs[i].bboxInputs = [minx,miny,maxx,maxy];
+ }
+ processDiv.appendChild(inputDiv);
+ inputDiv.appendChild(document.createElement("br"));
+ inputDiv.appendChild(postLabel);
+
+ }
+
+ var outpusInfo = document.createElement("ul");
+ for (var i = 0; i < process.outputs.length; i++) {
+ var li = document.createElement("li");
+ li.appendChild(document.createTextNode(process.outputs[i].title));
+
+
+ }
+
+ /* synchron/asynchron */
+ var assync = document.createElement("input");
+ assync.setAttribute("type","checkbox");
+ assync.id="assynchronous";
+ processDiv.appendChild(document.createTextNode("Run assynchronously: "));
+ processDiv.appendChild(assync);
+ processDiv.appendChild(document.createElement("br"));
+
+ /* execute button */
+ var execButt = document.createElement("input");
+ execButt.setAttribute("type","button");
+ execButt.onclick=callExecute;
+ execButt.value="Execute";
+ processDiv.appendChild(execButt);
+
+ /* yet another global variable */
+ selectedProcess = process;
+
+}
+
+/**
+ * Function: callExecute
+ * what will happe, when Execute button is clicked
+ *
+ * call input.setValue(something) for each input and
+ * call wps.execute() at the end
+ */
+var callExecute = function() {
+
+ /* nastaveni hodnot pro vsechny vstupy */
+ for (var i = 0; i< selectedProcess.inputs.length; i++) {
+ var input = selectedProcess.inputs[i];
+ if(input.literalInput) {
+ input.setValue(input.literalInput.value);
+ }
+ else if (input.complexInput) {
+ input.setValue(input.complexInput.value);
+ input.asReference = input.asReferenceInput.checked;
+ }
+
+ else if (input.bboxInputs) {
+ input.setValue({minx : input.bboxInputs[0],
+ miny : input.bboxInputs[1],
+ maxx : input.bboxInputs[2],
+ maxy : input.bboxInputs[3]});
+ }
+ }
+
+ selectedProcess.assync = document.getElementById("assynchronous").checked;
+
+ /* execute */
+ wps.execute(selectedProcess.identifier);
+
+};
+
+/**
+ * Function: onExecuted
+ * called on Status Succeeded
+ *
+ * The results are displayed on the web page
+ */
+var onExecuted = function(process) {
+ var dl = document.createElement("dl");
+ for (var i = 0; i < process.outputs.length; i++) {
+ var dt = document.createElement("dt");
+ dt.appendChild(document.createTextNode(process.outputs[i].title+": "));
+ var dd = document.createElement("dd");
+ dt.appendChild(document.createTextNode(process.outputs[i].getValue()));
+ dl.appendChild(dt);
+ dl.appendChild(dd);
+ }
+ document.getElementById("outputs").appendChild(dl);
+};
+
+/**
+ * Function: onStatusChanged
+ * called for every status change
+ */
+var onStatusChanged = function(status,process) {
+ var statdiv = document.getElementById("statusmsg");
+ statdiv.innerHTML = "<strong>"+this.status+"</strong> ("+this.percentCompleted+"% "+this.statusTime+"): "+this.statusMessage;
+};
+
+/**************************************************************
+ * This is the second possible approach, how to use WPS class:*
+ * You know all your inputs and outputs of the particalura *
+ * process, so you just create the objects and execute the *
+ * process *
+ **************************************************************/
+
+/**
+ * Function: executeOnlyProcess
+ * Tahle funkce je tu od toho, aby se spustila, kdyz se klikne
+ * na tlacitko "Jdi rovnou na Lines of sigth"
+ *
+ * Definuje se objekt wps, vsechny potrebny vstupy, process a
+ * spusti se execute (tudiz vubec neprobiha getcapabilities
+ * ani describeprocess).
+ */
+var executeOnlyProcess = function () {
+
+ // get URL
+ var url = document.getElementById("capsUrl").value;
+
+ // Create the WPS object
+ wps = new OpenLayers.WPS(url,{onStatusChanged:onStatusChanged,
+ onSucceeded: onExecuted});
+
+ // Create the complexData input
+ var demin = new OWS.Put.Complex({
+ identifier: "dem",
+ asReference: true,
+ value: "http://geo.sazp.sk/cgi-bin/sazp?service=WCS&request=getCoverage&crs=epsg:102067&coverage=dem&resx=706&resy=706&format=image/tiff16&bbox=-366407,-1247121,-333951,-1219604"
+ });
+
+ // Create the LiteralData input
+ var easting = new OWS.Put.Literal({
+ identifier:"easting",
+ value:-350179
+ });
+
+ // Create the LiteralData input
+ var northing = new OWS.Put.Literal({
+ identifier:"northing",
+ value:-1233362
+ });
+
+ // Create the LiteralData input
+ var height = new OWS.Put.Literal({
+ identifier:"height",
+ value:1
+ });
+
+ // Create the ComplexData output
+ var losOut = new OWS.Put.Complex({
+ identifier:"los",
+ asReference:"true"
+ });
+
+ // Now, define new process with predefined in and outputs
+ var los = new OWS.Process({
+ identifier: "exampleLosProcess",
+ assync: true,
+ inputs : [easting,northing,height,demin],
+ outputs : [losOut]
+ });
+
+ // add the process to wps object
+ wps.addProcess(los);
+
+ // and execute - that's all, folks
+ wps.execute(los.identifier);
+};
\ No newline at end of file
Added: sandbox/august/trunk/playground/wps/wps-process.html
===================================================================
--- sandbox/august/trunk/playground/wps/wps-process.html (rev 0)
+++ sandbox/august/trunk/playground/wps/wps-process.html 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>OGC WPS Test</title>
+ <!-- OpenLayers library trunk+ -->
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css"/>
+ <script type="text/javascript" src="../../lib/Firebug/firebug.js"></script>
+ <script type="text/javascript" src="../../lib/OpenLayers.js"></script>
+ <!-- other JavaScript library -->
+ <script type="text/javascript" src="wps-process.js"></script>
+ </head>
+ <body onload="init();">
+ <div id="map" style="width:1024px;height:512px;margin-top:5px;margin-left:5px;background-color:#ffffff"></div>
+ <!-- sample complex data: wfs:FeatureCollection
+ this has been tested and works with GeoServer WPS gt:BufferFeatureCollection process
+ -->
+ <!--
+ <div id="complexdata">
+ <wfs:FeatureCollection numberOfFeatures="1"
+ timeStamp="2010-10-28T23:56:29.995-07:00"
+ xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"
+ xmlns:it.geosolutions="http://www.geo-solutions.it" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:topp="http://www.openplans.org/topp" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ows="http://www.opengis.net/ows" xmlns:wfs="http://www.opengis.net/wfs">
+ <gml:featureMembers>
+ <it.geosolutions:highways gml:id="highways.1">
+ <it.geosolutions:the_geom>
+ <gml:MultiLineString srsDimension="2"
+ srsName="urn:x-ogc:def:crs:EPSG:4326">
+ <gml:lineStringMember>
+ <gml:LineString>
+ <gml:posList>37.769034 -122.397233 37.769474 -122.397642
+ 37.769796 -122.397846 37.770061 -122.397977 37.770872
+ -122.398163 37.771951 -122.398085 37.772221 -122.398093
+ 37.772474 -122.398224 37.772768 -122.398567 37.773345
+ -122.399321 37.773497 -122.399591 37.774593 -122.401125</gml:posList>
+ </gml:LineString>
+ </gml:lineStringMember>
+ </gml:MultiLineString>
+ </it.geosolutions:the_geom>
+ <it.geosolutions:LENGTH>0.469</it.geosolutions:LENGTH>
+ <it.geosolutions:HWYNAME>I 280</it.geosolutions:HWYNAME>
+ <it.geosolutions:FCC>A11</it.geosolutions:FCC>
+ <it.geosolutions:STATEFIPS>06</it.geosolutions:STATEFIPS>
+ <it.geosolutions:ALT1_NAME />
+ <it.geosolutions:ROAD_TYPE>Major Roads/Highways</it.geosolutions:ROAD_TYPE>
+ </it.geosolutions:highways>
+ </gml:featureMembers>
+ </wfs:FeatureCollection>
+ </div>
+ -->
+ <!-- sample body data -->
+ <!--
+ <div id="bodydata">
+ <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2">
+ <wfs:Query typeName="it.geosolutions:highways">
+ <ogc:Filter>
+ <ogc:FeatureId fid="highways.1"></ogc:FeatureId>
+ </ogc:Filter>
+ </wfs:Query>
+ </wfs:GetFeature>
+ </div>
+ -->
+ <input id="execute_btn" type="button" value="Execute Process" onclick="doExecute();"/>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/wps/wps-process.js
===================================================================
--- sandbox/august/trunk/playground/wps/wps-process.js (rev 0)
+++ sandbox/august/trunk/playground/wps/wps-process.js 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,248 @@
+var map;
+var base_layer;
+var wfs_sf_pizzastores;
+var select_control;
+var process;
+
+function init() {
+ // set OpenLayers proxy
+ OpenLayers.ProxyHost= function(url) {
+ return "/openlayers-trunk/ApacheProxyServlet?url=" + url;
+ };
+
+ // center map to
+ // San Francisco
+ //var lon = -122.391667;
+ //var lat = 37.760628;
+ var lon = -13626436.42113;
+ var lat = 4544920.28580;
+ var zoom = 15;
+
+ // Portland
+ //var lon = -122.838493;
+ //var lat = 45.432976;
+ //var zoom = 9;
+
+ // U.S.
+ //var lon = -109.6335;
+ //var lat = 45.4447;
+ //var zoom = 2;
+
+ var options = {
+ //panMethod: null, // set 'panMethod' to null to disable animated panning
+ controls: [
+ new OpenLayers.Control.LayerSwitcher(),
+ new OpenLayers.Control.PanZoomBar(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.MousePosition()
+ ],
+ numZoomLevels: 20, // default allowed zoom levels is 16 so change it to 20
+
+ projection: "EPSG:900913",
+ units: "m",
+ maxResolution: 156543.0339,
+ maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)
+
+ /*
+ projection: "EPSG:4326",
+ units: "degree",
+ maxResolution: 0.3515625,
+ maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90)
+ */
+ };
+ map = new OpenLayers.Map('map', options);
+
+ var base_layer = new OpenLayers.Layer.AgsTiled(
+ "World Topo Map",
+ "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/",
+ //"World Imagery Map",
+ //"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/",
+ {
+ tileSize: new OpenLayers.Size(256,256),
+ tileFormat:'jpg',
+ tileOrigin: new OpenLayers.LonLat(-20037508.342789, 20037508.342789),
+ tileFullExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
+ isBaseLayer: true,
+ singleTile: false
+ }
+ );
+
+ /*
+ var base_layer = new OpenLayers.Layer.AgsTiled(
+ "World Imagery Map",
+ "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/",
+ {
+ tileSize: new OpenLayers.Size(512, 512),
+ tileFormat:'jpg',
+ tileOrigin: new OpenLayers.LonLat(-180, 90),
+ tileFullExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
+ isBaseLayer: true,
+ singleTile: false
+ }
+ );
+ */
+ map.addLayer(base_layer);
+
+ // transform lon/lat to coordinate in EPSG:900913
+ map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
+ /*
+ map.setCenter(
+ new OpenLayers.LonLat(lon, lat).transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ map.getProjectionObject()
+ ),
+ zoom
+ );
+ */
+ // add a WFS layer
+ wfs_sf_pizzastores = new OpenLayers.Layer.Vector(
+ "sf_pizzastores",
+ {
+ strategies: [
+ new OpenLayers.Strategy.BBOX(),
+ ],
+ protocol: new OpenLayers.Protocol.WFSTWithLock({ // geoserver wfs
+ url: "http://localhost:8080/geoserver-2.1-snapshot-10282010/wfs?",
+ format: new OpenLayers.Format.WFSTWithLock({
+ //version: "1.1.0",
+ srsName: "EPSG:900913",
+ schema: "http://localhost:8080/geoserver-2.1-snapshot-10282010/wfs?service=WFS&request=DescribeFeatureType&version=1.1.0&typename=esri:sf_pizzastores_900913",
+ featureType: "sf_pizzastores_900913",
+ geometryName: "the_geom",
+ featureNS: "http://www.esri.com",
+ featurePrefix: "esri",
+ extractAttributes: false,
+ xy: true // no axis reverse for EPSG:900913
+ })
+ })
+ }
+ );
+ wfs_sf_pizzastores.setVisibility(false);
+ map.addLayer(wfs_sf_pizzastores);
+
+ select_control = new OpenLayers.Control.SelectFeature(
+ wfs_sf_pizzastores,
+ {
+ clickout: false,
+ toggle: true,
+ multiple: true
+ }
+ );
+ map.addControl(select_control);
+ select_control.activate();
+}
+
+function doExecute() {
+
+ if(!process) {
+ process = new OpenLayers.Process.WPS({
+ map: map,
+ url: "http://sazabi:8080/geoserver-2.1-snapshot-10282010/wps?",
+ identifier: "gt:BufferFeatureCollection"
+ // TODO: more settings
+ });
+ process.map = map;
+ }
+ process.cleanupDataInput();
+ process.cleanupDataOutput();
+
+
+ // add a literal data input
+ process.addDataInput({
+ identifier: "buffer",
+ //title: "",
+ //'abstract': "",
+ type: "LiteralData",
+ options: {
+ dataType: "xs:dobule",
+ uom: "meters",
+ literalData: "490"
+ }
+ });
+
+ // <wfs:FeatureCollection> complex data input from a hard code string
+ /*
+ var complexDataText = document.getElementById("complexdata").firstChild.nodeValue;
+ var gmlParser = OpenLayers.Format.WFSTWithLock({
+ srsName: "urn:x-ogc:def:crs:EPSG:6.9:4326",
+ schema: "",
+ featureType: "highways",
+ geometryName: "the_geom",
+ featureNS: "http://www.geo-solutions.it",
+ featurePrefix: "it.geosolutions"
+ });
+ gmlParser.writers['wfs']['FeatureCollection'] = OpenLayers.Format.GML.v3.prototype.writers['wfs']['FeatureCollection'];
+ var input_features = gmlParser.read(complexDataText, {});
+ var complexDataNode = gmlParser.writeNode("wfs:FeatureCollection", input_features, null);
+ */
+
+ // features from a vector layer (GeoServer WFS)
+ var features_encoder = wfs_sf_pizzastores.protocol.format;
+ // TODO: add writers['wfs']['FeatureCollection'] in OpenLayers.Format.WFSTWithLock
+ features_encoder.writers['wfs']['FeatureCollection'] = OpenLayers.Format.GML.v3.prototype.writers['wfs']['FeatureCollection'];
+ // manually encode complex data
+ //var complexDataNode = features_encoder.writeNode("wfs:FeatureCollection", wfs_sf_pizzastores.selectedFeatures, null);
+ // register complex data input encoder
+ process.regDataInputEncoder("features", features_encoder);
+
+ process.addDataInput({
+ identifier: "features",
+ //title: "",
+ //'abstract': "",
+ type: "ComplexData",
+ options: {
+ schema: "http://localhost:8080/geoserver-2.1-snapshot-10282010/wfs?service=WFS&request=DescribeFeatureType&version=1.1.0&typename=esri:sf_pizzastores_900913",
+ encoding: "UTF-8",
+ mimeType: "text/xml",
+ //complexData: complexDataNode,
+ complexData: wfs_sf_pizzastores.selectedFeatures,
+ encodeComplexData: true,
+ complexDataRoot: "wfs:FeatureCollection"
+ }
+ });
+
+ // use the same format to parse result
+ var result_parser = wfs_sf_pizzastores.protocol.format;
+ // register complex data output parser
+ process.regDataOutputParser("result", result_parser);
+
+ process.addDataOutput({
+ identifier: "result",
+ //type: "RawDataOutput", // output raw data
+ type: "ResponseDocument", // output <wps:ExecuteResponse>
+ options: {
+ schema: "http://schemas.opengis.net/gml/3.1.1/feature.xsd",
+ encoding: "UTF-8",
+ mimeType: "text/xml; subtype=wfs-collection/1.1",
+ asreference: false
+ }
+ });
+ process.execute({
+ isRawDataOutput: false,
+ callbacks:[
+ /*
+ function(executeResponse) { // callback to handle raw data output
+ OpenLayers.Console.debug("...callback is called...");
+ var parser = new OpenLayers.Format.GML.v3({
+ srsName: "EPSG:900913",
+ schema: "",
+ featureType: "sf_pizzastores_900913",
+ geometryName: "the_geom",
+ featureNS: "http://www.esri.com",
+ featurePrefix: "esri", // the parse of feature doesn't require prefix to match as long as
+ xy: true
+ });
+ OpenLayers.Console.debug("...parse features...");
+ var result_features = parser.read(executeResponse.responseXML);
+ OpenLayers.Console.debug("...features parsed...");
+ var layer = new OpenLayers.Layer.Vector("__wps_results__");
+ layer.addFeatures(result_features);
+ this.map.addLayer(layer);
+ },
+ */
+ function(executeResponse) { // callback to handle <wps:ExecuteResponse>
+ OpenLayers.Console.debug("...callback is called...");
+ }
+ ]
+ });
+}
\ No newline at end of file
Added: sandbox/august/trunk/playground/wps/wps-zooapi.html
===================================================================
--- sandbox/august/trunk/playground/wps/wps-zooapi.html (rev 0)
+++ sandbox/august/trunk/playground/wps/wps-zooapi.html 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>ZooAPI WPS Test</title>
+ <!-- local OpenLayers library trunk+ -->
+ <!--
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css"/>
+ <script type="text/javascript" src="../../lib/Firebug/firebug.js"></script>
+ <script type="text/javascript" src="../../lib/OpenLayers.js"></script>
+ -->
+ <!-- remote OpenLayers library trunk+ with local firebug -->
+ <link rel="stylesheet" type="text/css" href="http://august-openlayers.appspot.com/openlayers/trunk+/theme/default/style.css"></script>
+ <script type="text/javascript" src="../../lib/Firebug/firebug.js"></script>
+ <script type="text/javascript" src="http://august-openlayers.appspot.com/openlayers/trunk+/OpenLayers.js"></script>
+
+ <!-- remote Zoo API -->
+ <script type="text/javascript" src="http://alex-js-lib.appspot.com/zooapi/snapshot/ZOO-api.js"></script>
+ <script type="text/javascript" src="http://alex-js-lib.appspot.com/zooapi/snapshot/ZOO-proj4js.js"></script>
+
+ <!-- other JavaScript library -->
+ <script type="text/javascript" src="wps-zooapi.js"></script>
+ </head>
+ <body onload="init();">
+ <input id="encode_capareq_btn" type="button" value="Encode GetCapabilities Req" onclick="encodeGetCapabilitiesReq();"/>
+ <input id="encode_descprocessreq_btn" type="button" value="Encode DescribeProcess Req" onclick="encodeDescribeProcessReq();"/>
+ <input id="encode_executereq_btn" type="button" value="Encode Execute Req" onclick="encodeExecuteReq();"/>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/wps/wps-zooapi.js
===================================================================
--- sandbox/august/trunk/playground/wps/wps-zooapi.js (rev 0)
+++ sandbox/august/trunk/playground/wps/wps-zooapi.js 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,16 @@
+function init() {
+ OpenLayers.Console.debug("...zoo api successfully loaded...");
+ // TODO:
+}
+
+function encodeGetCapabilitiesReq() {
+ // TODO:
+}
+
+function encodeDescribeProcessReq() {
+ // TODO:
+}
+
+function encodeExecuteReq() {
+ // TODO:
+}
Added: sandbox/august/trunk/playground/wps/wps.html
===================================================================
--- sandbox/august/trunk/playground/wps/wps.html (rev 0)
+++ sandbox/august/trunk/playground/wps/wps.html 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>OGC WPS Test</title>
+ <!-- OpenLayers library trunk+ -->
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css"/>
+ <script type="text/javascript" src="../../lib/Firebug/firebug.js"></script>
+ <script type="text/javascript" src="../../lib/OpenLayers.js"></script>
+ <!-- other JavaScript library -->
+ <script type="text/javascript" src="wps.js"></script>
+ </head>
+ <body onload="init();">
+ <div id="map" style="width:1024px;height:512px;margin-top:5px;margin-left:5px;background-color:#ffffff"></div>
+ <input id="parse_capa_btn" type="button" value="parse capabilities" onclick="parseCapabilities();"/>
+ <input id="parse_describeprocess_btn" type="button" value="parse describeprocess" onclick="parseDescribeProcess();"/>
+ <input id="execute_btn" type="button" value="Execute" onclick="execute();"/>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/wps/wps.js
===================================================================
--- sandbox/august/trunk/playground/wps/wps.js (rev 0)
+++ sandbox/august/trunk/playground/wps/wps.js 2010-12-03 07:09:36 UTC (rev 10946)
@@ -0,0 +1,147 @@
+var map;
+var wps_capabilities_format = new OpenLayers.Format.WPSCapabilities();
+var wps_describeprocess_format = new OpenLayers.Format.WPSDescribeProcess();
+
+function init() {
+
+ // set OpenLayers proxy
+ //OpenLayers.ProxyHost= "/openlayers-trunk/ApacheProxyServlet?url=";
+
+ OpenLayers.ProxyHost= function(url) {
+ return "/openlayers-trunk/ApacheProxyServlet?url=" + url;
+ };
+
+ var lon = -122.391667;
+ var lat = 37.760628;
+ var zoom = 10;
+
+ var options = {
+ //panMethod: null, // set 'panMethod' to null to disable animated panning
+ controls: [
+ new OpenLayers.Control.LayerSwitcher(),
+ new OpenLayers.Control.PanZoomBar(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.MousePosition()
+ ],
+ projection: "EPSG:900913",
+ units: "m",
+ maxResolution: 156543.0339,
+ numZoomLevels: 20, // default allowed zoom levels is 16 so change it to 20
+ maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)
+ };
+
+ map = new OpenLayers.Map('map', options);
+
+ var base_layer = new OpenLayers.Layer.AgsTiled(
+ "World Topo Map",
+ "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/",
+ //"World Imagery Map",
+ //"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/",
+ {
+ tileSize: new OpenLayers.Size(256,256),
+ tileFormat:'jpg',
+ tileOrigin: new OpenLayers.LonLat(-20037508.342789, 20037508.342789),
+ tileFullExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
+ isBaseLayer: true,
+ singleTile: false
+ }
+ );
+ map.addLayer(base_layer);
+ // transform lon/lat to coordinate in EPSG:900913
+ map.setCenter(
+ new OpenLayers.LonLat(lon, lat).transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ map.getProjectionObject()
+ ),
+ zoom
+ );
+}
+
+function parseCapabilities() {
+ //OpenLayers.loadURL("response/52north-wps-getcapabilities-customized.xml", null, null, onCapabilitiesLoaded);
+ OpenLayers.loadURL("http://sazabi:8080/52n-wps-webapp-2.0-RC6-SNAPSHOT/WebProcessingService?Request=GetCapabilities&Service=WPS&Version=1.0.0", null, null, onCapabilitiesLoaded);
+}
+
+function onCapabilitiesLoaded(request) {
+ var capabilities = wps_capabilities_format.read(request.responseXML || request.responseText);
+ OpenLayers.Console.debug("...service type: " + capabilities.service + "...");
+ OpenLayers.Console.debug("...service version: " + capabilities.version + "...");
+ OpenLayers.Console.debug("...service updateSequence: " + capabilities.updateSequence + "...");
+ if(capabilities && capabilities.processOfferings instanceof Array) {
+ for(var i=0; i<capabilities.processOfferings.length; i++) {
+ var process = capabilities.processOfferings[i];
+ OpenLayers.Console.debug("...process: " + process.identifier + "...processVersion: " + process.processVersion + "...");
+ }
+ } else {
+ OpenLayers.Console.debug("... no process found...");
+ }
+}
+
+function parseDescribeProcess() {
+ //OpenLayers.loadURL("response/52north-wps-describeprocess.xml", null, null, onCapabilitiesLoaded);
+ OpenLayers.loadURL("http://sazabi:8080/52n-wps-webapp-2.0-RC6-SNAPSHOT/WebProcessingService?Request=DescribeProcess&service=WPS&identifier=org.n52.wps.server.algorithm.SimpleBufferAlgorithm", null, null, onDescribeProcessLoaded);
+}
+
+function onDescribeProcessLoaded(request) {
+ var describeprocess = wps_describeprocess_format.read(request.responseXML || request.responseText);
+ OpenLayers.Console.debug("...omit details of DescribeProcess response...");
+ OpenLayers.Console.debug("...DescribeProcess response parsed...");
+}
+
+function onExecuteSuccess(request) {
+ var executeResponse = wps_format.read(request.responseXML || request.responseText);
+ OpenLayers.Console.debug("...executeResponse parsed...");
+}
+
+function executeComplete(response) {
+ var wfst_format = new OpenLayers.Format.WFSTWithLock(
+ {
+ version:"1.0.0",
+ featureNS: "http://www.esri.com",
+ featurePrefix: "highways",
+ featureType: "highways",
+ extractAttributes: false,
+ xy: true
+ }
+ );
+ var features = wfst_format.read(response.responseXML);
+ var vectorLayer = new OpenLayers.Layer.Vector();
+ vectorLayer.addFeatures(features);
+ map.addLayer(vectorLayer);
+}
+
+function execute() {
+
+ OpenLayers.loadURL(
+ // create wps execute request for 'SimpleBufferAlgorithm' process
+ "request/52n_wps_server_aimplebufferalgorithm_execute_rawdataoutput.json",
+ // create wps execute request for 'hillshade' process
+ // "request/52n_wps_sextante_hillshade_execute_responsedocument.json",
+ // create wps execute request for 'contourline' process
+ // "request/52n_wps_sextante_contourline_execute_rawdataoutput.json",
+ {}, // request parameters
+ this,
+ function(response) { // success handler
+ var json_format = new OpenLayers.Format.JSON();
+ // read wps execute request information from a json string
+ var reqObj = json_format.read(response.responseText);
+ // assemble the wps execute request
+ var req = wps_format.writeNode("wps:Execute", reqObj);
+ var reqXml = wps_format.write(req);
+ // print out the request xml body
+ OpenLayers.Console.debug(reqXml);
+ // send the request
+ OpenLayers.Request.POST({
+ url: "http://sazabi:8080/52n-wps-webapp-2.0-RC6-SNAPSHOT/WebProcessingService",
+ callback: function(response) {
+ OpenLayers.Console.debug("...execution completed...");
+ },
+ params: {},
+ headers: {},
+ data: data
+ });
+ },
+ function(response) {} // error handler
+ );
+}
+
More information about the Commits
mailing list