On Wed, Feb 1, 2012 at 3:10 AM, Yang <[email protected]> wrote:

> to create a featureCollection, i need to create a FeatureType,
>
> SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
> typeBuilder.add("location", Polygon.class);
>
> FeatureType mytype = typeBuilder.buildFeatureType();
>
> SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder();
>
>
>
> then after I created a feature,
> featureBuilder.add(mynewpolygon);
> Feature f = featureBuilder.buildFeature(null);
>
> featureCollection.add(f);
>
>
>
> but if in the same featureCollection, I also want to insert some
> MultiPolygon, how can I do it?
> the problem is when I store the featureCollection, the ShapeFileDataStore
> requires a **single** feature type
> ShapefileDataStore.createSchema()
>
>
> so do I have to insert each standalone polygon into a multipolygon ?
>

Correct. A shapefile is by specification going to contain a single geometry
type
(e.g., it's not something we made up, it's just how a shapefile it's
supposed to work).

Cheers
Andrea


-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313
mob:    +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to