Have a look at the CSV2Shp tutorial. Shapefile can only hold one kind of 
content.

So if you want to convert from Point --> Polygon using buffer ... you will need 
to make a second FeatureType (and thus a second FeatureCollection) "the_geom" 
attribute of type Polygon.

However if you are just focused on rendering, the PointSymbolizer can apply a 
buffer for you (just set the mark size).
-- 
Jody Garnett

On 12 November 2013 at 9:10:47 pm, Bryan Hempen ([email protected]) wrote:

Hello everyone,  

we are having problems creating a SimpleFeature from a Geometry. These  
are our steps:  

1. Read a number of features from a Shapefile  

File file1 = new File("bla.shp");  
FileDataStore store1 = FileDataStoreFinder.getDataStore(file1);  
SimpleFeatureSource featureSource1 = store1.getFeatureSource();  
SimpleFeatureCollection s1 = featureSource1.getFeatures();  

2. Get a specific feature from the collection and buffer  

SimpleFeature feature1 = ....  
Geometry geom1 = (Geometry) feature1.getDefaultGeometry();  
Geometry buffer = geom1.buffer( 0.1 );  

3. Converting the buffer-Geometry back to a SimpleFeature for further  
processing / visualization  

We tried:  

feature.setDefaultGeometry(buffer); // ---> Doesn't work  

We have also tried using the SimpleFeatureBuilder to create a new  
Feature, but it didn't work out:  

SimpleFeatureType featureType = feature1.getType();  
SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);  

builder.add( buffer );  
builder.add( "theName" );  

SimpleFeature x = builder.buildFeature( "fid908" );  
s1.add(x); // --> returns false, so does not work  

How the hell do we convert the buffer-Geometry to a Simple Feature? Can  
anyone help with simple step by step instructions or an URL?  

Kind regards  

Bryan Hempen  

------------------------------------------------------------------------------  
November Webinars for C, C++, Fortran Developers  
Accelerate application performance with scalable programming models. Explore  
techniques for threading, error checking, porting, and tuning. Get the most  
from the latest Intel processors and coprocessors. See abstracts and register  
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk  
_______________________________________________  
GeoTools-GT2-Users mailing list  
[email protected]  
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users  
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to