I'm pretty sure the features in the FeatureCollection are all the same 
type as those in the FeatureStore. The features being added are created 
from the following function:

------- BEGIN CODE --------
     public Feature CreateFeatureInstance(Element rootElement,
             FeatureType featureType)
             throws ConversionException {
         Feature      featureInstance;
         ArrayList    attributesOfRoot = new ArrayList();
         ArrayList    attributesNeeded = new ArrayList();
         List         children         = rootElement.getChildren();
         ListIterator attributeIterator;
         Object[]     attributesObject;

         if (children.size() > 0)    // check to see that it's not empty
         {

             // get the attributes needed in a vector format
             for (int i = 0; i < featureType.getAttributeCount(); i++) {
                 attributesNeeded.add(featureType.getAttributeType(i));
             }

             try {
                 attributesOfRoot = GetAttributes((Element) children.get(0),
                                                  attributesNeeded);    // 
should only be one, so this is OK
             } catch (Exception e) {
                 throw new ConversionException(e.getMessage());
             }

             // Throw an exception we come up empty on attributes
             if (attributesOfRoot.size() < 1) {
                 throw new ConversionException(
                     "Feature instance creation error: no "
                     + featureType.getTypeName() + " found");
             }

             // If there's some attributes left, fill it in with blanks
             attributeIterator = attributesNeeded.listIterator();

             while (attributeIterator.hasNext()) {
                 attributeIterator.next();
                 attributesOfRoot.add("");
             }

             // load up the Object[] for creationg of a feature instance
             attributesObject = (Object[]) attributesOfRoot.toArray();

             try {
                 featureInstance = featureType.create(attributesObject);
             } catch (IllegalAttributeException iae) {
                 throw new ConversionException(
                     "Feature instance creation error: " + iae.getMessage());
             }

             return featureInstance;
         } else {
             throw new ConversionException(
                 "Element passed is empty! Feature instance creation 
failed...");
         }
     }
------- END CODE -------

The data store is created using the same featureType object (as seen 
below).
dataStore = new ShapefileDataStore(anURL);
             dataStore.createSchema(finalFeatureType);
             featureStore = (FeatureStore) dataStore.getFeatureSource(
                 finalFeatureType.getTypeName());

Yolan

*************************************************
* Yolan (Aaron Jackson) [EMAIL PROTECTED] *
*       http://mlug.missouri.edu/~yolan/        *
*    AIM: YolanLINUX, YolanOTHER, YolanLAPTOP   *
*                 ICQ: 74624109                 *
*************************************************
             *  Doubling Technologies *
             **************************

On Thu, 24 Aug 2006, Jesse Eichar wrote:

> The features in the Geometry collection have to be the same type as
> the features in the FeatureStore.
>
> Jesse
>
> On 24-Aug-06, at 9:53 AM, Aaron Jackson wrote:
>
>> Hi, I'm trying to add features from a FeatureCollection to a
>> FeatureStore.
>> When I do the add, I get the following exception:
>>
>> org.geotools.data.shapefile.shp.ShapefileException: Cannot handle
>> geometry type : com.vividsolutions.jts.geom.GeometryCollection
>>          at
>> org.geotools.data.shapefile.shp.JTSUtilities.getShapeType
>> (JTSUtilities.java:332)
>>          at org.geotools.data.shapefile.ShapefileDataStore
>> $Writer.write(ShapefileDataStore.java:1514)
>>          ...
>>
>>
>> Any suggestions?
>>
>> Yolan
>>
>> *************************************************
>> * Yolan (Aaron Jackson) [EMAIL PROTECTED] *
>> *       http://mlug.missouri.edu/~yolan/        *
>> *    AIM: YolanLINUX, YolanOTHER, YolanLAPTOP   *
>> *                 ICQ: 74624109                 *
>> *************************************************
>>              *  Doubling Technologies *
>>              **************************
>>
>> ----------------------------------------------------------------------
>> ---
>> Using Tomcat but need to do more? Need to support web services,
>> security?
>> Get stuff done quickly with pre-integrated technology to make your
>> job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> http://sel.as-us.falkag.net/sel?
>> cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to