|
|
@@ -36,8 +36,6 @@ function OPEN_LAYERS_WPS() {
|
|
|
else {
|
|
|
$wps = new WpsServer();
|
|
|
$wps->parseXMLRequest();
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
exit;
|
|
|
break;
|
|
|
@@ -214,6 +212,7 @@ function OPEN_LAYERS_WPS() {
|
|
|
OpenLayers.ProxyHost = "index.php?FUNCTION_INIT=<?php echo __FUNCTION__; ?>&HEADER_NOT_INIT=YES&task=proxy&url=";
|
|
|
|
|
|
var wps = 'http://biuro.biall-net.pl/wps',//"http://demo.opengeo.org/geoserver/wps",
|
|
|
+ wfsUrl = 'http://biuro.biall-net.pl/wps',// http://demo.opengeo.org/geoserver/wfs
|
|
|
capabilities, // the capabilities, read by Format.WPSCapabilities::read
|
|
|
process; // the process description from Format.WPSDescribeProcess::read
|
|
|
|
|
|
@@ -221,7 +220,19 @@ var wps = 'http://biuro.biall-net.pl/wps',//"http://demo.opengeo.org/geoserver/w
|
|
|
getCapabilities();
|
|
|
|
|
|
// create the UI
|
|
|
-var layer = new OpenLayers.Layer.Vector("Scratchpad");
|
|
|
+var layer = new OpenLayers.Layer.Vector("Scratchpad", {
|
|
|
+ strategies: [new OpenLayers.Strategy.BBOX()],
|
|
|
+ projection: new OpenLayers.Projection("EPSG:4326"),
|
|
|
+ protocol: new OpenLayers.Protocol.WFS({
|
|
|
+ version: "1.1.0",
|
|
|
+ srsName: "EPSG:4326",
|
|
|
+ url: wfsUrl,
|
|
|
+ featureNS : "http://biuro.biall-net.pl",
|
|
|
+ featureType: "restricted",
|
|
|
+ geometryName: "the_geom",
|
|
|
+ schema: "http://demo.opengeo.org/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=og:restricted"
|
|
|
+ })
|
|
|
+});
|
|
|
|
|
|
/*
|
|
|
var saveStrategy = new OpenLayers.Strategy.Save();
|
|
|
@@ -245,7 +256,13 @@ var toolbar = new OpenLayers.Control.EditingToolbar(layer);
|
|
|
toolbar.addControls([new OpenLayers.Control.ModifyFeature(layer, {
|
|
|
title: "Select feature"
|
|
|
})]);
|
|
|
+var extent = new OpenLayers.Bounds(
|
|
|
+ -11593508, 5509847, -11505759, 5557774
|
|
|
+);
|
|
|
var map = new OpenLayers.Map('map', {
|
|
|
+ projection: new OpenLayers.Projection("EPSG:900913"),
|
|
|
+ displayProjection: new OpenLayers.Projection("EPSG:4326"),
|
|
|
+ restrictedExtent: extent,
|
|
|
controls: [
|
|
|
toolbar,
|
|
|
new OpenLayers.Control.ZoomPanel(),
|
|
|
@@ -661,19 +678,109 @@ class WpsActionPrzypiszDoRekordu extends WpsActionBase {
|
|
|
|
|
|
}
|
|
|
|
|
|
+class WfsAction {
|
|
|
+ public function execute($args) {
|
|
|
+ echo '<?xml version="1.0" encoding="UTF-8"?>';
|
|
|
+ ?>
|
|
|
+<wfs:FeatureCollection xmlns:nasa="http://nasa.gov" xmlns:topp="http://www.openplans.org/topp" xmlns:usgs="http://www.usgs.gov/" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ows="http://www.opengis.net/ows" xmlns:ne="http://naturalearthdata.com" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:osm="http://openstreemap.org" xmlns:nurc="http://www.nurc.nato.int" xmlns:og="http://opengeo.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfFeatures="4" timeStamp="2014-07-16T13:22:43.307Z" xsi:schemaLocation="http://opengeo.org http://demo.opengeo.org:80/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=og%3Arestricted http://www.opengis.net/wfs http://demo.opengeo.org:80/geoserver/schemas/wfs/1.1.0/wfs.xsd">
|
|
|
+ <gml:boundedBy>
|
|
|
+ <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
|
|
|
+ <gml:lowerCorner>-360 -180</gml:lowerCorner>
|
|
|
+ <gml:upperCorner>360 180</gml:upperCorner>
|
|
|
+ </gml:Envelope>
|
|
|
+ </gml:boundedBy>
|
|
|
+ <gml:featureMembers>
|
|
|
+ <og:restricted gml:id="restricted.1">
|
|
|
+ <gml:boundedBy>
|
|
|
+ <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
|
|
|
+ <gml:lowerCorner>-360 -180</gml:lowerCorner>
|
|
|
+ <gml:upperCorner>360 180</gml:upperCorner>
|
|
|
+ </gml:Envelope>
|
|
|
+ </gml:boundedBy>
|
|
|
+ <og:the_geom>
|
|
|
+ <gml:MultiSurface srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
|
|
|
+ <gml:surfaceMember>
|
|
|
+ <gml:Polygon srsDimension="2">
|
|
|
+ <gml:exterior>
|
|
|
+ <gml:LinearRing srsDimension="2">
|
|
|
+ <gml:posList>-64.1162109375 56.546630859375 -116.1474609375 -13.062744140625 61.7431640625 -64.390869140625 151.7431640625 19.984130859375 82.8369140625 57.952880859375 -64.1162109375 56.546630859375</gml:posList>
|
|
|
+ </gml:LinearRing>
|
|
|
+ </gml:exterior>
|
|
|
+ </gml:Polygon>
|
|
|
+ </gml:surfaceMember>
|
|
|
+ </gml:MultiSurface>
|
|
|
+ </og:the_geom>
|
|
|
+ <og:cat>1</og:cat>
|
|
|
+ </og:restricted>
|
|
|
+ <og:restricted gml:id="restricted.2">
|
|
|
+ <gml:boundedBy>
|
|
|
+ <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
|
|
|
+ <gml:lowerCorner>-360 -180</gml:lowerCorner>
|
|
|
+ <gml:upperCorner>360 180</gml:upperCorner>
|
|
|
+ </gml:Envelope>
|
|
|
+ </gml:boundedBy>
|
|
|
+ <og:the_geom>
|
|
|
+ <gml:MultiSurface srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
|
|
|
+ <gml:surfaceMember>
|
|
|
+ <gml:Polygon srsDimension="2">
|
|
|
+ <gml:exterior>
|
|
|
+ <gml:LinearRing srsDimension="2">
|
|
|
+ <gml:posList>-103.82895750481849 44.46495057049679 -103.8291005757557 44.474223371969366 -103.82430510019444 44.47419248258926 -103.8250130480148 44.47191042763971 -103.82616351387962 44.4709039658482 -103.82626189427795 44.46985333633981 -103.82769678669796 44.468052256180485 -103.82798329257464 44.46762193043404 -103.8284396012345 44.466849539356595 -103.82876017349398 44.46569787858342 -103.82881399754699 44.465409718735884 -103.82895750481849 44.46495057049679</gml:posList>
|
|
|
+ </gml:LinearRing>
|
|
|
+ </gml:exterior>
|
|
|
+ </gml:Polygon>
|
|
|
+ </gml:surfaceMember>
|
|
|
+ </gml:MultiSurface>
|
|
|
+ </og:the_geom>
|
|
|
+ <og:cat>2</og:cat>
|
|
|
+ </og:restricted>
|
|
|
+ <og:restricted gml:id="restricted.3">
|
|
|
+ <gml:boundedBy>
|
|
|
+ <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
|
|
|
+ <gml:lowerCorner>-360 -180</gml:lowerCorner>
|
|
|
+ <gml:upperCorner>360 180</gml:upperCorner>
|
|
|
+ </gml:Envelope>
|
|
|
+ </gml:boundedBy>
|
|
|
+ <og:the_geom>
|
|
|
+ <gml:MultiSurface srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
|
|
|
+ <gml:surfaceMember>
|
|
|
+ <gml:Polygon srsDimension="2">
|
|
|
+ <gml:exterior>
|
|
|
+ <gml:LinearRing srsDimension="2">
|
|
|
+ <gml:posList>-103.76667007954185 44.40446480019764 -103.74902136903249 44.40436551670597 -103.74907639625017 44.39448281245848 -103.7666862908511 44.394471734835 -103.76667007954185 44.40446480019764</gml:posList>
|
|
|
+ </gml:LinearRing>
|
|
|
+ </gml:exterior>
|
|
|
+ </gml:Polygon>
|
|
|
+ </gml:surfaceMember>
|
|
|
+ </gml:MultiSurface>
|
|
|
+ </og:the_geom>
|
|
|
+ <og:cat>4</og:cat>
|
|
|
+ </og:restricted>
|
|
|
+ </gml:featureMembers>
|
|
|
+</wfs:FeatureCollection>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
class WpsServer {
|
|
|
|
|
|
private $_fun;// config for identifiers
|
|
|
|
|
|
public function __construct() {
|
|
|
$this->_fun['przypiszDoRekordu'] = new WpsActionPrzypiszDoRekordu();
|
|
|
+ $this->_wfsAction = new WfsAction();
|
|
|
}
|
|
|
|
|
|
public function parseXMLRequest() {
|
|
|
$data = array();
|
|
|
$reqContent = file_get_contents('php://input');
|
|
|
$xml = new SimpleXMLElement($reqContent);
|
|
|
- if (isset($xml->children('ows', TRUE)->Identifier)) {
|
|
|
+
|
|
|
+ if ('GetFeature' == $xml->getName()) {
|
|
|
+ // TODO: parse xml and set query params
|
|
|
+ $this->_wfsAction->execute($data);
|
|
|
+ }
|
|
|
+ else if (isset($xml->children('ows', TRUE)->Identifier)) {
|
|
|
$identifier = (string)$xml->children('ows', TRUE)->Identifier;
|
|
|
if (array_key_exists($identifier, $this->_fun)) {
|
|
|
|
|
|
@@ -701,9 +808,11 @@ class WpsServer {
|
|
|
} else {
|
|
|
echo "TODO: brak zdefiniowanej funkcji '{$identifier}'";
|
|
|
var_dump($identifier);
|
|
|
- return;
|
|
|
}
|
|
|
}
|
|
|
+ else {
|
|
|
+ echo "TODO: '" . $xml->getName() . "' ...";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function getCapabilitiesAction() {
|