[Geoserver-users] cannot setup new data layer in wms...

I'm facing a problem setting up a datalayer in a WMS service. It's a
polygon layer inside a PostGIS datastore.
I've created a namespace: "BINGO" (fake name)
I could setup the datastore correctly (named "foo")
and add the FeatureType:

Name=foo:mycom (extracted automatically from the PostGIS DB)
Alias=comuni,

setting the SRS by hand because the one configured in the PostGIS
table isn't a common 3003 code (Guass-Boaga), but a user definied one:
330 plus towgs84 parameteres. Anyway, it's a revised 3003 projection,
and Geoserver have extracted the lat-long envelope. Ok.

The problem raises when I try to add the featuretype to the WMS
service. I've setted a group ("foo_WMS"), given the layer name as
"BINGO:comuni" and set the SRS. When I hit the Generate button it
doesn't set the envelope and falls back to the original values
(SRS=4326 and lat-lon to defaults). I've tried changing the name:

BINGO:mycom
foo:mycom
foo:comuni

just to try, but I'm quite sure that <namespace>:<alias> is correct.
Isn't it? Anyway I've tried to remove the Alias from the FeatureType
config too. Noway.
I don't know how to solve this...

I'm using Geoserver 1.6.6, downloaded just this morning.
Giovanni

G. Allegri ha scritto:

I'm facing a problem setting up a datalayer in a WMS service. It's a
polygon layer inside a PostGIS datastore.
I've created a namespace: "BINGO" (fake name)
I could setup the datastore correctly (named "foo")
and add the FeatureType:

Name=foo:mycom (extracted automatically from the PostGIS DB)
Alias=comuni,

setting the SRS by hand because the one configured in the PostGIS
table isn't a common 3003 code (Guass-Boaga), but a user definied one:
330 plus towgs84 parameteres. Anyway, it's a revised 3003 projection,
and Geoserver have extracted the lat-long envelope. Ok.

If it's revised, you should define it as a custom projection
using a new code, and then have your layer use the custom
epsg code you created, see here:
http://geoserver.org/display/GEOSDOC/Custom+projection+definition+in+Geoserver+1.5.0+(onwards)

The problem raises when I try to add the featuretype to the WMS
service. I've setted a group ("foo_WMS"), given the layer name as
"BINGO:comuni" and set the SRS. When I hit the Generate button it
doesn't set the envelope and falls back to the original values
(SRS=4326 and lat-lon to defaults). I've tried changing the name:

BINGO:mycom
foo:mycom
foo:comuni

just to try, but I'm quite sure that <namespace>:<alias> is correct.
Isn't it? Anyway I've tried to remove the Alias from the FeatureType
config too. Noway.

Hum, do you happen to have the same layer name in two different
namespaces? I believe no one ever tried to do that (or at least reported
that).

Anyways, if the layer group switches to 4326 it's usually because the first layer is in that projection. The code sort of assumes that's
the projection you'll want the envelope in, and does not allow
for a different projection to be set (silly, but simple to code).

This is indeed annoying... you can open a jira issue (jira.codehaus.org), I'll see what I can do about it.
As a temporary workaround, try to setup manually both the
srs and the bbox (I know, it's painful, but it should work).

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Well, I admit I have some problems with this custom SRS that I will
solve, anyway the featuretype has finally loaded (don't know how and
why!) but the a wfs GetFeature returns:

error:Translator error
Translator error
Error reading Features
Could not create the next feature:IllegalAttribute:
com.vividsolutions.jts.geom.MultiPolygon , but got
com.vividsolutions.jts.geom.Polygon
expected com.vividsolutions.jts.geom.MultiPolygon , but got
com.vividsolutions.jts.geom.Polygon
com.vividsolutions.jts.geom.Polygon is not an acceptable class for
wkb_geometry as it is not assignable from class
com.vividsolutions.jts.geom.MultiPolygon

I'll try to setup from scratch my PostGIS layer, but it's very strange
becuase it can be viewed without problems with various Desktop GIS
clients...

2008/10/9 Andrea Aime <aaime@anonymised.com>:

G. Allegri ha scritto:

I'm facing a problem setting up a datalayer in a WMS service. It's a
polygon layer inside a PostGIS datastore.
I've created a namespace: "BINGO" (fake name)
I could setup the datastore correctly (named "foo")
and add the FeatureType:

Name=foo:mycom (extracted automatically from the PostGIS DB)
Alias=comuni,

setting the SRS by hand because the one configured in the PostGIS
table isn't a common 3003 code (Guass-Boaga), but a user definied one:
330 plus towgs84 parameteres. Anyway, it's a revised 3003 projection,
and Geoserver have extracted the lat-long envelope. Ok.

If it's revised, you should define it as a custom projection
using a new code, and then have your layer use the custom
epsg code you created, see here:
http://geoserver.org/display/GEOSDOC/Custom+projection+definition+in+Geoserver+1.5.0+(onwards)

The problem raises when I try to add the featuretype to the WMS
service. I've setted a group ("foo_WMS"), given the layer name as
"BINGO:comuni" and set the SRS. When I hit the Generate button it
doesn't set the envelope and falls back to the original values
(SRS=4326 and lat-lon to defaults). I've tried changing the name:

BINGO:mycom
foo:mycom
foo:comuni

just to try, but I'm quite sure that <namespace>:<alias> is correct.
Isn't it? Anyway I've tried to remove the Alias from the FeatureType
config too. Noway.

Hum, do you happen to have the same layer name in two different
namespaces? I believe no one ever tried to do that (or at least reported
that).

Anyways, if the layer group switches to 4326 it's usually because the first
layer is in that projection. The code sort of assumes that's
the projection you'll want the envelope in, and does not allow
for a different projection to be set (silly, but simple to code).

This is indeed annoying... you can open a jira issue (jira.codehaus.org),
I'll see what I can do about it.
As a temporary workaround, try to setup manually both the
srs and the bbox (I know, it's painful, but it should work).

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Ok, I've solved changing the geometry type inside PostGIS. It's not
Geoserver faults, but many other clients don't have such ctrict checks
on data integrity :slight_smile:
Anyway I've been able to useconfigure and use 3003 even if my SRID in
PostGIS is 32767 ... Strange but it works.

2008/10/9 G. Allegri <giohappy@anonymised.com>:

Well, I admit I have some problems with this custom SRS that I will
solve, anyway the featuretype has finally loaded (don't know how and
why!) but the a wfs GetFeature returns:

error:Translator error
Translator error
Error reading Features
Could not create the next feature:IllegalAttribute:
com.vividsolutions.jts.geom.MultiPolygon , but got
com.vividsolutions.jts.geom.Polygon
expected com.vividsolutions.jts.geom.MultiPolygon , but got
com.vividsolutions.jts.geom.Polygon
com.vividsolutions.jts.geom.Polygon is not an acceptable class for
wkb_geometry as it is not assignable from class
com.vividsolutions.jts.geom.MultiPolygon

I'll try to setup from scratch my PostGIS layer, but it's very strange
becuase it can be viewed without problems with various Desktop GIS
clients...

2008/10/9 Andrea Aime <aaime@anonymised.com>:

G. Allegri ha scritto:

I'm facing a problem setting up a datalayer in a WMS service. It's a
polygon layer inside a PostGIS datastore.
I've created a namespace: "BINGO" (fake name)
I could setup the datastore correctly (named "foo")
and add the FeatureType:

Name=foo:mycom (extracted automatically from the PostGIS DB)
Alias=comuni,

setting the SRS by hand because the one configured in the PostGIS
table isn't a common 3003 code (Guass-Boaga), but a user definied one:
330 plus towgs84 parameteres. Anyway, it's a revised 3003 projection,
and Geoserver have extracted the lat-long envelope. Ok.

If it's revised, you should define it as a custom projection
using a new code, and then have your layer use the custom
epsg code you created, see here:
http://geoserver.org/display/GEOSDOC/Custom+projection+definition+in+Geoserver+1.5.0+(onwards)

The problem raises when I try to add the featuretype to the WMS
service. I've setted a group ("foo_WMS"), given the layer name as
"BINGO:comuni" and set the SRS. When I hit the Generate button it
doesn't set the envelope and falls back to the original values
(SRS=4326 and lat-lon to defaults). I've tried changing the name:

BINGO:mycom
foo:mycom
foo:comuni

just to try, but I'm quite sure that <namespace>:<alias> is correct.
Isn't it? Anyway I've tried to remove the Alias from the FeatureType
config too. Noway.

Hum, do you happen to have the same layer name in two different
namespaces? I believe no one ever tried to do that (or at least reported
that).

Anyways, if the layer group switches to 4326 it's usually because the first
layer is in that projection. The code sort of assumes that's
the projection you'll want the envelope in, and does not allow
for a different projection to be set (silly, but simple to code).

This is indeed annoying... you can open a jira issue (jira.codehaus.org),
I'll see what I can do about it.
As a temporary workaround, try to setup manually both the
srs and the bbox (I know, it's painful, but it should work).

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

G. Allegri ha scritto:

Ok, I've solved changing the geometry type inside PostGIS. It's not
Geoserver faults, but many other clients don't have such ctrict checks
on data integrity :slight_smile:

You can open a request on jira.codehaus.org for an improvement. While
we cannot turn a point into a polygon, we can certainly try to
handle the obvious conversions such as:
* multipolygon with just one polygon -> polygon
* polygon -> multipolygon

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.