5、按条件查询要素集
这里类似于mybatis的查询数据库,这里可以实现空间检索,也就是说通过经纬度图形,可以找到与它有相交的周边的所有要素。
Object geom = feature.getAttribute(geometryPropertyName); Geometry geometry = reader.read(geom.toString()); Geometry boundary = geometry.getBoundary(); Filter filter = ff.intersects(ff.property(geometryPropertyName), ff.literal(boundary)); SimpleFeatureCollection features = sourceFeatureStore.getFeatures(); SimpleFeatureIterator iterator = features.features(); while (iterator.hasNext()) { SimpleFeature next = iterator.next(); Object geom = next.getAttribute(geometryPropertyName); }
https://www.jianshu.com/p/db1e02eacc1c
GeometryBuilder builder = new GeometryBuilder(); GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory( null ); //SimpleFeatureType TYPE = ; Point p = geometryFactory.createPoint(new Coordinate(110,37)); Point pointOnLine = polyFinder.findNearestPolygon(p);
>>
https://blog.csdn.net/oYinHeZhiGuang/article/details/118316074(GeoTools入门(六)-- 查询那点事)
https://www.jianshu.com/p/24805075d16a(geotools学习(四)查询)
https://blog.csdn.net/qq_18671415/article/details/110427356