用java绘制形状文件
我想读一个java形状文件,然后画出来。是否仍然可以读取形状文件并用java绘制它?你知道任何有用且简单的框架吗 谢谢。你可以试试。你可以从这个代码开始用java绘制形状文件,java,shapefile,Java,Shapefile,我想读一个java形状文件,然后画出来。是否仍然可以读取形状文件并用java绘制它?你知道任何有用且简单的框架吗 谢谢。你可以试试。你可以从这个代码开始 public class Quickstart { public static void main(String[] args) throws Exception { File file = JFileDataStoreChooser.showOpenFile("shp", null); if (file == null) {
public class Quickstart {
public static void main(String[] args) throws Exception {
File file = JFileDataStoreChooser.showOpenFile("shp", null);
if (file == null) {
return;
}
FileDataStore store = FileDataStoreFinder.getDataStore(file);
SimpleFeatureSource featureSource = store.getFeatureSource();
// Create a map content and add our shapefile to it
MapContent map = new MapContent();
map.setTitle("Quickstart");
Style style = SLD.createSimpleStyle(featureSource.getSchema());
Layer layer = new FeatureLayer(featureSource, style);
map.addLayer(layer);
// Display the map
JMapFrame.showMap(map);
}
}
摘自: