[TinyOWS-users] Problems saving with demo

Nicolas Ardissono nicolasardissono at yahoo.com.ar
Sun Oct 30 22:41:27 EST 2011


Hello, i'm a newy in this matter, and after a week i have installed the 
tinyows demo in my server (debian squeeze) and i could make it work, all 
layers are showing, but i cannot make it save.

Any tip or help will be apreciate. I don't know what else try, i have no 
more ideas.

When i edit same features and click save this is what *firebug post*:

<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" 
version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd 
http://www.agpstracking.com/ 
http://www.agpstracking.com/cgi-bin/tinyows?service=wfs&request=DescribeFeatureType&version=1.1.0&typename=france" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Update typeName="feature:france" 
xmlns:feature="http://www.agpstracking.com/">
<wfs:Property>
<wfs:Name>the_geom</wfs:Name>
<wfs:Value>
<gml:MultiSurface xmlns:gml="http://www.opengis.net/gml" 
srsName="EPSG:27582">
<gml:surfaceMember>
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
<gml:posList>650260.......</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>gid</wfs:Name>
<wfs:Value>90</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>id_geofla</wfs:Name>
<wfs:Value>32129</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>code_chf_l</wfs:Name>
<wfs:Value>024</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>nom_chf_l</wfs:Name>
<wfs:Value>AUXERRE</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>x_chf_lieu</wfs:Name>
<wfs:Value>6921</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>y_chf_lieu</wfs:Name>
<wfs:Value>23116</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>x_centroid</wfs:Name>
<wfs:Value>6932</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>y_centroid</wfs:Name>
<wfs:Value>23112</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>nom_dept</wfs:Name>
<wfs:Value>YONNE</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>code_reg</wfs:Name>
<wfs:Value>26</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>nom_region</wfs:Name>
<wfs:Value>BOURGOGNE</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>code_dept</wfs:Name>
<wfs:Value>89</wfs:Value>
</wfs:Property>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:FeatureId></ogc:FeatureId>
</ogc:Filter>
</wfs:Update>
</wfs:Transaction>


*this is the tinyows response in firebug:*

|<?xml version='1.0' encoding='UTF-8'?>
||<ows:ExceptionReport
||  xmlns='http://www.opengis.net/ows'
||  xmlns:ows='http://www.opengis.net/ows'
||  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
||  xsi:schemaLocation='http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport||.xsd'
||  version='1.1.0' language='en'>
||  <ows:Exception exceptionCode='InvalidParameterValue' locator='request'>
||   <ows:ExceptionText>XML request isn't valid</ows:ExceptionText>
||  </ows:Exception>
||</ows:ExceptionReport>|



This is what i have   in:
*/etc/tinyows.xml:*
<tinyows online_resource="http://www.agpstracking.com/cgi-bin/tinyows"
          schema_dir="/usr/local/share/tinyows/schema/" log_level="1" 
log="/var/log/tinyows.log">

<pg host="127.0.0.1" user="remise" password="12346" 
dbname="tinyows_demo" port="5433"/>

<metadata name="TinyOWS Server"
             title="TinyOWS Server - Demo Service" />

<layer retrievable="1"
          writable="1"
          ns_prefix="tows"
          ns_uri="http://www.agpstracking.com/"
          name="world"
          server="http://www.agpstracking.com/"
          title="World Administrative Boundaries" />

<layer retrievable="1"
          writable="1"
          ns_prefix="tows"
          ns_uri="http://www.agpstracking.com/"
          name="france"
          server="http://www.agpstracking.com/"
          title="French Administrative Sub Boundaries (IGN - GeoFLA 
Departements)" />

</tinyows>


*this is the javascript file:*

var map, wfs;

var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
     initialize: function(layer, options) {
         OpenLayers.Control.prototype.initialize.apply(this, [options]);
         this.layer = layer;
         this.handler = new OpenLayers.Handler.Feature(
             this, layer, {click: this.clickFeature}
         );
     },
     clickFeature: function(feature) {
         // if feature doesn't have a fid, destroy it
         if(feature.fid == undefined) {
             this.layer.destroyFeatures([feature]);
         } else {
             feature.state = OpenLayers.State.DELETE;
             this.layer.events.triggerEvent("afterfeaturemodified",
                                            {feature: feature});
             feature.renderIntent = "select";
             this.layer.drawFeature(feature);
         }
     },
     setMap: function(map) {
         this.handler.setMap(map);
         OpenLayers.Control.prototype.setMap.apply(this, arguments);
     },
     CLASS_NAME: "OpenLayers.Control.DeleteFeature"
});



function showMsg(szMessage) {
     window.alert(szMessage);
     /*document.getElementById("message").innerHTML = szMessage;
     setTimeout(
         "document.getElementById('message').innerHTML = ''",2000);*/
};

function showSuccessMsg(){
     showMsg("Transaction successfully completed");
};

function showFailureMsg(){
     showMsg("An error occured while operating the transaction");
};


function init() {
      map = new OpenLayers.Map('basicMap', {
         projection: new OpenLayers.Projection("EPSG:27582"),
         units: "m",
         maxResolution: "auto",
         maxExtent: new OpenLayers.Bounds(5000,1620000,1198000,2678000),
         controls: [
             new OpenLayers.Control.PanZoom()
         ]
         });
     var base = new OpenLayers.Layer.WMS("OpenLayers WMS",
         "http://www.geosignal.org/cgi-bin/wmsmap?",
         {layers: "Regions,Departements",
      projection:"EPSG:27582",
     displayProjection: new OpenLayers.Projection("EPSG:27582"),
          units: "m",
      maxResolution: "auto",
      maxExtent: new OpenLayers.Bounds(5000,1620000,1198000,2678000),
      sld: 
"http://www.tinyows.org/tracdocs/demo/OpenLayers-2.9/examples/sld.xml"
     }
     );

     map.addLayer(base);

     var saveStrategy = new OpenLayers.Strategy.Save();
     saveStrategy.events.register("success", '', showSuccessMsg);
     saveStrategy.events.register("fail", '', showFailureMsg);

    wfs = new OpenLayers.Layer.Vector("Editable Features", {
         strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
         projection: new OpenLayers.Projection("EPSG:27582"),
         protocol: new OpenLayers.Protocol.WFS({
             version: "1.1.0",
             srsName: "EPSG:27582",
             url: "http://www.agpstracking.com/cgi-bin/tinyows?",
             featureType: "france",
             featureNS: "http://www.agpstracking.com/",
             geometryName: "the_geom",
             schema: 
"http://www.agpstracking.com/cgi-bin/tinyows?service=wfs&request=DescribeFeatureType&version=1.1.0&typename=france",
             outputFormat: "application/json",
             readFormat: new OpenLayers.Format.GeoJSON()
         })
     });

    map.addLayer(wfs);

     var panel = new OpenLayers.Control.Panel(
         {'displayClass': 'customEditingToolbar'}
     );

     var navigate = new OpenLayers.Control.Navigation({
         title: "Pan Map"
     });

     var draw = new OpenLayers.Control.DrawFeature(
         wfs, OpenLayers.Handler.Polygon,
         {
             title: "Draw Feature",
             displayClass: "olControlDrawFeaturePolygon",
             multi: true
         }
     );

     var edit = new OpenLayers.Control.ModifyFeature(wfs, {
         title: "Modify Feature",
         displayClass: "olControlModifyFeature"
     });

     var del = new DeleteFeature(wfs, {title: "Delete Feature"});

     var save = new OpenLayers.Control.Button({
         title: "Save Changes",
         trigger: function() {
             if(edit.feature) {
                 edit.selectControl.unselectAll();
             }
             saveStrategy.save();
         },
         displayClass: "olControlSaveFeatures"
     });

     panel.addControls([navigate, save, edit, draw, del]);
     panel.defaultControl = navigate;
     map.addControl(panel);
     map.zoomToMaxExtent();

}


*this is my html file:*

<html>
<head>
<LINK REL=StyleSheet HREF='../estilo.css' TYPE='text/css'>
<link rel="stylesheet" href="theme/default/style.css" type="text/css" />
<script src="OpenLayers-2.9/OpenLayers.js"></script>
<style>

     #map {
             width: 800px;
            height: 500px;
             float: left;
             border: 1px solid #ccc;
     }
         #message {
         position: relative;
             left: 5px;
     }
         #docs {
             float: left;
     }
         .customEditingToolbar {
             float: right;
             right: 0px;
             height: 30px;
             width: 200px;
         }
         .customEditingToolbar div {
             float: right;
             margin: 5px;
             width: 24px;
             height: 24px;
         }
         .olControlNavigationItemActive {
             background-image: 
url("theme/default/img/editing_tool_bar.png");
             background-repeat: no-repeat;
             background-position: -103px -23px;
         }
         .olControlNavigationItemInactive {
             background-image: 
url("theme/default/img/editing_tool_bar.png");
             background-repeat: no-repeat;
             background-position: -103px -0px;
         }
         .olControlDrawFeaturePolygonItemInactive {
             background-image: 
url("theme/default/img/editing_tool_bar.png");
             background-repeat: no-repeat;
             background-position: -26px 0px;
         }
         .olControlDrawFeaturePolygonItemActive {
             background-image: 
url("theme/default/img/editing_tool_bar.png");
             background-repeat: no-repeat;
             background-position: -26px -23px ;
         }
         .olControlModifyFeatureItemActive {
             background-image: url(theme/default/img/move_feature_on.png);
             background-repeat: no-repeat;
             background-position: 0px 1px;
         }
         .olControlModifyFeatureItemInactive {
             background-image: url(theme/default/img/move_feature_off.png);
             background-repeat: no-repeat;
             background-position: 0px 1px;
         }
         .olControlDeleteFeatureItemActive {
             background-image: url(theme/default/img/remove_point_on.png);
             background-repeat: no-repeat;
             background-position: 0px 1px;
         }
         .olControlDeleteFeatureItemInactive {
             background-image: url(theme/default/img/remove_point_off.png);
             background-repeat: no-repeat;
             background-position: 0px 1px;
         }
</style>
<script src="tinyows_wfs-t.js"></script>
</head>

<body onload="init()">
<h1 id="title">WFS Transaction Example, (TinyOWS ans OpenLayers)</h1>
<div id="tags"></div>
<p id="shortdesc">
             Shows the use of the WFS Transactions (WFS-T).
         Parks of Osnabruck (Frida).
<br />
         Base layers is OpenStreetMap from Omniscale WMS Server.
</p>
<div id="basicMap"></div>

<div id="message"></div>
<div id="docs">
<p>
                 The WFS protocol allows for creation of new features and
                 reading, updating, or deleting of existing features.
</p>
<p>
                 Use the tools to create, modify, and delete (in order 
from left
                 to right) features. Use the save tool (picture of a 
disk) to
                 save your changes. Use the navigation tool (hand) to stop
                 editing and use the mouse for map navigation.
</p>
<p>
                 See the <a href="tinyows_wfs-t.js" target="_blank">

                 wfs-protocol-transactions.js source</a> to see how this 
is done.
</p>
</div>
</body>
</html>

THANKS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/tinyows-users/attachments/20111031/0ad82308/attachment-0001.htm 


More information about the TinyOWS-users mailing list