[Gfoss] Problema addPoint in WFS-T

Nicola De Innocentis deinnocentis.nicola a gmail.com
Lun 7 Mar 2011 18:59:09 CET


Ciao a tutti,sto sviluppando attraverso l'uso di Geoserver e OpenLayers, un
semplice servizio wfs-t costituito per ora da un unico layer di punti.
Sto costruendo la toolbar per verificare che le operazioni di aggiunta punti
,rimozione punti e spostamento vadano a buon fine.Ho inserito un semplice
link dove cliccando mi lascia salvare le operazioni che compio.Il problema è
il seguente:

Vado ad aggiungere il punto e quando clicco sul link Save,mi appare questo
alert:

WFS Transaction: FAILED <?xml version="1.0" ?>
<ServiceExceptionReport
   version="1.2.0"
   xmlns="http://www.opengis.net/ogc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
   <ServiceException>
      java.lang.ClassCastException
null
</ServiceException></ServiceExceptionReport>


Inoltre se quello stesso punto lo vado a cancellare e salvo l'opezione di
cancellazione mi appare quest'altro alert:

WFS Transaction: SUCCESS <?xml version="1.0"
encoding="UTF-8"?><wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="
http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.opengis.net/wfs
http://localhost:8080/schemas/wfs/1.0.0/WFS-transaction.xsd"><wfs:InsertResult><ogc:FeatureId
fid="new0"/></wfs:InsertResult> <wfs:TransactionResult> <wfs:Status>
<wfs:SUCCESS/> </wfs:Status>
</wfs:TransactionResult></wfs:WFS_TransactionResponse>

Volevo capire dove avevo sbagliato o se devo impostare qualcosa in
particolare affinchè l'operazione di aggiunta punto abbia successo come
l'opezione di cancellazione.
Vi posto per sicurezza anche un po di codice,in modo da potervi dare piu
info possibili:



 function init(){



            map = new OpenLayers.Map('map');



    // create WFS layer
            var perugia = new OpenLayers.Layer.WFS(
                    "Perugia",
                    "/wfs?strict=true",
                    {typename: 'perugia:POI_Perugia'},
                    {
                        version:"1.0.0",
                        typename: 'POI_Perugia',
                        featureNS: '
https://sites.google.com/site/gisperugia/',
                        extractAttributes: true,
                        isBaseLayer:true
                    }


          );
            perugia.style = OpenLayers.Util.applyDefaults({strokeColor:
"#0000ff"},
                    OpenLayers.Feature.Vector.style["default"]);

            map.addLayer(perugia);


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



          var drawPoint = new OpenLayers.Control.DrawFeature(
                perugia, OpenLayers.Handler.Point,
                {displayClass: 'olControlDrawFeaturePoint',
        title:'Add Point'});

            drawPoint.featureAdded = function(feature) {
                feature.layer.eraseFeatures([feature]);
                // cast to multipoint
                feature.geometry = new OpenLayers.Geometry.MultiPoint(
                    feature.geometry
                );
                feature.style.strokeColor = "#0000ff";
                feature.state = OpenLayers.State.INSERT;
                feature.layer.drawFeature(feature);
            }




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


  var del = new DeleteFeature(perugia, {title: "Delete Feature"});
 panel.addControls([new
OpenLayers.Control.Navigation(),drawPoint,edit,del]);

            map.addControl(panel);
            map.addControl(new OpenLayers.Control.LayerSwitcher());

          map.zoomToExtent(
                new OpenLayers.Bounds(4.9,40.663,15.106, 46.774)
            );

        }
    </script>
  </head>
  <body onload="init()">
    <h3>Perugia wfs-t </h3>


    <div id="map"></div>
<a href="#" onclick="map.layers[0].commit();return false">Save</a>
  </body>
</html>


Grazie infinite.
Nicola.
-------------- parte successiva --------------
Un allegato HTML ? stato rimosso...
URL: <http://lists.gfoss.it/pipermail/gfoss/attachments/20110307/50d9d253/attachment.html>


Maggiori informazioni sulla lista Gfoss