Could you use the ShapefileDataStore as is? As far as I know the 
ShapefileWriter is an internal class?

There is an example in the user guide here:
- http://docs.codehaus.org/display/GEOTDOC/05+How+to+Write+a+Shapefile

Cheers,
Jody

Antoine Weber wrote:
> Hello everyone,
>
> first of all excuse my poor english,
> I'm a french student and I have to develop a plug-in to an existing 
> java application named GenExp.
> The purpose of my work is to add an export plugin in order to create 
> .shp and .shx Shapefiles.
>
> So I tried with the class ShapefileWriter to do something like this 
> (where geoms is my Geometry[] ):
>
>                     String baseName = new String("myshape");
>                     log.writeGraphic("step1");
>
>                     FileOutputStream shpFos = new 
> FileOutputStream(baseName + ".shp");
>                     FileOutputStream shxFos = new 
> FileOutputStream(baseName + ".shx");
>                     log.writeGraphic("step2");
>
>                     FileChannel shpChan = shpFos.getChannel();
>                     FileChannel shxChan = shxFos.getChannel();
>                     log.writeGraphic("step3");
>
>                     ShapefileWriter shpWriter = new 
> ShapefileWriter(shpChan, shxChan);
>                     log.writeGraphic("step4);
>
>                     shpWriter.write(geoms,ShapeType.POLYGON);
>                     log.writeGraphic("step5);
>
> the compilation worked, but the application stop before step4 on 
> execution.
>
> Have anyone any idea that could help me?
> or could you explain me how to export lots of Polygon in a shapefile?
>
>
> Thanks in advance for your help,
> Weber Antoine
> Strasbourg, FRANCE
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> ------------------------------------------------------------------------
>
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>   


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to