Reputation: 117
I want to draw a line from the values in my array's. I have 2 arrays namely latitude
and longitude
, which contains the values. I want to draw a line with those values on my shape file. (".SHP") using geotools.
Upvotes: 1
Views: 961
Reputation: 5443
Use the code below to create a POINT
, then create a FeatureCollection
and then a shapefile :
SimpleFeatureCollection collection = FeatureCollections.newCollection();
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE);
Point point = geometryFactory.createPoint(new Coordinate(longitude, latitude));
featureBuilder.add(point);
SimpleFeature feature = featureBuilder.buildFeature(null);
collection.add(feature);
read geoTools feature tutorial for more information.
Upvotes: 1