[OpenLayers-Users] Help in updating WFS features
Niclas2
xniclasx at hotmail.com
Tue Feb 5 05:52:02 EST 2008
Hello Chris!
I am having the exactly same problem as you and seems to get no help from
the open layers irc chat. Have you found out what was wrong?
/Niclas
Chris O'Connor-3 wrote:
>
> Hello,
>
> I am doing a mapping project at college where I am adding routes onto a
> map
> and generating a route card. I am able to add the route (line) to the
> POSTGIS database no problem via Geoserver. The area I'm having a problem
> is
> on the update or modification of the line. Below is the relevant code and
> the POST requests generated by both requests. From what I can see it is
> the
> typeName="features" which is causing me the problem as I think it should
> be
> typeName="routes".
>
> Am I right in thinking this is what most likely the problem is and how do
> I
> change this for the request, I have tried putting typeName in several
> places
> but to no avail.
>
> Any help would be most appreciated.
>
> Chris O'Connor
>
>
>
> routes = new OpenLayers.Layer.WFS( "Routes", "
> http://localhost:8080/geoserver/wfs", {typename: 'routes:routes'},{
> maxExtent: bounds,typename:'routes',extractAttributes: false});
>
> // Map Layer 7
>
> routes.setVisibility(true);
>
> routes.style.strokeColor='#ff0000';
>
> routes.style.strokeOpacity=0.3;
>
> routes.style.strokeWidth=5;
>
> map.addLayer(routes);
>
> var options = {handlerOptions: {freehand: false}};
>
> df = new OpenLayers.Control.DrawFeature(routes,OpenLayers.Handler.Path,
> options);
>
> df.featureAdded = function(feature) {
>
> feature.state = OpenLayers.State.INSERT;
>
> feature.style['strokeColor'] = "#ff00ff";
>
> feature.style['strokeWidth']=5;
>
> feature.style['strokeOpacity']= 0.3;
>
> feature.layer.drawFeature(feature);
>
> map.layers[7].commit();
>
> map.layers[7].refresh();
>
> };
>
>
> ef = new OpenLayers.Control.ModifyFeature(routes,{typeName:'routes'});
>
> ef.onModificationEnd=function(feature){
>
> feature.state = OpenLayers.State.UPDATE;
>
> feature.style['strokeColor'] = "#ffff00";
>
> feature.style['strokeWidth']=5;
>
> feature.style['strokeOpacity']= 0.3;
>
> feature.layer.drawFeature(feature);
>
> map.layers[7].commit();
>
> map.layers[7].refresh();
>
> };
>
>
> Add request generated
>
> <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
> version="1.0.0" service="WFS"><wfs:Insert><feature
>
> :routes
> xmlns:feature="http://mapserver.gis.umn.edu/mapserver"><feature:the_geom><gml:LineString
> xmlns
> :gml="http://www.opengis.net/gml"><gml:coordinates decimal="." cs=","
> ts=" ">310027.2265275199,222116
> .6655236673
> 309321.6713529641,221058.33276183365</gml:coordinates></gml:LineString></feature:the_geom
>></feature:routes></wfs:Insert></wfs:Transaction>
>
>
> Update request generated
>
> <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
> version="1.0.0" service="WFS"><wfs:Update typeName
>
> ="features"><wfs:Property><wfs:Name>the_geom</wfs:Name><wfs:Value><gml:LineString
> xmlns:gml="http://www
> .opengis.net/gml"><gml:coordinates decimal="." cs="," ts="
> ">310027.22652752,222116.66552367 310521.11514970666
> ,220881.94396819445
> 309321.67135296,221058.33276183</gml:coordinates></gml:LineString></wfs:Value></wfs
> :Property><ogc:Filter
> xmlns:ogc="http://www.opengis.net/ogc"><ogc:FeatureId
> fid="routes.108"/></ogc:Filter
>></wfs:Update></wfs:Transaction>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://www.nabble.com/Help-in-updating-WFS-features-tp14931666p15287612.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list