Hi,
We are having a slight problem when trying to read WFS 1.1 response that is
returned in GML 3.2.1. (GeoTools 2.7-M4)
Currently, we are reading all WFS responses using GeoTools like so:

    Parser parser = new Parser(...);
    parser.setValidating(false);
    parser.setFailOnValidationError(false);
    parser.setStrict(false);
    FeatureCollection<SimpleFeatureType, SimpleFeature> features =
(FeatureCollection<SimpleFeatureType, SimpleFeature>)
parser.parse(response.getResponseAsInputStream());

but now are getting ClassCastException "java.util.HashMap cannot be cast to
FeatureCollection".
XML response contains multisurface object like this:

    <gml:MultiSurface gml:id="XXX.MultiSurface" srsName="EPSG:3067">
       <gml:surfaceMember>
            <gml:Surface gml:id="XXX.Surface" srsName="EPSG:3067">
                <gml:patches>
                    <gml:PolygonPatch>
                        <gml:exterior>
                            <gml:LinearRing>
                                <gml:posList>xx yy ...</gml:posList>
                            </gml:LinearRing>
                        </gml:exterior>
                        <gml:interior>
                            <gml:LinearRing>
                                <gml:posList>xx yy ...</gml:posList>
                            </gml:LinearRing>
                        </gml:interior>
                    </gml:PolygonPatch>
                </gml:patches>
            </gml:Surface>
        </gml:surfaceMember>
    </gml:MultiSurface>

Now, is there an easy way to convert HashMap WFS GetFeature result to a
"Layer" that could be render into an image something like this:

    String style = "...";
    FeatureCollection<SimpleFeatureType, SimpleFeature> features = {magic
conversion from HashMap to FeatureCollection }
    MapContext mapContext = buildMapContext();
    mapContext.addLayer(features, style);

Cheers.
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to