Hi you can use the FeatureSource/Store API:
ShapefileDatastore ds;
FeatureSource source=ds.getFeatureSource( typename) ;
if( source instanceof FeatureStore ){
// this means you can add/modify features
FeatureStore store=(FeatureStore)store;
store.addFeatures( featureCollection );
// make sure that the features in the feature collection have the
// same feature type as returned by: store.getSchema()
}
source.getFeatures(filter);
Hope this helps,
Jesse
On 27-Jul-06, at 8:13 AM, John Cartwright wrote:
> Hello All,
>
> I'd like to build a simple application that splits a shapefile into a
> series of new shapefile "tiles". Can anyone point me to a simple
> example for reading/writing shapefiles using GT2.2?
>
> The example in the ShapefileReader javadocs (listed below) doesn't
> seem
> to be correct.
>
> Thanks!
>
> -- john
>
> FileChannel in = new FileInputStream(filename).getChannel();
> ShapefileReader r = new ShapefileReader( in );
> while (r.hasNext()) {
> Geometry shape = (Geometry) r.nextRecord().shape()
> // do stuff
> }
> r.close();
>
>
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys -- and earn
> cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users