Jody,

 

Thanks for answering my questions. The schema I used does extend abstract 
feature collection.

 

<xs:import namespace="http://www.opengis.net/gml"; 
schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/>

<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" 
substitutionGroup="gml:_FeatureCollection"/>

<xs:complexType name="FeatureCollectionType">

  <xs:complexContent>

    <xs:extension base="gml:AbstractFeatureCollectionType">

      <xs:attribute name="lockId" type="xs:string" use="optional"/>

      <xs:attribute name="scope" type="xs:string" use="optional"/>

    </xs:extension>

  </xs:complexContent>

</xs:complexType>

 

When you say that GML2 does not provide a feature collection (but defines the 
abstract feature collection type), that means that it does not declare a 
feature collection element? But WFS 1.1, WFS 1.2 and GML3 declare a generic 
feature collection element?

 

When you say that the SimpleFeatureCollection does not handle mixed feature 
types, does that just mean that it can only hold SimpleFeature elements or that 
the same feature type created from the SimpleFeatureBuilder must be used to 
created all of the features in the SimpleFeatureCollection? But then you need 
different feature types to create the different geometries? For example.

 

    // point feature builder

    SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder();

    tb.setNamespaceURI(FEATURE_NAMESPACE);

    tb.setName("Point");

    tb.add("featureMember", com.vividsolutions.jts.geom.Point.class);

    pointFeatureType = tb.buildFeatureType();

    pointFeatureBuilder = new SimpleFeatureBuilder(pointFeatureType);

 

    // polygon feature builder

    tb = new SimpleFeatureTypeBuilder();

    tb.setNamespaceURI(FEATURE_NAMESPACE);

    tb.setName("Polygon");

    tb.add("featureMember", com.vividsolutions.jts.geom.Polygon.class);

    polygonFeatureType = tb.buildFeatureType();

    polygonFeatureBuilder = new SimpleFeatureBuilder(polygonFeatureType);

 

Thanks,

Ken

 

From: Jody Garnett [mailto:jody.garn...@gmail.com] 
Sent: Friday, May 20, 2011 8:39 PM
To: Ken Magnes
Cc: geotools-gt2-users@lists.sourceforge.net
Subject: Re: [Geotools-gt2-users] Need help with GML encoding

 

I'm using GeoTools v2.7.0.1 and having issues with GML encoding. I have tried 
both the gml2.GMLConfiguration with the org.geotools.xml.Encoder class and also 
the org.geotools.GML utility class.

Cool; hopefully I will learn something from your example.  The GML utility 
class is just trying to package up  the best way to do things.

1. Could you please point out what may be wrong with the following GML2 
encoding example.

Looks like you have a schema; so that is the first hurdle.  GML2 does not 
provide a feature collection; but it looks like you have done that.

Q: does your feature collection extend abstract feature collection?

 

The GeoTools SimpleFeatureCollection does not handle mixed feature types for 
the children (your single "feature type" can have a geometry; allowing it to 
store point, line or polygon information).

 

This restriction only applies to SimpleFeatureCollection; but for more details 
you need to talk to the app-schema developers.

Also, does the structure of the SimpleFeatureCollection (how the simple feature 
types are created) impact the ability to encode with a particular schema?

This is a place where I am not always sure; it looks like some of the encoders 
can recognise extra hints provided in:

- attribute / feature getUserData() - not completely sure what is stored here; 
mostly used for application schema work?

- Geometry.getUserData() - sometimes this is a CoordianteReferenceSystem or a 
String indicating the srsName   

2. Since I am trying to represent a feature collection using GML that can 
contain mixed types and the features will have some custom  
attributes/properties (like GeoJSON), is there an exising defacto "standard" 
feature collection GML-based schema that can be leveraged (like  some WFS 
feature collection schema)?

 

It depends on the configuration; GML2 does not provide one, WFS1.1, WFS1.2 and 
GML3 do provide a generic feature collection to hold stuff.

3. I do not see any encoding examples in 
http://svn.osgeo.org/geotools/trunk/modules/extension/xsd/xsd-gml2/src/test/java/org/geotools/gml2/GMLApplicationSchemaParsingTest.java
 
<http://svn.osgeo.org/geotools/trunk/modules/extension/xsd/xsd-gml2/src/test/java/org/geotools/gml2/GMLApplicationSchemaParsingTest.java%0d%0anor>
  nor  in any of the other test files inside that package.

You will need to talk to the module maintainer then; or explore some of the 
other packages for an encoding example. 

 

Cheers,

Jody

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to