This is my first question in stackoverflow so I hope that I am doing it in the right way.
I am using geotools to read a shapeFile (.shp) and I cannot find the function to get all the points of the polygon. By now I have the following code:
public class ImportShapeFileService implements ImportShapeFileServiceInterface {
@Override
public void loadShapeFile(File shapeFile) throws MdfException {
FileDataStore store;
try {
store = FileDataStoreFinder.getDataStore(shapeFile);
SimpleFeatureSource featureSource = store.getFeatureSource();
SimpleFeatureCollection collection = featureSource.getFeatures();
ReferencedEnvelope env = collection.getBounds();
double left = env.getMinX();
double right = env.getMaxX();
double top = env.getMaxY();
double bottom = env.getMinY();
} catch (IOException e) {
e.printStackTrace();
}
}
}
I am getting the four bounds of the shapFile, but not the points of the polygon that contains, is it possible to do that?
Thank you.