[Geoserver-devel] Problems with GetFeatures

Hmmm... I can answer 'what's going on?', but I don't have a good answer
to 'why is that happening?'.

What's going on is that the shapefile datastore (I suspect) is for some
reason creating LineStrings when MultiLineStrings are expected. Due to
the nature of shapefiles we must wrap all linestrings in
MultiLineStrings, since the shapefile specification does not
distinguish between the two, all are considered 'arcs' or some such.
This is a slight performance hit, such as when returning gml, since
it's possible that they are all just single linestrings but we still
return them as Multi-linestrings, but we've found no better way to deal
with it. But for some reason it looks like your shapefile datastore is
trying to return LineStrings instead of wrapping them in
MultiLineStrings.

One quick fix for you would be to use Postgis (freely available open
source spatial extension to Postgresql), convert the shapefile to it
using the shp2pgsql tool. This is preferred for GeoServer, as you'll
get better performance on your data, and will have less trouble with
transactions.

The other thing to do is to create a bug report on our JIRA task tracker
with this issue and attach your shapefile (if possible), so that we can
try it out ourselves and attempt to reproduce the error, as I've never
seen it before. Or you can just email the file to me and I can check
it out.

And what version of GeoServer are you using? And does a GetFeature
without a filter work, or does it mess up too?

(sorry for the late response, I've been catching up on email, and should
be faster now - I see you emailed geotools as well. Emailing the
shapefile to one of us works, or if you create a task in jira and
attach the file there we should all be able to download it and check it
out).

Chris

----- Original Message -----
From: "Victor" <victor.izawa@anonymised.com>
To: <geoserver-devel@lists.sourceforge.net>
Sent: Thursday, May 13, 2004 3:03 AM
Subject: [Geoserver-devel] Problems with GetFeatures

Hi,

I've little problems using the GetFeatures's service and I'm configure
the Demo application using my shapefile. But when I use the follow

XML:

<wfs:GetFeature service="WFS" version="1.0.0"
  outputFormat="GML2"
  xmlns:topp="http://www.openplans.org/topp&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ogc="http://www.opengis.net/ogc&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-basic.xsd&quot;&gt;
  <wfs:Query typeName="topp:sjc_roads">
  <ogc:Filter>
    <ogc:FeatureId fid="sjc_roads.1"/>
  </ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

I got the below error message:
...
problem with FeatureResults: org.geotools.data.DataSourceException:
Could not peek ahead at

org.geotools.data.FilteringFeatureReader.hasNext(FilteringFeatureReader.

java:125) at
org.geotools.data.MaxFeatureReader.hasNext(MaxFeatureReader.java:77)

at

org.geotools.data.DefaultFeatureResults.getCount(DefaultFeatureResults.j

ava:208) at

org.vfny.geoserver.responses.wfs.FeatureResponse.execute(FeatureResponse

.java:285) at

org.vfny.geoserver.responses.wfs.FeatureResponse.execute(FeatureResponse

.java:142) at

org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.ja

va:365) at

org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:

296) at

org.vfny.geoserver.servlets.wfs.WfsDispatcher.doResponse(WfsDispatcher.j

ava:220) at
...
Caused by: org.geotools.feature.IllegalAttributeException: expected
com.vividsolutions.jts.geom.MultiLineString , but got
com.vividsolutions.jts.geom.LineString at

org.geotools.feature.DefaultFeature.setAttribute(DefaultFeature.java:203

) at

org.geotools.feature.DefaultFeature.setAttributes(DefaultFeature.java:23

2) at

org.geotools.feature.DefaultFeature.<init>(DefaultFeature.java:82)

at

org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:1

40) at

org.geotools.data.FIDFeatureReader.readFeature(FIDFeatureReader.java:120

) at org.geotools.data.FIDFeatureReader.next(FIDFeatureReader.java:89)
at

org.geotools.data.FilteringFeatureReader.hasNext(FilteringFeatureReader.

java:117) ... 47 more Caused by: java.lang.IllegalArgumentException:
com.vividsolutions.jts.geom.LineString is not an acceptable class for
the_geom as it is not assignable from class
com.vividsolutions.jts.geom.MultiLineString at

org.geotools.feature.DefaultAttributeType.validate(DefaultAttributeType.

java:344) at

org.geotools.feature.DefaultFeature.setAttribute(DefaultFeature.java:200

)

What's going on?

Victor Amano Izawa
FVE - IP&D
Phone.:(12)3947-1155

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/