[Geoserver-users] WFS write with GeoServer 1.5

Hi Group,

After I changed my Geoserver from 1.3.3.to GS1.5-RC2, some features are no more writeable.

If I try to insert feature via WFS-T , I get a exception:

"........WfsTransactionException: <TypeName> is read-only"

cause: wisa:STATION_W is read-only

8716088 [SEVERE] org.vfny.geoserver.servlets.AbstractService - Service exception occurred

org.vfny.geoserver.wfs.responses.WfsTransactionException: wisa:STATION_W is read-only

        at org.vfny.geoserver.wfs.responses.TransactionResponse.execute(TransactionResponse.java:247)

        at org.vfny.geoserver.wfs.responses.TransactionResponse.execute(TransactionResponse.java:115)

I looked the GS source and I saw it's meaning the downcast from FeatureSource to FeatureStore doesn't work.

The same feature with GS 1.3.3 is writeable without any problem.

Do you have any idea what could be wrong?

In which cases are this cast no possible?

Regards

Balazs

The same client with GS 1.3.3 is working without any problem.

How can I set the WFS access right for GS 1.5?

Thanks

Balazs Szakacs

Hi Group,

I have changed my GeoServer from 1.3.3 to 1.5-RC2.

If I try to insert feature via WFS-T , I get a exception:

"........WfsTransactionException: <TypeName> is read-only"

The same client with GS 1.3.3 is working without any problem.

How can I set the WFS access right for GS 1.5?

Thanks

Balazs Szakacs

Mit freundlichen Grüßen

Dipl. Ing.Balazs Szakacs

Land-, forst- und wasserwirtschaftliches Rechenzentrum GmbH

A-1200 Wien, Dresdner Straße 89

Tel: ++43(1) 33 176/426

Fax: ++43(1) 33 176/

E-Mail: balazs.szakacs@anonymised.com

WWW: http://www.lfrz.at/&gt;

FN 262918 w Handelsgericht Wien

Szakacs, Balazs ha scritto:

Hi Group,

After I changed my Geoserver from 1.3.3.to GS1.5-RC2, some features are no more writeable.

...

Do you have any idea what could be wrong?

In which cases are this cast no possible?

Hi Balazs,
this usually happens if the data store thinks the feature is not writable, for example that happens when a table in postgis has no
primary key (because fid returned by inserts would be useless).

So, if you have only some that aren't writable, let's try to find
out what makes them special. Datastore, data types, primary keys,
CRS, find whatever makes them different and report back.
It may be that you found out a bug, or that Geoserver became more
strict. Let's find out.

Cheers
Andrea

I just thought I would drop by and say

I was having the same problem as described above, and it was due to lack of
a PKey

but I originally tried using a PKey of type Serial which also doesnt work
with GeoServer

so I got around it by doing

CREATE TABLE [table name](uid INETGER......);
ALTER TABLE [table name] ADD PRIMARY KEY(uid);

I have also noticed that GeoServer will make the auto increment of uid for
you
--
View this message in context: http://www.nabble.com/WFS-write-with-GeoServer-1.5-tf3505962.html#a13610762
Sent from the GeoServer - User mailing list archive at Nabble.com.

DrogoNevets ha scritto:

I just thought I would drop by and say

I was having the same problem as described above, and it was due to lack of
a PKey

but I originally tried using a PKey of type Serial which also doesnt work
with GeoServer

I always use serials and they do work for me? This is new to me... can you provide a test case we can reproduce?

so I got around it by doing

CREATE TABLE [table name](uid INETGER......);
ALTER TABLE [table name] ADD PRIMARY KEY(uid);

I have also noticed that GeoServer will make the auto increment of uid for
you

Yes, but it does so by doing a select max(uid) from table xxx
so it's not a really safe way to generate a pk (what if two writes
are going to hit the table concurrently)?
Serials are the preferred way.

Cheers
Andrea

aaime wrote:

DrogoNevets ha scritto:

I always use serials and they do work for me? This is new to me... can
you provide a test case we can reproduce?

Yes, but it does so by doing a select max(uid) from table xxx
so it's not a really safe way to generate a pk (what if two writes
are going to hit the table concurrently)?
Serials are the preferred way.

Cheers
Andrea

Indeed that is a good point about the concurrent hits
I wont pretend to be an expert with GS only started using it a week ago
really.

TEST CASE
System to pin point certain animals within a set geographic area (400000
sq/km)

CREATE DATABASE animals_spots;
CREATE TABLE sightings (uid serial, species VARCHAR(50));
ALTER TABLE sightings ADD PRIMARY KEY(uid);
//add geom col called 'geom' using EPSG 27700 - cant think of code of top of
my head

I than created the data source in GS and then the FeatureType.

added the OS map of the area to the map, and a sighting layer, added points
and when clicking the buttom that I had bound the
<code>
      sighting_layer.commit()
</code>
to i got the NameSpace:sightings is read-only error.

I then changed the uid field to INTEGER and it worked fine.
--
View this message in context: http://www.nabble.com/WFS-write-with-GeoServer-1.5-tf3505962.html#a13612105
Sent from the GeoServer - User mailing list archive at Nabble.com.

DrogoNevets ha scritto:

aaime wrote:

DrogoNevets ha scritto:

I always use serials and they do work for me? This is new to me... can you provide a test case we can reproduce?

Yes, but it does so by doing a select max(uid) from table xxx
so it's not a really safe way to generate a pk (what if two writes
are going to hit the table concurrently)?
Serials are the preferred way.

Cheers
Andrea

Indeed that is a good point about the concurrent hits
I wont pretend to be an expert with GS only started using it a week ago
really.

TEST CASE
System to pin point certain animals within a set geographic area (400000
sq/km)

CREATE DATABASE animals_spots;
CREATE TABLE sightings (uid serial, species VARCHAR(50));
ALTER TABLE sightings ADD PRIMARY KEY(uid);
//add geom col called 'geom' using EPSG 27700 - cant think of code of top of
my head

I than created the data source in GS and then the FeatureType.

added the OS map of the area to the map, and a sighting layer, added points
and when clicking the buttom that I had bound the <code>
      sighting_layer.commit()
</code> to i got the NameSpace:sightings is read-only error.

Very odd... I cannot check this right now, but I'll do. I have
scheduled a jira issue against this one:
http://jira.codehaus.org/browse/GEOS-1483

Cheers
Andrea

Awesome thank you
couldnt figure out how to add a reply
but someone has and I think he's got the wrong idea

It works ok with INTEGER data type just not SERIAL
--
View this message in context: http://www.nabble.com/WFS-write-with-GeoServer-1.5-tf3505962.html#a13618147
Sent from the GeoServer - User mailing list archive at Nabble.com.

DrogoNevets ha scritto:

Awesome thank you
couldnt figure out how to add a reply
but someone has and I think he's got the wrong idea

It works ok with INTEGER data type just not SERIAL

Hi Drogo. I did my tests and I was able to use serial
without issues...

This is what I did.
On the command line, I created a database with all the
necessary tables/functions for postgis (using the default
template shipped along with postgis):
createdb animals_spots -T template_postgis

Then in psql:
CREATE TABLE sightings (uid serial, species VARCHAR(50));
ALTER TABLE sightings ADD PRIMARY KEY(uid);
select addgeometrycolumn(sightings, geom, 27700, 'POINT', 2);

Then I configured the table in GeoServer with srs 27700 and
put in some fictitious lat/lon box (the whole world), finally
run the following transaction:

<wfs:Transaction service="WFS" version="1.0.0"
   xmlns:wfs="http://www.opengis.net/wfs&quot;
   xmlns:topp="http://www.openplans.org/topp&quot;
   xmlns:gml="http://www.opengis.net/gml&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd http://www.openplans.org/topp http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:sightings&quot;&gt;
   <wfs:Insert>
     <topp:sightings>
      <topp:species>Hey there</topp:species>
       <topp:geom>
           <gml:Point>
            <gml:coordinates>10,10</gml:coordinates>
           </gml:Point>
       </topp:geom>
     </topp:sightings>
   </wfs:Insert>
</wfs:Transaction>

And it worked fine, no error messages, and the primary key was
indeed picked up from the sequence. So I'm wondering, what's
different in your case?
Cheers
Andrea