superedit-OPEN_LAYERS_WPS.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. <?php
  2. /**
  3. * http://openlayers.org/dev/examples/wps.html
  4. * http://geoinformatyka.com.pl/usluga-wfs-jak-to-dziala/
  5. *
  6. * TODO: brak ModifyFeature - html btn: olControlModifyFeatureItemInactive
  7. */
  8. function OPEN_LAYERS_WPS() {
  9. $task = V::get('task', '', $_GET);
  10. switch ($task) {
  11. case 'proxy':
  12. $url = V::get('url', '', $_GET);
  13. // http%3A%2F%2Fbiuro.biall-net.pl%2Fwps%3FSERVICE%3DWPS%26REQUEST%3DGetCapabilities
  14. header('Content-Type: application/xml; charset=utf-8');
  15. $urlParts = parse_url($url);
  16. $urlQuery = array();
  17. $urlQueryTmp = V::get('query', '', $urlParts);
  18. $urlQueryTmp = explode('&', $urlQueryTmp);
  19. foreach ($urlQueryTmp as $vQuery) {
  20. $parts = explode('=', $vQuery, 2);
  21. $urlQuery[$parts[0]] = $parts[1];
  22. }
  23. if ('WPS' == V::get('SERVICE', '', $urlQuery)) {
  24. $req = V::get('REQUEST', '', $urlQuery);
  25. $wps = new WpsServer();
  26. $methodName = "{$req}Action";
  27. if (method_exists($wps, $methodName)) {
  28. $wps->$methodName();
  29. }
  30. }
  31. exit;
  32. break;
  33. default:
  34. }
  35. //$_POST['url'] = 'http://demo.opengeo.org/geoserver/wfs';
  36. //$entityBody = file_get_contents('php://input');
  37. $url = V::get('_url', '', $_GET);
  38. if ($url) {// @see OpenLayers/examples/proxy.cgi
  39. $allowedHosts = array('www.openlayers.org', 'openlayers.org',
  40. 'labs.metacarta.com', 'world.freemap.in',
  41. 'prototype.openmnnd.org', 'geo.openplans.org',
  42. 'sigma.openplans.org', 'demo.opengeo.org',
  43. 'www.openstreetmap.org', 'sample.azavea.com',
  44. 'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080',
  45. 'vmap0.tiles.osgeo.org', 'www.openrouteservice.org',
  46. 'maps.wien.gv.at');
  47. if (!empty($_POST)) {
  48. // qs = os.environ["QUERY_STRING"]
  49. // d = cgi.parse_qs(qs)
  50. // if d.has_key("url"):
  51. // url = d["url"][0]
  52. // else:
  53. // url = "http://www.openlayers.org"
  54. }
  55. else {
  56. // fs = cgi.FieldStorage()
  57. // url = fs.getvalue('url', "http://www.openlayers.org")
  58. }
  59. $host = explode('/', $url);
  60. $host = $host[2];
  61. if (!in_array($host, $allowedHosts)) {
  62. header("Status: 502 Bad Gateway");
  63. header("Content-Type: text/plain");
  64. echo "\nThis proxy does not allow you to access that location ({$host}).";
  65. exit;
  66. }
  67. else if (substr($url, 0, 7) == 'http://' || substr($url, 0, 8) == 'https://') {
  68. $ch = curl_init();
  69. if (!empty($_POST)) {
  70. /*
  71. length = int(os.environ["CONTENT_LENGTH"])
  72. headers = {"Content-Type": os.environ["CONTENT_TYPE"]}
  73. body = sys.stdin.read(length)
  74. r = urllib2.Request(url, body, headers)
  75. y = urllib2.urlopen(r)
  76. */
  77. }
  78. else {
  79. curl_setopt($ch, CURLOPT_URL, $url);
  80. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// return the transfer as a string
  81. //curl_setopt($ch, CURLOPT_VERBOSE, 1);
  82. curl_setopt($ch, CURLOPT_HEADER, 1);
  83. $response = curl_exec($ch);
  84. // Then, after your curl_exec call:
  85. $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
  86. $header = substr($response, 0, $header_size);
  87. $body = substr($response, $header_size);
  88. curl_close($ch);
  89. $contentType = 'text/plain';
  90. $headers = explode("\n", $header);
  91. foreach ($headers as $vHeader) {
  92. if (substr($vHeader, 0, 13) == 'Content-Type:') {
  93. $contentType = trim(substr($vHeader, 14));
  94. }
  95. }
  96. header("Content-Type: {$contentType}");
  97. echo $body . "\n";
  98. }
  99. }
  100. else {
  101. header("Content-Type: text/plain");
  102. echo "\nIllegal request.";
  103. exit;
  104. }
  105. exit;
  106. }
  107. ?>
  108. <link rel="stylesheet" href="stuff/open-layers/theme/default/style.css" type="text/css">
  109. <link rel="stylesheet" href="stuff/open-layers/style.css" type="text/css">
  110. <style type="text/css">
  111. .olControlEditingToolbar .olControlModifyFeatureItemInactive {
  112. background-image: url(stuff/open-layers/theme/default/img/draw_point_off.png);
  113. }
  114. .olControlEditingToolbar .olControlModifyFeatureItemActive {
  115. background-image: url(stuff/open-layers/theme/default/img/draw_point_on.png);
  116. }
  117. textarea {
  118. display: block;
  119. width: 100%;
  120. height: 3em;
  121. }
  122. label {
  123. display: block;
  124. }
  125. .notsupported {
  126. color: red;
  127. }
  128. button {
  129. display: block;
  130. margin-top: 10px;
  131. }
  132. #docs {
  133. top: 6em;
  134. left: 550px;
  135. position: absolute;
  136. margin-right: 10px;
  137. }
  138. </style>
  139. <h1 id="title">WPS Builder Example</h1>
  140. <div id="tags">
  141. wps, process, advanced
  142. </div>
  143. <div id="shortdesc">Using WPS formats to interact with WPS</div>
  144. <div id="docs">
  145. <p>This example shows WPS in action by using the WPSCapabilities,
  146. WPSDescribeProcess and WPSExecute formats. See
  147. <a target="_blank" href="wps.js">wps.js</a> for the
  148. source code. <b>Note: For applications using WPS, the high level
  149. approach shown in the <a href="wps-client.html">wps-client</a> example
  150. is recommended instead.</b></p>
  151. <ol>
  152. <li>Select a process from the list below the map. The list is
  153. populated with the result of a WPS GetCapabilities request, parsed
  154. using <code>OpenLayers.Format.WPSCapabilities::read</code>.</li>
  155. <li>Fill out the Input form. Hover over fields to get a description.
  156. Required fields are marked with a "*".
  157. To use a geometry from the map as input, select the geometry on the
  158. map (using the pen symbol on the left of the toolbar) and just
  159. click the field. The form is generated from the object returned by
  160. <code>OpenLayers.Format.WPSDescribeProcess::read</code></li>
  161. <li>Click "Execute" and examine the result in the result text area.
  162. If the result can be parsed as features, it will be displayed on
  163. the map as well. The process data is sent to the server with the
  164. serialized XML from <code>OpenLayers.Format.WPSExecute::write</code>,
  165. which can use a modified
  166. <code>OpenLayers.Format.WPSDescribeProcess</code> result object as
  167. input.</li>
  168. </ol>
  169. </div>
  170. <div id="example" style="width:520px">
  171. <div id="map" class="smallmap"></div>
  172. <div>
  173. <select id="processes"><option>Select a process</option></select>
  174. <p id="abstract"></p>
  175. <div id="input"></div>
  176. <div id="output"></div>
  177. </div>
  178. </div>
  179. <script src="stuff/open-layers/lib/OpenLayers.js"></script>
  180. <!-- <script src="stuff/open-layers/wps.js"></script> -->
  181. <script>
  182. //OpenLayers.ProxyHost = "proxy.cgi?url=";
  183. //OpenLayers.ProxyHost = "index.php?FUNCTION_INIT=OPEN_LAYERS_WPS&HEADER_NOT_INIT=YES&_url=";
  184. OpenLayers.ProxyHost = "index.php?FUNCTION_INIT=<?php echo __FUNCTION__; ?>&HEADER_NOT_INIT=YES&task=proxy&url=";
  185. var wps = 'http://biuro.biall-net.pl/wps',//"http://demo.opengeo.org/geoserver/wps",
  186. capabilities, // the capabilities, read by Format.WPSCapabilities::read
  187. process; // the process description from Format.WPSDescribeProcess::read
  188. // get some capabilities
  189. getCapabilities();
  190. // create the UI
  191. var layer = new OpenLayers.Layer.Vector("Scratchpad");
  192. /*
  193. var saveStrategy = new OpenLayers.Strategy.Save();
  194. var wfsLayer = new OpenLayers.Layer.Vector("Editable Features", {
  195. strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
  196. projection: new OpenLayers.Projection("EPSG:4326"),
  197. protocol: new OpenLayers.Protocol.WFS({
  198. version: "1.1.0",
  199. srsName: "EPSG:4326",
  200. url: "http://demo.opengeo.org/geoserver/wfs",
  201. featureNS : "http://opengeo.org",
  202. featureType: "restricted",
  203. geometryName: "the_geom",
  204. schema: "http://demo.opengeo.org/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=og:restricted",
  205. outputFormat: 'json'
  206. })
  207. });
  208. */
  209. var toolbar = new OpenLayers.Control.EditingToolbar(layer);
  210. toolbar.addControls([new OpenLayers.Control.ModifyFeature(layer, {
  211. title: "Select feature"
  212. })]);
  213. var map = new OpenLayers.Map('map', {
  214. controls: [
  215. toolbar,
  216. new OpenLayers.Control.ZoomPanel(),
  217. new OpenLayers.Control.PanPanel()
  218. ],
  219. layers: [
  220. new OpenLayers.Layer.WMS(
  221. "OSM", "http://maps.opengeo.org/geowebcache/service/wms",
  222. {layers: "openstreetmap", format: "image/png"}
  223. ),
  224. layer
  225. // , wfsLayer
  226. ]
  227. });
  228. map.zoomToMaxExtent();
  229. // add behavior to html elements
  230. document.getElementById("processes").onchange = describeProcess;
  231. // using OpenLayers.Format.WPSCapabilities to read the capabilities
  232. function getCapabilities() {
  233. OpenLayers.Request.GET({
  234. url: wps,
  235. params: {
  236. "SERVICE": "WPS",
  237. "REQUEST": "GetCapabilities"
  238. },
  239. success: function(response){
  240. capabilities = new OpenLayers.Format.WPSCapabilities().read(
  241. response.responseText
  242. );
  243. var dropdown = document.getElementById("processes");
  244. var offerings = capabilities.processOfferings, option;
  245. // populate the dropdown
  246. for (var p in offerings) {
  247. option = document.createElement("option");
  248. option.innerHTML = offerings[p].identifier;
  249. option.value = p;
  250. dropdown.appendChild(option);
  251. }
  252. }
  253. });
  254. }
  255. // using OpenLayers.Format.WPSDescribeProcess to get information about a
  256. // process
  257. function describeProcess() {
  258. var selection = this.options[this.selectedIndex].value;
  259. OpenLayers.Request.GET({
  260. url: wps,
  261. params: {
  262. "SERVICE": "WPS",
  263. "REQUEST": "DescribeProcess",
  264. "VERSION": capabilities.version,
  265. "IDENTIFIER": selection
  266. },
  267. success: function(response) {
  268. process = new OpenLayers.Format.WPSDescribeProcess().read(
  269. response.responseText
  270. ).processDescriptions[selection];
  271. buildForm();
  272. }
  273. });
  274. }
  275. // dynamically create a form from the process description
  276. function buildForm() {
  277. document.getElementById("abstract").innerHTML = process["abstract"];
  278. document.getElementById("input").innerHTML = "<h3>Input:</h3>";
  279. document.getElementById("output").innerHTML = "";
  280. var inputs = process.dataInputs, supported = true,
  281. sld = "text/xml; subtype=sld/1.0.0",
  282. input;
  283. for (var i=0,ii=inputs.length; i<ii; ++i) {
  284. input = inputs[i];
  285. if (input.complexData) {
  286. var formats = input.complexData.supported.formats;
  287. if (formats["application/wkt"]) {
  288. addWKTInput(input);
  289. } else if (formats["text/xml; subtype=wfs-collection/1.0"]) {
  290. addWFSCollectionInput(input);
  291. } else if (formats["image/tiff"]) {
  292. addRasterInput(input);
  293. } else if (formats[sld]) {
  294. addXMLInput(input, sld);
  295. } else {
  296. supported = false;
  297. }
  298. } else if (input.boundingBoxData) {
  299. addBoundingBoxInput(input);
  300. } else if (input.literalData) {
  301. addLiteralInput(input);
  302. } else {
  303. supported = false;
  304. }
  305. if (input.minOccurs > 0) {
  306. document.getElementById("input").appendChild(document.createTextNode("* "));
  307. }
  308. }
  309. if (supported) {
  310. var executeButton = document.createElement("button");
  311. executeButton.innerHTML = "Execute";
  312. document.getElementById("input").appendChild(executeButton);
  313. executeButton.onclick = execute;
  314. } else {
  315. document.getElementById("input").innerHTML = '<span class="notsupported">' +
  316. "Sorry, the WPS builder does not support the selected process." +
  317. "</span>";
  318. }
  319. }
  320. // helper function to dynamically create a textarea for geometry (WKT) data
  321. // input
  322. function addWKTInput(input, previousSibling) {
  323. var name = input.identifier;
  324. var container = document.getElementById("input");
  325. var label = document.createElement("label");
  326. label["for"] = name;
  327. label.title = input["abstract"];
  328. label.innerHTML = name + " (select feature, then click field):";
  329. previousSibling && previousSibling.nextSibling ?
  330. container.insertBefore(label, previousSibling.nextSibling) :
  331. container.appendChild(label);
  332. var field = document.createElement("textarea");
  333. field.onclick = function () {
  334. if (layer.selectedFeatures.length) {
  335. this.innerHTML = new OpenLayers.Format.WKT().write(
  336. layer.selectedFeatures[0]
  337. );
  338. }
  339. createCopy(input, this, addWKTInput);
  340. };
  341. field.onblur = function() {
  342. input.data = field.value ? {
  343. complexData: {
  344. mimeType: "application/wkt",
  345. value: this.value
  346. }
  347. } : undefined;
  348. };
  349. field.title = input["abstract"];
  350. field.id = name;
  351. previousSibling && previousSibling.nextSibling ?
  352. container.insertBefore(field, previousSibling.nextSibling.nextSibling) :
  353. container.appendChild(field);
  354. }
  355. // helper function for xml input
  356. function addXMLInput(input, type) {
  357. var name = input.identifier;
  358. var field = document.createElement("input");
  359. field.title = input["abstract"];
  360. field.value = name + " (" + type + ")";
  361. field.onblur = function() {
  362. input.data = field.value ? {
  363. complexData: {
  364. mimeType: type,
  365. value: this.value
  366. }
  367. } : undefined;
  368. };
  369. document.getElementById("input").appendChild(field);
  370. }
  371. // helper function to dynamically create a WFS collection reference input
  372. function addWFSCollectionInput(input) {
  373. var name = input.identifier;
  374. var field = document.createElement("input");
  375. field.title = input["abstract"];
  376. field.value = name + " (layer on demo server)";
  377. addValueHandlers(field, function() {
  378. input.reference = field.value ? {
  379. mimeType: "text/xml; subtype=wfs-collection/1.0",
  380. href: "http://geoserver/wfs",
  381. method: "POST",
  382. body: {
  383. wfs: {
  384. version: "1.0.0",
  385. outputFormat: "GML2",
  386. featureType: field.value
  387. }
  388. }
  389. } : undefined;
  390. });
  391. document.getElementById("input").appendChild(field);
  392. }
  393. // helper function to dynamically create a raster (GeoTIFF) url input
  394. function addRasterInput(input) {
  395. var name = input.identifier;
  396. var field = document.createElement("input");
  397. field.title = input["abstract"];
  398. var url = window.location.href.split("?")[0];
  399. field.value = url.substr(0, url.lastIndexOf("/")+1) + "data/tazdem.tiff";
  400. document.getElementById("input").appendChild(field);
  401. (field.onblur = function() {
  402. input.reference = {
  403. mimeType: "image/tiff",
  404. href: field.value,
  405. method: "GET"
  406. };
  407. })();
  408. }
  409. // helper function to dynamically create a bounding box input
  410. function addBoundingBoxInput(input) {
  411. var name = input.identifier;
  412. var field = document.createElement("input");
  413. field.title = input["abstract"];
  414. field.value = "left,bottom,right,top (EPSG:4326)";
  415. document.getElementById("input").appendChild(field);
  416. addValueHandlers(field, function() {
  417. input.boundingBoxData = {
  418. projection: "EPSG:4326",
  419. bounds: OpenLayers.Bounds.fromString(field.value)
  420. };
  421. });
  422. }
  423. // helper function to create a literal input textfield or dropdown
  424. function addLiteralInput(input, previousSibling) {
  425. var name = input.identifier;
  426. var container = document.getElementById("input");
  427. var anyValue = input.literalData.anyValue;
  428. // anyValue means textfield, otherwise we create a dropdown
  429. var field = document.createElement(anyValue ? "input" : "select");
  430. field.id = name;
  431. field.title = input["abstract"];
  432. previousSibling && previousSibling.nextSibling ?
  433. container.insertBefore(field, previousSibling.nextSibling) :
  434. container.appendChild(field);
  435. if (anyValue) {
  436. var dataType = input.literalData.dataType;
  437. field.value = name + (dataType ? " (" + dataType + ")" : "");
  438. addValueHandlers(field, function() {
  439. input.data = field.value ? {
  440. literalData: {
  441. value: field.value
  442. }
  443. } : undefined;
  444. createCopy(input, field, addLiteralInput);
  445. });
  446. } else {
  447. var option;
  448. option = document.createElement("option");
  449. option.innerHTML = name;
  450. field.appendChild(option);
  451. for (var v in input.literalData.allowedValues) {
  452. option = document.createElement("option");
  453. option.value = v;
  454. option.innerHTML = v;
  455. field.appendChild(option);
  456. }
  457. field.onchange = function() {
  458. createCopy(input, field, addLiteralInput);
  459. input.data = this.selectedIndex ? {
  460. literalData: {
  461. value: this.options[this.selectedIndex].value
  462. }
  463. } : undefined;
  464. };
  465. }
  466. }
  467. // if maxOccurs is > 1, this will add a copy of the field
  468. function createCopy(input, field, fn) {
  469. if (input.maxOccurs && input.maxOccurs > 1 && !field.userSelected) {
  470. // add another copy of the field - we don't check maxOccurs
  471. field.userSelected = true;
  472. var newInput = OpenLayers.Util.extend({}, input);
  473. // we recognize copies by the occurrence property
  474. newInput.occurrence = (input.occurrence || 0) + 1;
  475. process.dataInputs.push(newInput);
  476. fn(newInput, field);
  477. }
  478. }
  479. // helper function for adding events to form fields
  480. function addValueHandlers(field, onblur) {
  481. field.onclick = function() {
  482. if (!this.initialValue) {
  483. this.initialValue = this.value;
  484. this.value = "";
  485. }
  486. };
  487. field.onblur = function() {
  488. if (!this.value) {
  489. this.value = this.initialValue;
  490. delete this.initialValue;
  491. }
  492. onblur.apply(this, arguments);
  493. };
  494. }
  495. // execute the process
  496. function execute() {
  497. var output = process.processOutputs[0];
  498. var input;
  499. // remove occurrences that the user has not filled out
  500. for (var i=process.dataInputs.length-1; i>=0; --i) {
  501. input = process.dataInputs[i];
  502. if ((input.minOccurs === 0 || input.occurrence) && !input.data && !input.reference) {
  503. OpenLayers.Util.removeItem(process.dataInputs, input);
  504. }
  505. }
  506. process.responseForm = {
  507. rawDataOutput: {
  508. identifier: output.identifier
  509. }
  510. };
  511. if (output.complexOutput && output.complexOutput.supported.formats["application/wkt"]) {
  512. process.responseForm.rawDataOutput.mimeType = "application/wkt";
  513. }
  514. OpenLayers.Request.POST({
  515. url: wps,
  516. data: new OpenLayers.Format.WPSExecute().write(process),
  517. success: showOutput
  518. });
  519. }
  520. // add the process's output to the page
  521. function showOutput(response) {
  522. var result = document.getElementById("output");
  523. result.innerHTML = "<h3>Output:</h3>";
  524. var features;
  525. var contentType = response.getResponseHeader("Content-Type");
  526. if (contentType == "application/wkt") {
  527. features = new OpenLayers.Format.WKT().read(response.responseText);
  528. } else if (contentType == "text/xml; subtype=wfs-collection/1.0") {
  529. features = new OpenLayers.Format.WFST.v1_0_0().read(response.responseText);
  530. }
  531. if (features && (features instanceof OpenLayers.Feature.Vector || features.length)) {
  532. layer.addFeatures(features);
  533. result.innerHTML += "The result should also be visible on the map.";
  534. }
  535. result.innerHTML += "<textarea>" + response.responseText + "</textarea>";
  536. }
  537. </script>
  538. <?php
  539. function get_location($ip) {
  540. $content = @file_get_contents('http://api.hostip.info/?ip='.$ip);
  541. if ($content != FALSE) {
  542. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">content (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($content);echo'</pre>';
  543. $xml = new SimpleXmlElement($content);
  544. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">xml (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($xml);echo'</pre>';
  545. $coordinates = $xml->children('gml', TRUE)->featureMember->children('', TRUE)->Hostip->ipLocation->children('gml', TRUE)->pointProperty->Point->coordinates;
  546. $longlat = explode(',', $coordinates);
  547. $location['longitude'] = $longlat[0];
  548. $location['latitude'] = $longlat[1];
  549. $location['citystate'] = '==>'.$xml->children('gml', TRUE)->featureMember->children('', TRUE)->Hostip->children('gml', TRUE)->name;
  550. $location['country'] = '==>'.$xml->children('gml', TRUE)->featureMember->children('', TRUE)->Hostip->countryName;
  551. return $location;
  552. }
  553. else return false;
  554. }
  555. $ip = '94.158.130.34';// biuro.biall-net.pl
  556. $location_info = get_location($ip);
  557. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">location_info('.$ip.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($location_info);echo'</pre>';
  558. /*
  559. $the_xml = file_get_contents('');
  560. $feed = new SimpleXMLElement($the_xml);
  561. $namespaces = $feed->getNamespaces(true);
  562. foreach ($feed->entry as $entry) {
  563. $event = $entry->children($namespaces['gd']);
  564. echo "<p>Event = " . $entry->title . "<br />startTime = " . $event->when->startTime . " and endTime = " . $event->when->endTime . "</p>\n";
  565. }
  566. */
  567. }
  568. class WpsServer {
  569. public function getCapabilitiesAction() {
  570. echo '<?xml version="1.0" encoding="UTF-8"?>';
  571. ?>
  572. <wps:Capabilities xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en" service="WPS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  573. <ows:ServiceIdentification>
  574. <ows:Title>Prototype GeoServer WPS</ows:Title>
  575. <ows:Abstract />
  576. <ows:Keywords>
  577. <ows:Keyword>wps</ows:Keyword>
  578. <ows:Keyword>geoserver</ows:Keyword>
  579. </ows:Keywords>
  580. <ows:ServiceType>WPS</ows:ServiceType>
  581. <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
  582. <ows:Fees>NONE</ows:Fees>
  583. <ows:AccessConstraints>NONE</ows:AccessConstraints>
  584. </ows:ServiceIdentification>
  585. <ows:ServiceProvider>
  586. <ows:ProviderName>GeoServer</ows:ProviderName>
  587. <ows:ProviderSite />
  588. <ows:ServiceContact />
  589. </ows:ServiceProvider>
  590. <ows:OperationsMetadata>
  591. <ows:Operation name="GetCapabilities">
  592. <ows:DCP>
  593. <ows:HTTP>
  594. <ows:Get xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  595. <ows:Post xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  596. </ows:HTTP>
  597. </ows:DCP>
  598. </ows:Operation>
  599. <ows:Operation name="DescribeProcess">
  600. <ows:DCP>
  601. <ows:HTTP>
  602. <ows:Get xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  603. <ows:Post xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  604. </ows:HTTP>
  605. </ows:DCP>
  606. </ows:Operation>
  607. <ows:Operation name="Execute">
  608. <ows:DCP>
  609. <ows:HTTP>
  610. <ows:Get xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  611. <ows:Post xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  612. </ows:HTTP>
  613. </ows:DCP>
  614. </ows:Operation>
  615. </ows:OperationsMetadata>
  616. <wps:ProcessOfferings>
  617. <wps:Process wps:processVersion="1.0.0">
  618. <ows:Identifier>pozdrawiam</ows:Identifier>
  619. <ows:Title>Area</ows:Title>
  620. <ows:Abstract>Returns the area of a geometry, in the units of the geometry. Assumes a Cartesian plane, so this process is only recommended for non-geographic CRSes.</ows:Abstract>
  621. </wps:Process>
  622. </wps:ProcessOfferings>
  623. <wps:Languages>
  624. <wps:Default>
  625. <ows:Language>en-US</ows:Language>
  626. </wps:Default>
  627. <wps:Supported>
  628. <ows:Language>en-US</ows:Language>
  629. </wps:Supported>
  630. </wps:Languages>
  631. </wps:Capabilities>
  632. <?php
  633. }
  634. }