Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用java绘制形状文件_Java_Shapefile - Fatal编程技术网

用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) {

我想读一个java形状文件,然后画出来。是否仍然可以读取形状文件并用java绘制它?你知道任何有用且简单的框架吗

谢谢。

你可以试试。你可以从这个代码开始

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);
}
}
摘自: