Hello I am forwarding this for a collegue who's having problems
posting to the list.
Thanx
gaby
-------- Original Message --------
Subject: Graphics2D and ShapefileDataStore
Date: Fri, 29 Jun 2007 14:00:58 +1200
From: Yvonne Baeverle <[EMAIL PROTECTED]>
Organization: NIWA
Hello all,
I need to write a painted Graphics2D ( polygon) into a new shapefile.
Currently I use DataStore for creating a new File and MultiPolygon as
type of the shape, set attributes, create schema and all this stuff
(see code) but of course this new shapefile is empty because I don't
know how I can set the coordinates and write this polygon into the shape.
File file = save.getSelectedFile();
URL anURL = file.toURL();
ShapefileDataStore datastore = new ShapefileDataStore(anURL);
String name = datastore.getTypeNames()[0];
AttributeType geom =
AttributeTypeFactory.newAttributeType(name,MultiPolygon.class);
FeatureType ftPoly = FeatureTypeFactory.newFeatureType(new
AttributeType[] { geom},name);
datastore.createSchema(ftPoly);
Feature thePoly = ftPoly.create(new Object[] { geometry, width },name);
FeatureWriter aWriter =
datastore.getFeatureWriter(name,((FeatureStore)datastore.getFeatureSource(name)).getTransaction());
Feature aNewFeature = aWriter.next();
aNewFeature.setAttribute(name,new Object[] { geometry });
aWriter.write();
aWriter.close();
So, does anybody know how to handle this or just give an idea?
Is it generally possible to do it this way? (It'll be the most
comfortable way for the user)
Thanks!
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users