GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE);
Point point = geometryFactory.createPoint(new Coordinate(longitude, latitude));
featureBuilder.add(point);
这是我实施的代码
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
Point point = geometryFactory.createPoint(new Coordinate(Long.get(0), Lat.get(0)));
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder();
但我不能表演。它要求SimpleFeatureBuilder()中的futuretype。任何人都可以帮助我。
答案 0 :(得分:0)
GeoTools需要一个“模式”或FeatureType来描述您尝试构建的功能。所以你需要做一些事情:
final SimpleFeatureType TYPE = DataUtilities.createType("Location",
"the_geom:Point:srid=4326," + // <- the geometry attribute: Point type
//"name:String," + // <- a String attribute
//"number:Integer" // a number attribute
);
您肯定需要POINT线。如果您决定稍后为您的点添加一些属性,则需要添加更多行,如已注释掉的行。