我正在使用geotools庫。我的目標是輸入一個座標,然後獲取包含它的特徵信息。Geotools獲取特徵信息
Geotools快速啓動教程的地圖,正是我想要的,我用下面紅色的圓圈按鈕。但是,我找不到使用的方法。
我一直在谷歌搜索,閱讀文檔和調試代碼無濟於事。此方法似乎是要走的路: FeatureCollection myCollection = mySimpleFeatureSource.getFeatures(Query query);
或
的FeatureCollection MyCollection的= mySimpleFeatureSource.getFeatures(過濾器過濾);
但我還沒有弄清楚或發現如何查詢座標呢。如果有人願意借給我一把手,我會非常感激!
在此先感謝!
我跑的例子如下:
package org.geotools.tutorial.quickstart;
import java.io.File;
import org.geotools.data.FileDataStore;
import org.geotools.data.FileDataStoreFinder;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.map.FeatureLayer;
import org.geotools.map.Layer;
import org.geotools.map.MapContent;
import org.geotools.styling.SLD;
import org.geotools.styling.Style;
import org.geotools.swing.JMapFrame;
import org.geotools.swing.data.JFileDataStoreChooser;
/**
* Prompts the user for a shapefile and displays the contents on the screen in a map frame.
* <p>
* This is the GeoTools Quickstart application used in documentationa and tutorials. *
*/
public class Quickstart {
/**
* GeoTools Quickstart demo application. Prompts the user for a shapefile and displays its
* contents on the screen in a map frame
*/
public static void main(String[] args) throws Exception {
// display a data store file chooser dialog for shapefiles
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);
// Now display the map
JMapFrame.showMap(map);
}
}