2
这是我在stackoverflow中的第一个问题,所以我希望我以正确的方式做到这一点。如何使用GeoTools获得shapeFile .shp中多边形的所有点?
我正在使用geotools来读取shapeFile(.shp),我无法找到函数来获取多边形的所有点。现在我有以下代码:
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();
}
}
}
我收到shapFile的四个界限,但不包含多边形的点,是有可能做到这一点?
谢谢。
当我说点我的意思是该图的各点的纬度和经度 –
'SimpleFeatureIterator'并检查几何形状,[示例](http://docs.geotools.org/。稳定/ userguide /教程/几何/ geometrycrs.html)? – trashgod