[TinyOWS-users] problel inserting feature with openlayers

luca marletta lucamarle at gmail.com
Sat Sep 11 02:48:43 EST 2010


Hi all,
I face a problem inserting a new feature into postgis using openlayers
(2.8 because with higher I've other kind of trouble) and tinyows (from
svn)

Here the log from tiny:

[Sat Sep 11 09:39:44 2010] [EVENT] == TINYOWS STARTUP ==
[Sat Sep 11 09:39:44 2010] [EVENT] == Connection PostGIS ==
[Sat Sep 11 09:39:44 2010] [EVENT] == Filling Storage ==
[Sat Sep 11 09:39:44 2010] [QUERY] <wfs:Transaction
xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd
http://127.0.0.1
http://127.0.0.1/cgi-bin/tinyows?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;TypeName=sitManomissioni"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Insert><feature:sitManomissioni
xmlns:feature="http://127.0.0.1"><feature:the_geom><gml:Polygon
xmlns:gml="http://www.opengis.net/gml"
srsName="EPSG:3003"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates
decimal="." cs="," ts=" ">1491459.5473271231,5057037.138629159
1491501.8806375964,5057015.266418748
1491465.5445461068,5056958.822004784
1491390.4029200166,5056986.338656591
1491387.9334769056,5057020.558082557
1491398.8695821112,5057039.255294682
1491398.8695821112,5057038.902517095
1491459.5473271231,5057037.138629159</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></feature:the_geom><feature:rete>1</feature:rete><feature:oggetto>er</feature:oggetto><feature:descrizione>er</feature:descrizione></feature:sitManomissioni></wfs:Insert></wfs:Transaction>

till here correctly read the

[Sat Sep 11 09:39:44 2010] [EVENT] == TINYOWS STARTUP ==
[Sat Sep 11 09:39:44 2010] [EVENT] == Connection PostGIS ==
[Sat Sep 11 09:39:44 2010] [EVENT] == Filling Storage ==
[Sat Sep 11 09:39:44 2010] [QUERY]
service=WFS&request=DescribeFeatureType&version=1.0.0
[Sat Sep 11 09:39:44 2010] [EVENT] == TINYOWS SHUTDOWN ==
[Sat Sep 11 09:39:44 2010] [ERROR] Element
'{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema
located at 'http://schemas.opengis.net/gml/2.1.2/feature.xsd' for the
namespace 'http://www.opengis.net/gml', since this namespace was
already imported with the schema located at
'/usr/local/tinyows/schema/gml/2.1.2/feature.xsd'.

[Sat Sep 11 09:39:44 2010] [ERROR] Element
'{http://127.0.0.1}the_geom': This element is not expected. Expected
is one of ( {http://www.opengis.net/gml}description,
{http://www.opengis.net/gml}name,
{http://www.opengis.net/gml}boundedBy, {http://127.0.0.1}id_man ).


this my config.xml
<tinyows online_resource="http://127.0.0.1/cgi-bin/tinyows"
		 schema_dir="/usr/local/tinyows/schema/"
		 check_schema= "1"
		 log="/tmp/tinyows.log">

	<pg host="127.0.0.1" user="xxx" password="xxx" dbname="gorla_sit" port="5432"/>
....
	<layer queryable	=	"1"
		   retrievable	=	"1"
		   writable	=	"1"
		   prefix		=	"feature"
		   server		=	"http://127.0.0.1"
		   name		=	"sitManomissioni"
		   srid		=	"3003"
		   title		=	"manomissioni" />


Here my save function

function saveRoad() {
	var oFeature = getSelectedRoad();
	if (isValidRoadAttributes(oFeature, manomAttr)){
		//check state, parse attributes, save and unselect current road
		if(oFeature.state != OpenLayers.State.INSERT) { oFeature.state =
OpenLayers.State.UPDATE; }
		parseFormAttributesToFeature(oFeature, aszAllRoadAttr, manomAttr);
		switch(oFeature.layer.protocol.CLASS_NAME) {
			case "OpenLayers.Protocol.HTTP":
				oFeature.layer.protocol.commit([oFeature]);
				break;
			case "OpenLayers.Protocol.WFS.v1_0_0":
				oSaveStrategy.save([oFeature]);
				break;
			default:
				alert("not suported");
		}
		oModifyPolCtrl.selectControl.unselect(oFeature);
	}
}

and here my vector layer and works well

	vMan= new OpenLayers.Layer.Vector("Edit manomissioni", {
		styleMap:		oStyleMap,
		strategies:		[new OpenLayers.Strategy.BBOX(), oSaveStrategy],
		projection:		new OpenLayers.Projection("EPSG:3003"),
		protocol:		new OpenLayers.Protocol.WFS({
			version:		"1.0.0", // sembra necessario mantenere il protocollo
1.0.0 (da una mail)
			url:			"http://127.0.0.1/cgi-bin/tinyows",
			featureType:	"sitManomissioni",
			featureNS:		"http://127.0.0.1",
			featurePrefix:	"feature",
			srsName:		"EPSG:3003", //non lasciare spazi dopo i ":"
			geometryName:	"the_geom",
			schema:			"http://127.0.0.1/cgi-bin/tinyows?service=WFS&version=1.0.0&request=DescribeFeatureType&TypeName=sitManomissioni"
		})
	});

it seems a protocol problem, could someone explain how to fix it?

thanks a lot

luca

luca marletta
www.beopen.it


More information about the TinyOWS-users mailing list