Skip to main content

i'mI'm using Postgis + tomcat + geoserver + openlayers for my application.

withWith the help of some tutorial itutorials, I have reached upto getttinggetting feature information of layers.

Next iI want to edit and save permanently the editable layers permanently.

I got the below code from net..the internet:

afterAfter that iI have modified thisthe code like this:

itThis code is not working...:)

iI can't see the layer contents on the map..

please help me with a sample code..

Thanks..

##Edit## I got some featureNS, feature type and featurePrefix also.

then iI changed my code shown below

butBut, belowthis error is showing now shown when iI try to save the edits in my layer.:

 "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces".

inIn openlayers.js below line

myMy geoserver workspace namespace URI is: "http://localhost:8080/geoserver/test". Is there any problem in this name?

Please give your suggestions..

i'm using Postgis + tomcat + geoserver + openlayers for my application.

with the help of some tutorial i have reached upto gettting feature information of layers.

Next i want to edit and save permanently the editable layers.

I got the below code from net..

after that i have modified this like this

it is not working...:)

i can't see the layer contents on the map..

please help me with a sample code..

Thanks..

##Edit## I got some featureNS, feature type and featurePrefix also

then i changed my code shown below

but, below error is showing now when i try to save the edits in my layer.

 "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces"

in openlayers.js below line

my geoserver workspace namespace URI is "http://localhost:8080/geoserver/test". Is there any problem in this name?

Please give your suggestions..

I'm using Postgis + tomcat + geoserver + openlayers for my application.

With the help of some tutorials, I have reached upto getting feature information of layers.

Next I want to edit and save the editable layers permanently.

I got the below code from the internet:

After that I have modified the code like this:

This code is not working.

I can't see the layer contents on the map.

please help me with a sample code.

Thanks.

##Edit## I got some featureNS, feature type and featurePrefix also.

then I changed my code shown below

But, this error is now shown when I try to save the edits in my layer:

 "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces".

In openlayers.js below line

My geoserver workspace namespace URI is: "http://localhost:8080/geoserver/test". Is there any problem in this name?

Please give your suggestions.

added 1356 characters in body
Source Link
whuber
  • 70.2k
  • 16
  • 187
  • 282

##Edit## I got some featureNS, feature type and featurePrefix also

then i changed my code shown below

// create three vector layers
var wfs = new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.Fixed(), saveStrategy],
styleMap: sm,
projection: new OpenLayers.Projection("EPSG:4030"),
protocol: new OpenLayers.Protocol.WFS({
    version: "1.1.0",
    srsName: "EPSG:4030",
    url: "http://localhost:8080/geoserver/wfs",
    featurePrefix: "Test", **/*workspace name*/**
    featureType: "Test:ramcheck", **/*geoserver layer name*/**
    featureNS :  "http://localhost:8080/geoserver/test", **/*Workspace Namespace URI*/**
    geometryName: "the_geom"
})
});

but, below error is showing now when i try to save the edits in my layer.

 "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces"

in openlayers.js below line

return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);}

my geoserver workspace namespace URI is "http://localhost:8080/geoserver/test". Is there any problem in this name?

Please give your suggestions..


##Edit## I got some featureNS, feature type and featurePrefix also

then i changed my code shown below

// create three vector layers
var wfs = new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.Fixed(), saveStrategy],
styleMap: sm,
projection: new OpenLayers.Projection("EPSG:4030"),
protocol: new OpenLayers.Protocol.WFS({
    version: "1.1.0",
    srsName: "EPSG:4030",
    url: "http://localhost:8080/geoserver/wfs",
    featurePrefix: "Test", **/*workspace name*/**
    featureType: "Test:ramcheck", **/*geoserver layer name*/**
    featureNS :  "http://localhost:8080/geoserver/test", **/*Workspace Namespace URI*/**
    geometryName: "the_geom"
})
});

but, below error is showing now when i try to save the edits in my layer.

 "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces"

in openlayers.js below line

return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);}

my geoserver workspace namespace URI is "http://localhost:8080/geoserver/test". Is there any problem in this name?

Please give your suggestions..

Tweeted twitter.com/#!/StackGIS/status/205300795355316225
Source Link

how can we save vector files in openlayers

i'm using Postgis + tomcat + geoserver + openlayers for my application.

with the help of some tutorial i have reached upto gettting feature information of layers.

Next i want to edit and save permanently the editable layers.

I got the below code from net..

 var editable_layer= new OpenLayers.Layer.Vector("Editable Features", {
   strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
   projection: new OpenLayers.Projection("EPSG:4030"),
  protocol: new OpenLayers.Protocol.WFS({
      version: "1.1.0",
  srsName: "EPSG:4030",
  url: "http://127.0.0.1/cgi-bin/tinyows",
  featureNS :  "http://www.tinyows.org/",
  featureType: "frida",
  geometryName: "the_geom",
  schema: "http://127.0.0.1/cgi-bin/tinyows?service=wfs&request=DescribeFeatureType&version=1.1.0&typename=tows:frida"
  })
}); 

after that i have modified this like this

var editable_layer = new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
styleMap: mystyle,
projection: new OpenLayers.Projection("EPSG:4030"),
protocol: new OpenLayers.Protocol.WFS({
    version: "1.1.0",
srsName: "EPSG:4030",
url: "http://localhost:8080/geoserver/wfs",
featureNS :  "http://localhost:8080",
featureType: "Test:ramcheck", **/*layer name*/**
geometryName: "the_geom",
schema: "http://localhost:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=Test:ramcheck" **/*i don't know how to modify this area*/**
})
});

it is not working...:)

i can't see the layer contents on the map..

please help me with a sample code..

Thanks..