Hello list,<br><br>Some months ago, Alexander Schäfer see that there was a problem with WFS 1.1.0 to display a layer on the map, stored well in the database.<br><a href="http://lists.maptools.org/pipermail/tinyows-users/2010-May/000086.htm">http://lists.maptools.org/pipermail/tinyows-users/2010-May/000086.htm</a><br>
<br>Is it always a known issue? An Openlayers issue? A config mistake from myself?<br>When only switching to 1.0.0, the same code is perfectly fine and the layer displays on the map.<br>I don't see the advantage of 1.1.0 version, so 1.0.0 is enought?<br>
<br>Regards<br><br>ThomasG<br><br>PS : below, my test code<br><br>--SQL--<br><br><br>SET statement_timeout = 0;<br>SET client_encoding = 'UTF8';<br>SET standard_conforming_strings = off;<br>SET check_function_bodies = false;<br>
SET client_min_messages = warning;<br>SET escape_string_warning = off;<br>SET default_tablespace = '';<br>SET default_with_oids = false;<br><br>CREATE SCHEMA gis_schema<br> AUTHORIZATION postgres;<br><br>CREATE TABLE gis_schema.parcelle (<br>
gid integer NOT NULL,<br> idu character varying(80),<br> supf numeric,<br> indp numeric,<br> autocad_el numeric,<br> the_geom public.geometry,<br> CONSTRAINT enforce_dims_the_geom CHECK ((public.st_ndims(the_geom) = 2)),<br>
CONSTRAINT enforce_geotype_the_geom CHECK (((public.geometrytype(the_geom) = 'MULTIPOLYGON'::text) OR (the_geom IS NULL))),<br> CONSTRAINT enforce_srid_the_geom CHECK ((public.st_srid(the_geom) = 4326))<br>
);<br>ALTER TABLE parcelle OWNER TO postgres;<br>CREATE SEQUENCE parcelle_gid_seq<br> START WITH 1<br> INCREMENT BY 1<br> NO MAXVALUE<br> NO MINVALUE<br> CACHE 1;<br>ALTER TABLE gis_schema.parcelle_gid_seq OWNER TO postgres;<br>
ALTER SEQUENCE parcelle_gid_seq OWNED BY parcelle.gid;<br>SELECT pg_catalog.setval('parcelle_gid_seq', 1, true);<br>ALTER TABLE gis_schema.parcelle ALTER COLUMN gid SET DEFAULT nextval('parcelle_gid_seq'::regclass);<br>
ALTER TABLE gis_schema.parcelle<br> ADD CONSTRAINT parcelle_pkey PRIMARY KEY (gid);<br>CREATE INDEX parcelle_the_geom_gist ON parcelle USING gist (the_geom);<br><br>INSERT INTO geometry_columns (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, type) VALUES ('', 'gis_schema', 'parcelle', 'the_geom', 2, 4326, 'MULTIPOLYGON');<br>
<br><!--config.xml file--><br><br><tinyows online_resource="<a href="http://localhost/cgi-bin/tinyows">http://localhost/cgi-bin/tinyows</a>"<br> schema_dir="/usr/local/tinyows/schema/"><br>
<br><pg host="127.0.0.1" user="postgres" password="atlas" dbname="gavrelle" port="5432"/><br> <br> <metadata name="TinyOWS Server"<br> title="TinyOWS Server - Gavrelle EP" /><br>
<br> <contact name="TinyOWS Server"<br> site="<a href="http://www.tinyows.org/">http://www.tinyows.org/</a>"<br> email="<a href="mailto:tinyows-users@lists.maptools.org">tinyows-users@lists.maptools.org</a>" /><br>
<br> <br> <layer retrievable="1"<br> writable="1"<br> srid="4326"<br> queryable="1"<br> prefix="gavrelle"<br> server="localhost"<br>
schema="gis_schema"<br> name="parcelle"<br> title="parcelles" /><br> <br></tinyows><br><br><br><br>//javascript tinyows.js<br><br>var map, wfs;<br>OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";<br>
<br>var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {<br> initialize: function(layer, options) {<br> OpenLayers.Control.prototype.initialize.apply(this, [options]);<br> this.layer = layer;<br> this.handler = new OpenLayers.Handler.Feature(<br>
this, layer, {click: this.clickFeature}<br> );<br> },<br> clickFeature: function(feature) {<br> // if feature doesn't have a fid, destroy it<br> if(feature.fid == undefined) {<br>
this.layer.destroyFeatures([feature]);<br> } else {<br> feature.state = OpenLayers.State.DELETE;<br> this.layer.events.triggerEvent("afterfeaturemodified", <br> {feature: feature});<br>
feature.renderIntent = "select";<br> this.layer.drawFeature(feature);<br> }<br> },<br> setMap: function(map) {<br> this.handler.setMap(map);<br> OpenLayers.Control.prototype.setMap.apply(this, arguments);<br>
},<br> CLASS_NAME: "OpenLayers.Control.DeleteFeature"<br>});<br><br><br><br>function showMsg(szMessage) {<br> document.getElementById("message").innerHTML = szMessage;<br> setTimeout(<br> "document.getElementById('message').innerHTML = ''",2000);<br>
}<br><br>function showSuccessMsg(){<br> showMsg("Transaction successfully completed");<br>};<br><br>function showFailureMsg(){<br> showMsg("An error occured while operating the transaction");<br>
};<br><br><br>function init() {<br> map = new OpenLayers.Map('map', {<br> projection: new OpenLayers.Projection("EPSG:4326"),<br> units: "degrees",<br> maxResolution: "auto",<br>
maxExtent: new OpenLayers.Bounds(-5.34, 41.92, 10.84, 51.59),<br> controls: [<br> new OpenLayers.Control.PanZoom()<br> ]<br> });<br><br> var region = new OpenLayers.Layer.WMS(<br> "Region Carmen",<br>
"<a href="http://ws.carmencarto.fr/WMS/34/patnat2008">http://ws.carmencarto.fr/WMS/34/patnat2008</a>?",<br> {layers: 'Region', format: 'image/png'},<br> {projection:"EPSG:4326", units: "degrees", maxResolution: "auto", maxExtent: new OpenLayers.Bounds(-5.34, 41.92, 10.84, 51.59)}<br>
);<br><br> var saveStrategy = new OpenLayers.Strategy.Save();<br> saveStrategy.events.register("success", '', showSuccessMsg);<br> saveStrategy.events.register("failure", '', showFailureMsg);<br>
<br> wfs = new OpenLayers.Layer.Vector("Editable Features", {<br> strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],<br> projection: new OpenLayers.Projection("EPSG:4326"),<br>
protocol: new OpenLayers.Protocol.WFS({<br> version: "1.0.0",<br> srsName: "EPSG:4326",<br> url: "<a href="http://localhost/cgi-bin/tinyows">http://localhost/cgi-bin/tinyows</a>",<br>
featureNS : "localhost",<br> featureType: "parcelle",<br> geometryName: "the_geom",<br> schema: "<a href="http://localhost/cgi-bin/tinyows?service=wfs&request=DescribeFeatureType&version=1.0.0&typename=gavrelle:parcelle">http://localhost/cgi-bin/tinyows?service=wfs&request=DescribeFeatureType&version=1.0.0&typename=gavrelle:parcelle</a>",<br>
extractAttributes: true<br> })<br> }); <br> <br> map.addLayers([region, wfs]);<br><br> var panel = new OpenLayers.Control.Panel(<br> {'displayClass': 'customEditingToolbar'}<br>
);<br> <br> var navigate = new OpenLayers.Control.Navigation({<br> title: "Pan Map"<br> });<br> <br> var draw = new OpenLayers.Control.DrawFeature(<br> wfs, OpenLayers.Handler.Polygon,<br>
{<br> title: "Draw Feature",<br> displayClass: "olControlDrawFeaturePolygon",<br> multi: true<br> }<br> );<br> <br> var edit = new OpenLayers.Control.ModifyFeature(wfs, {<br>
title: "Modify Feature",<br> displayClass: "olControlModifyFeature"<br> });<br><br> var del = new DeleteFeature(wfs, {title: "Delete Feature"});<br> <br> var save = new OpenLayers.Control.Button({<br>
title: "Save Changes",<br> trigger: function() {<br> if(edit.feature) {<br> edit.selectControl.unselectAll();<br> }<br> saveStrategy.save();<br> },<br>
displayClass: "olControlSaveFeatures"<br> });<br><br>function controlSelectFeature(wfs) {<br> feature_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);<br>
feature_style.fillColor = "#FCFF6F";<br> feature_style.fillOpacity = 0.5; <br> options = { <br> hover: false,<br> onSelect: popUP,<br>
selectStyle :feature_style<br> }; <br> selection = new OpenLayers.Control.SelectFeature(wfs, options);<br> <br> map.addControl(selection);<br>
selection.activate();<br> }<br><br> function popUP(e) {<br> if(typeof popup!='undefined'){<br> popup.destroy();<br> }<br> var htmlContent = "<b>Pays : "+e.attributes.idu+"</b><br /> <b><i>Region : "+e.attributes.supf+"</b></i>"; <br>
var size = new OpenLayers.Size(20,34);<br> var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);<br> popup = new OpenLayers.Popup.FramedCloud(<br> e.fid,<br>
e.geometry.getBounds().getCenterLonLat(),<br> null,<br> htmlContent,<br> null,<br> false,<br> null<br> );<br>
map.addPopup(popup); <br> }<br><br> function featureStyle() {<br> feature_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);<br>
feature_style.strokeWidth = 1;<br> feature_style.strokeColor = "#000000";<br> feature_style.fillColor = "#E11320";<br> feature_style.fillOpacity = 0.5; <br>
return feature_style;<br> } <br><br><br><br><br> controlSelectFeature(wfs);<br> panel.addControls([ selection,navigate, save, del, edit, draw]);<br> panel.defaultControl = navigate;<br>
map.addControl(panel);<br> map.zoomToMaxExtent();<br>}<br><br><br><br><!--html with call to js file--><br><br><html><br> <head><br> <link rel="stylesheet" href="../theme/default/style.css" type="text/css" /><br>
<link rel="stylesheet" href="style.css" type="text/css" /><br> <script src="../lib/OpenLayers.js"></script><br> <style><br><br> #map {<br> width: 800px;<br>
height: 500px;<br> float: left;<br> border: 1px solid #ccc;<br> }<br> #message {<br> position: relative;<br> left: 5px;<br> }<br> #docs {<br> float: left;<br>
}<br> .customEditingToolbar {<br> float: right;<br> right: 0px;<br> height: 30px; <br> width: 200px;<br> }<br> .customEditingToolbar div {<br> float: right;<br>
margin: 5px;<br> width: 24px;<br> height: 24px;<br> }<br> .olControlNavigationItemActive { <br> background-image: url("../theme/default/img/editing_tool_bar.png");<br>
background-repeat: no-repeat;<br> background-position: -103px -23px; <br> }<br> .olControlNavigationItemInactive { <br> background-image: url("../theme/default/img/editing_tool_bar.png");<br>
background-repeat: no-repeat;<br> background-position: -103px -0px; <br> }<br> .olControlDrawFeaturePolygonItemInactive { <br> background-image: url("../theme/default/img/editing_tool_bar.png");<br>
background-repeat: no-repeat;<br> background-position: -26px 0px; <br> }<br> .olControlDrawFeaturePolygonItemActive { <br> background-image: url("../theme/default/img/editing_tool_bar.png");<br>
background-repeat: no-repeat;<br> background-position: -26px -23px ; <br> }<br> .olControlModifyFeatureItemActive { <br>
background-image: url(../theme/default/img/move_feature_on.png);<br> background-repeat: no-repeat;<br> background-position: 0px 1px;<br> }<br> .olControlModifyFeatureItemInactive { <br>
background-image: url(../theme/default/img/move_feature_off.png);<br> background-repeat: no-repeat;<br> background-position: 0px 1px;<br> }<br> .olControlDeleteFeatureItemActive { <br>
background-image: url(../theme/default/img/remove_point_on.png);<br> background-repeat: no-repeat;<br> background-position: 0px 1px;<br> }<br> .olControlDeleteFeatureItemInactive { <br>
background-image: url(../theme/default/img/remove_point_off.png);<br> background-repeat: no-repeat;<br> background-position: 0px 1px;<br> }<br><br> .olControlSelectFeatureItemActive { <br>
background-image: url(../theme/default/img/remove_point_off.png);<br> background-repeat: no-repeat;<br> background-position: 0px 1px;<br> }<br><br> .olControlSelectFeatureItemInactive { <br>
background-image: url(../theme/default/img/remove_point_off.png);<br> background-repeat: no-repeat;<br> background-position: 0px 1px;<br> }<br><br><br><br> </style><br> <script src="tinyows.js"></script><br>
</head><br><br> <body onload="init()"><br> <h1 id="title">WFS Transaction Example, (TinyOWS ans OpenLayers)</h1><br> <div id="tags"></div><br>
<p id="shortdesc"><br> Shows the use of the WFS Transactions (WFS-T).<br> Parks of Osnabruck (Frida).<br> <br /><br> Base layers is OpenStreetMap from Omniscale WMS Server.<br>
</p><br> <div id="map"></div><br><br> <div id="message"></div><br> <div id="docs"><br> <p><br> The WFS protocol allows for creation of new features and<br>
reading, updating, or deleting of existing features.<br> </p><br> <p><br> Use the tools to create, modify, and delete (in order from left<br> to right) features. Use the save tool (picture of a disk) to<br>
save your changes. Use the navigation tool (hand) to stop<br> editing and use the mouse for map navigation.<br> </p><br> <p><br> See the <a href="tinyows_wfs-t.js" target="_blank">wfs-protocol-transactions.js source</a> to see how this is done.<br>
</p> <br> </div><br> </body><br></html><div style="visibility: hidden; display: inline;" id="avg_ls_inline_popup"></div><style type="text/css">#avg_ls_inline_popup { position:absolute; z-index:9999; padding: 0px 0px; margin-left: 0px; margin-top: 0px; width: 240px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 13px;}</style>