geotools创建线文件

final SimpleFeatureType TYPE = DataUtilities.createType("Location",  
                "location:LineString," + // <- the geometry attribute: Point type  
                "POIID:String," + // <- a String attribute  
                "MESHID:String," + // a number attribute  
                "OWNER:String"  
            );

 Coordinate[] pp = new Coordinate[] {new Coordinate(longitude, latitude),new Coordinate(116.222, 39.220001)};
			LineString lineStr = geometryFactory.createLineString(pp);
            
	    Object[] obj = {lineStr, POIID, MESHID, OWNER};  
            SimpleFeature feature = featureBuilder.buildFeature(null, obj);  
            collection.add(feature);  
            feature = featureBuilder.buildFeature(null, obj);  
            collection.add(feature);  
            File newFile = new File("D:/newPoi.shp"); 

转载自:https://blog.csdn.net/wt346326775/article/details/70238401

You may also like...

退出移动版