Hi Scott / Jim:
I think I have my first good cut of FeatureCollection parsing in gt-xml ready
for you to try out.
This solution allows a FeatureCollection to be produced - even in cases where
the schema does not work out very well - or cannot be found.
The trick was that the parser does not stop dead when the schema does not
correctly defined what an AbstractFeatureCollection is; or what element is is
defined against an AbstractFeature.
Instead it returns "stuff"...
In GML:
- simpleType( Object ) - will produce a SimpleFeaturType based on the object
provided; making up an "Unknown" FeatureType if the object is a Geometry; or if
the Object is a Map<?,?>.
- simpleFeatureObject( Object, SimpleFeature ) does the same kind of convert
for Geometry or Map content.
The "Unknown" FeatureType:
- is defined by the map key value pairs; and will work best with non null
values (so bindings can be provided)
- is defined using "the_geom" for a Geometry
- correctly looks up Geometry getUserData() to determine
CoordinateReferneceSystem, srsName or SRID
Here is an example that depends on the schema defining something that binds to
SimpleFeature; this is brittle and will generally die if the schema cannot be
sorted out:
GML gml = new GML(Version.GML3);
SimpleFeatureIterator iter = gml.decodeFeatureIterator(in);
Here is an example that will pluck just a geometry out and wrap it up for use
as a unknown feature type:
QName name = new QName("http://www.opengis.net/gml","MultiSurface");
GML gml = new GML(Version.GML3);
SimpleFeatureIterator iter = gml.decodeFeatureIterator(in,name);
Jody
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel