當前位置: 首頁>>代碼示例>>Java>>正文


Java DataStore.getFeatureReader方法代碼示例

本文整理匯總了Java中org.geotools.data.DataStore.getFeatureReader方法的典型用法代碼示例。如果您正苦於以下問題:Java DataStore.getFeatureReader方法的具體用法?Java DataStore.getFeatureReader怎麽用?Java DataStore.getFeatureReader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.geotools.data.DataStore的用法示例。


在下文中一共展示了DataStore.getFeatureReader方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: example3

import org.geotools.data.DataStore; //導入方法依賴的package包/類
private static void example3() throws IOException {
    System.out.println("example3 start\n");
    // example3 start
    Map<String, Serializable> params = new HashMap<String, Serializable>();
    params.put("directory", directory);
    DataStore datastore = DataStoreFinder.getDataStore(params);

    Query query = new Query("example");
    FeatureReader<SimpleFeatureType, SimpleFeature> reader = datastore
            .getFeatureReader(query, Transaction.AUTO_COMMIT);
    try {
        int count = 0;
        while (reader.hasNext()) {
            SimpleFeature feature = reader.next();
            System.out.println("feature " + count + ": " + feature.getID());
            count++;
        }
        System.out.println("read in " + count + " features");
    } finally {
        reader.close();
    }
    // example3 end
    System.out.println("\nexample3 end\n");
}
 
開發者ID:ianturton,項目名稱:geotools-cookbook,代碼行數:25,代碼來源:PropertyExamples.java

示例2: example4

import org.geotools.data.DataStore; //導入方法依賴的package包/類
private static void example4() throws IOException {
    System.out.println("example4 start\n");
    // example4 start
    Map<String, Serializable> params = new HashMap<String, Serializable>();
    params.put("directory", directory);
    DataStore store = DataStoreFinder.getDataStore(params);

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Set<FeatureId> selection = new HashSet<FeatureId>();
    selection.add(ff.featureId("fid1"));

    Filter filter = ff.id(selection);
    Query query = new Query("example", filter);

    FeatureReader<SimpleFeatureType, SimpleFeature> reader = store
            .getFeatureReader(query, Transaction.AUTO_COMMIT);

    try {
        while (reader.hasNext()) {
            SimpleFeature feature = reader.next();
            System.out.println("feature " + feature.getID());

            for (Property property : feature.getProperties()) {
                System.out.print("\t");
                System.out.print(property.getName());
                System.out.print(" = ");
                System.out.println(property.getValue());
            }
        }
    } finally {
        reader.close();
    }
    // example4 end
    System.out.println("\nexample4 end\n");
}
 
開發者ID:ianturton,項目名稱:geotools-cookbook,代碼行數:37,代碼來源:PropertyExamples.java

示例3: getFeatureReader

import org.geotools.data.DataStore; //導入方法依賴的package包/類
public static FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader(DataStore store, String typeName) throws IOException {
    DefaultQuery query = new DefaultQuery(typeName);
    return store.getFeatureReader(query, Transaction.AUTO_COMMIT);
}
 
開發者ID:FutureCitiesCatapult,項目名稱:TomboloDigitalConnector,代碼行數:5,代碼來源:GeotoolsDataStoreUtils.java


注:本文中的org.geotools.data.DataStore.getFeatureReader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。