Hi and thank's for response.
This method worked correctly.
But after adding a field to the shapefile from arcMap, i get this error.
Regards,
Mike
-----E-mail d'origine-----
De : Robert Najlis <[EMAIL PROTECTED]>
A : [EMAIL PROTECTED]
Cc : [EMAIL PROTECTED]
Envoyé le : Ve, 7 Mars 2008 16:39
Sujet : Re: [Repast-interest] feature writer
you might want to do some checking on the type of the feature - maybe
here is some strange feature in your shapefile? If so, you could
otentially check for that and handle it..
Robert
On Mar 7, 2008, at 7:01 AM, [EMAIL PROTECTED] wrote:
> Hi
I use repast 3 and i have to write on a shapefile.
so, i did the following:
File f2 = new File ("C:/EdgeShape.shp");
URL shapeURL2 = f2.toURL();
ShapefileDataStore store2 = new ShapefileDataStore (shapeURL2);
String name2 = store2.getTypeNames()[0];
FeatureSource source2 = store2.getFeatureSource(name2);
FeatureWriter aWriter2 = store2.getFeatureWriter(name2,
((FeatureStore) source2).getTransaction());
while (aWriter2.hasNext())
{
Feature feature2 = aWriter2.next();
int capDebFin = 5
feature2.setAttribute(40, 6);
aWriter2.write();
}
aWriter2.close();
So, i have the following error:
Exception in thread "main" java.lang.IllegalStateException:
ShapeType changed illegally from ArcM to Arc
at org.geotools.data.shapefile.shp.ShapefileReader.nextRecord
(ShapefileReader.java:358)
at org.geotools.data.shapefile.ShapefileDataStore$Reader.next
(ShapefileDataStore.java:421)
at org.geotools.data.FIDFeatureReader.next(FIDFeatureReader.java:87)
at org.geotools.data.shapefile.ShapefileDataStore$Writer.next
(ShapefileDataStore.java:713)
at org.geotools.data.InProcessLockingManager$1.next
(InProcessLockingManager.java:310)
at extractraph.TestShapeWriter.main(TestShapeWriter.java:124)
Thank's for help.
Regards,
Mike
----------------------------------------------------------------------
---
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Repast-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/repast-interest
------------------------------------------------------------------------
his SF.net email is sponsored by: Microsoft
efy all challenges. Microsoft(R) Visual Studio 2008.
ttp://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
______________________________________________
epast-interest mailing list
[EMAIL PROTECTED]
ttps://lists.sourceforge.net/lists/listinfo/repast-interest
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users