[OpenLayers-Users] saving line, point etc using openlayers

aaliya goyaladiti10 at gmail.com
Mon Oct 29 22:58:31 PDT 2012


hi,
I am newbie to open-layers. I have developed a small application of wfs-t. I
am able to save the polygon but when I tried to save the line or point it
gives me error

<?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:8081/geoserver/schemas/wfs/1.0.0/WFS-transaction.xsd">
<wfs:InsertResult><ogc:FeatureId fid="none"/></wfs:InsertResult>
 <wfs:TransactionResult> <wfs:Status> <wfs:FAILED/> </wfs:Status>
 <wfs:Message>*Error performing insert: java.lang.String cannot be cast to
com.vividsolutions.jts.geom.Geometry*</wfs:Message>
</wfs:TransactionResult></wfs:WFS_TransactionResponse>

what it could be..??

The code to draw the point polygon and line is below

 action = new GeoExt.Action({
        text: "draw_poly",
        control: new OpenLayers.Control.DrawFeature(
            vector, OpenLayers.Handler.Polygon,{
            title: "Draw Feature",
            displayClass: "olControlDrawFeaturePolygon",
            multi: true
        }
        ),
		strategies: [saveStrategy],
        map: map,
        toggleGroup: "draw",
        allowDepress: false,
        tooltip: "draw_polygon",
       
    });
    actions["draw_poly"] = action;
  


	action = new GeoExt.Action({
        text: "draw_point",
        control: new OpenLayers.Control.DrawFeature(
            vector, OpenLayers.Handler.Point,{
            title: "Draw Feature",
            displayClass: "olControlDrawFeaturePoint",
            multi: true
        }
        ),
		strategies: [saveStrategy],
        map: map,
        toggleGroup: "draw",
        allowDepress: false,
        tooltip: "draw_point",
        
    });
    actions["draw_point"] = action;
   
	
	
		
	
   action = new GeoExt.Action({
        text: "draw_line",
        control: new OpenLayers.Control.DrawFeature(
            vector, OpenLayers.Handler.Path,{
            title: "Draw Feature",
            displayClass: "olControlDrawFeaturePath",
            multi: true
        }
        ),
		strategies: [saveStrategy],
        map: map,
        toggleGroup: "draw",
        allowDepress: false,
        tooltip: "draw line",
        
    });
    actions["draw_line"] = action;

and the code for vector layers is

 vector = new OpenLayers.Layer.Vector("vector", {
                                            strategies: [new
OpenLayers.Strategy.Fixed(),saveStrategy],
                                            visibility: false,
                                            protocol: new
OpenLayers.Protocol.WFS({
                                                version: "1.0.0",
                                                srsName: "EPSG:4326", //
this is the default
                                                url: 
"http://localhost:8081/geoserver/wfs",
                                                featureType: "wfst_test",
                                                featureNS:
"http://www.opengeospatial.net/IIRS1",
                                                 extractAttributes: true,
												 geometryName: "the_geom",
												 
schema:
"http://localhost/geoserver/wfs/DescribeFeatureType?version=1.1.0&;typename=IIRS1:india_state"
												 }
											)
                                            
                                        }
												);

Thanks in advance.



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/saving-line-point-etc-using-openlayers-tp5012138.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list