One thing I should also point out is that the streaming approach is the better approach in many cases as it does not load the entire set of features into an in-memory collection. So the only approach really for large datasets.
-Justin Justin Deoliveira wrote: > Hi Christoph, > > Thanks for sending that over. So yes, there is an issue with parsing > this gml with the code snippet listed on that wicket page. I just opened > a bug report for this: > > http://jira.codehaus.org/browse/GEOT-2441 > > However there is a workaround. The following code snippet should work ok: > > GMLConfiguration gml = new GMLConfiguration(); > URL url = new URL( "http://78.46.50.41/..."); > > StreamingParser p = new StreamingParser( gml, url.openStream(), > SimpleFeature.class ); > > SimpleFeature f = null; > while( ( f = (SimpleFeature) p.parse()) != null ) { > System.out.println(f.getAttribute("name")); > } > > Try that out and let me know if it works. > > -Justin > > Christoph Ratke wrote: >> Hi Justin, >> thanks for your reply. >> >> I gonna check the ogr thing but anyway here is a link to the GML: >> http://78.46.50.41/cgi-bin/mapserv?map=/home/mapserver/mapfiles/wfs/wfs.map&&request=getFeature&service=wfs&version=1.0.0&typename=fb&Filter=%3CFilter%3E%3CAnd%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Egemarkung%3C/PropertyName%3E%3CLiteral%3E1500%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Ejahr%3C/PropertyName%3E%3CLiteral%3E2007%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/And%3E%3C/Filter%3E >> >> and some of the GML as text: >> <wfs:FeatureCollection xsi:schemaLocation="http://www.opengis.net/wfs >> http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd >> http://mapserver.gis.umn.edu/mapserver >> http://78.46.50.41/cgi-bin/mapserv?map=/home/mapserver/mapfiles/wfs/wfs.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=fb&OUTPUTFORMAT=XMLSCHEMA"> >> <gml:boundedBy> >> <gml:Box srsName="epsg:31467"> >> <gml:coordinates> >> 3601858.434233,5915864.629210 3602755.302766,5916124.342161 >> </gml:coordinates> >> </gml:Box> >> </gml:boundedBy> >> <gml:featureMember> >> <ms:fb> >> <gml:boundedBy> >> <gml:Box srsName="epsg:31467"> >> <gml:coordinates> >> 3602413.116780,5915864.629210 3602755.302766,5916009.135931 >> </gml:coordinates> >> </gml:Box> >> </gml:boundedBy> >> <ms:msGeometry> >> <gml:MultiPolygon srsName="epsg:31467"> >> <gml:polygonMember> >> <gml:Polygon> >> <gml:outerBoundaryIs> >> <gml:LinearRing> >> <gml:coordinates> >> 3602413.116780,5915868.441807 3602451.435437,5915931.047413 >> 3602449.101373,5915932.532431 3602444.857075,5915926.167141 >> 3602437.430131,5915932.108140 3602466.077179,5915974.123594 >> 3602511.699105,5915980.065056 3602528.675373,5915979.852911 >> 3602539.709716,5915978.155284 3602546.499760,5915977.730993 >> 3602603.793856,5915985.370082 3602676.365203,5915994.706798 >> 3602748.937013,5916009.135931 3602752.969166,5916007.226159 >> 3602755.302766,5916003.406615 3602734.083589,5915997.677298 >> 3602698.221743,5915932.745040 3602692.280281,5915936.351976 >> 3602663.208942,5915888.607668 3602658.540353,5915881.392870 >> 3602663.343270,5915877.194428 3602656.630580,5915865.690401 >> 3602632.015686,5915864.629210 3602654.720808,5915897.520093 >> 3602639.654775,5915906.856809 3602634.599877,5915896.268065 >> 3602609.103050,5915915.828061 3602627.347096,5915949.083945 >> 3602625.013033,5915950.993718 3602637.108566,5915977.730993 >> 3602602.095766,5915976.245512 3602582.998043,5915946.325591 >> 3602558.807439,5915960.755188 3602550.744059,5915961.391624 >> 3602544.378306,5915957.784688 3602537.587335,5915960.966870 >> 3602533.343500,5915959.057098 3602528.250619,5915949.508699 >> 3602511.911714,5915958.208979 3602507.291760,5915950.326247 >> 3602495.994320,5915956.262614 3602490.595264,5915956.623447 >> 3602485.694612,5915953.185115 3602479.233439,5915955.662307 >> 3602471.142267,5915938.887994 3602462.681925,5915932.108140 >> 3602460.347862,5915927.864305 3602468.038829,5915923.603794 >> 3602462.478117,5915910.031580 3602473.266038,5915906.196750 >> 3602454.153956,5915867.624723 3602413.116780,5915868.441807 >> </gml:coordinates> >> </gml:LinearRing> >> </gml:outerBoundaryIs> >> <gml:innerBoundaryIs> >> <gml:LinearRing> >> <gml:coordinates> >> 3602648.355055,5915979.216474 3602633.289022,5915946.325591 >> 3602643.050492,5915939.959838 3602669.999449,5915982.399583 >> 3602648.355055,5915979.216474 >> </gml:coordinates> >> </gml:LinearRing> >> </gml:innerBoundaryIs> >> </gml:Polygon> >> </gml:polygonMember> >> </gml:MultiPolygon> >> </ms:msGeometry> >> <ms:gid>94225</ms:gid> >> <ms:name>DENILI0715000005</ms:name> >> </ms:fb> >> </gml:featureMember> >> </wfs:FeatureCollection> >> >> >> Christoph >> >> Justin Deoliveira schrieb: >>> I know there was recently a bug fixed in ogr that fixes the >>> schemaLocation issue. Jan Jezek pointed it out recently: >>> >>> http://trac.osgeo.org/gdal/ticket/2938 >>> >>> Not sure if it is related in this case or not. >>> >>> Could you send me some sample gml output from MapServer. I would >>> generate it myself but I don't currently have MapServer installed... >>> and i have a million things to do. But if you send me some gml I would >>> be happy to look into what exactly is going wrong in geotools. >>> >>> -Justin >>> >>> Christoph Ratke wrote: >>>> Hello, >>>> does anybody has experiences parsing GML2 from a UMN Mapserver? >>>> The parsing example from the following link ( >>>> http://docs.codehaus.org/display/GEOTDOC/GML+XML+Support ) >>>> is working with Geoserver but not with Mapserver. >>>> >>>> I tried the gml2.Configuration (throws an Exception) and the >>>> wfs.Configuration >>>> (is not parsing the geometries) for the GML Parser both without success. >>>> >>>> It might have to do with the Mapserver schema location but I don't >>>> know how >>>> to solve this. >>>> >>>> Any ideas? >>>> Thanks, Christoph >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> >>>> Stay on top of everything new and different, both inside and around >>>> Java (TM) technology - register by April 22, and save >>>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. >>>> 300 plus technical and hands-on sessions. Register today. Use >>>> priority code J9JMT32. http://p.sf.net/sfu/p >>>> _______________________________________________ >>>> Geotools-gt2-users mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> >> ------------------------------------------------------------------------------ >> Stay on top of everything new and different, both inside and >> around Java (TM) technology - register by April 22, and save >> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. >> 300 plus technical and hands-on sessions. Register today. >> Use priority code J9JMT32. http://p.sf.net/sfu/p >> _______________________________________________ >> Geotools-gt2-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > -- Justin Deoliveira OpenGeo - http://opengeo.org Enterprise support for open source geospatial. ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
