当前位置: 首页>>代码示例>>Java>>正文


Java FeatureReader.next方法代码示例

本文整理汇总了Java中org.geotools.data.FeatureReader.next方法的典型用法代码示例。如果您正苦于以下问题:Java FeatureReader.next方法的具体用法?Java FeatureReader.next怎么用?Java FeatureReader.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.data.FeatureReader的用法示例。


在下文中一共展示了FeatureReader.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFidFilterQuery

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testFidFilterQuery() throws IllegalArgumentException, NoSuchElementException, IOException, CQLException {
    final String fidsString = fids.stream().collect(Collectors.joining("','", "'", "'"));
    final Filter filter = ECQL.toFilter("IN (" + fidsString + ")");
    final Query query = new Query(
            "GeoWaveFeatureReaderTest",
            filter,
            new String[] {
                "geometry",
                "pid"
            });
    final FeatureReader<SimpleFeatureType, SimpleFeature> reader =
        dataStore.getFeatureReader(query, Transaction.AUTO_COMMIT);
    int count = 0;
    while (reader.hasNext()) {
        final SimpleFeature feature = reader.next();
        assertTrue(fids.contains(feature.getID()));
        count++;
    }
    assertTrue(count == fids.size());
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:22,代码来源:GeoWaveFeatureReaderTest.java

示例2: testPidFilterQuery

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testPidFilterQuery() throws IllegalArgumentException, NoSuchElementException, IOException, CQLException {
    // Filter it so that it only queries for everything but the first pid.
    // There's only 2 pids total so it should just return the second one.
    final String pidsString = pids.subList(1, pids.size()).stream().collect(Collectors.joining("','", "'", "'"));
    final Filter filter = ECQL.toFilter("pid IN (" + pidsString + ")");
    final Query query = new Query(
            "GeoWaveFeatureReaderTest",
            filter,
            new String[] {
                "geometry",
                "pid"
            });
    final FeatureReader<SimpleFeatureType, SimpleFeature> reader =
        dataStore.getFeatureReader(query, Transaction.AUTO_COMMIT);
    int count = 0;
    while (reader.hasNext()) {
        final SimpleFeature feature = reader.next();
        assertTrue(fids.contains(feature.getID()));
        count++;
    }
    assertTrue(count == pids.size() - 1);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:24,代码来源:GeoWaveFeatureReaderTest.java

示例3: testLike

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testLike() throws IllegalArgumentException, NoSuchElementException, IOException, CQLException {
    final Query query = new Query(
            "GeoWaveFeatureReaderTest",
            ECQL.toFilter("pid like '" + pids.get(
                    0).substring(
                    0,
                    1) + "%'"),
            new String[] {
                "geometry",
                "pid"
            });
    final FeatureReader<SimpleFeatureType, SimpleFeature> reader =
        dataStore.getFeatureReader(query, Transaction.AUTO_COMMIT);
    int count = 0;
    while (reader.hasNext()) {
        final SimpleFeature feature = reader.next();
        assertTrue(fids.contains(feature.getID()));
        count++;
    }
    assertEquals(1, count);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:23,代码来源:GeoWaveFeatureReaderTest.java

示例4: example3

import org.geotools.data.FeatureReader; //导入方法依赖的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

示例5: getBoundsInternal

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
/**
 * Implementation that generates the total bounds
 * (many file formats record this information in the header)
 */
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException {
    ReferencedEnvelope bounds = new ReferencedEnvelope( getSchema().getCoordinateReferenceSystem() );
    
    FeatureReader<SimpleFeatureType, SimpleFeature> featureReader = getReaderInternal(query);
    try {
        while( featureReader.hasNext() ){
            SimpleFeature feature = featureReader.next();
            bounds.include( feature.getBounds() );
        }
    }
    finally {
        featureReader.close();
    }
    return bounds;
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:20,代码来源:CSVFeatureSource.java

示例6: testFID

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testFID()
		throws IllegalArgumentException,
		NoSuchElementException,
		IOException,
		CQLException {
	final FeatureReader<SimpleFeatureType, SimpleFeature> reader = dataStore.getFeatureReader(
			query,
			Transaction.AUTO_COMMIT);
	int count = 0;
	while (reader.hasNext()) {
		final SimpleFeature feature = reader.next();
		assertTrue(fids.contains(feature.getID()));
		count++;
	}
	assertTrue(count > 0);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:GeoWaveFeatureReaderTest.java

示例7: testRangeIndex

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testRangeIndex()
		throws IllegalArgumentException,
		NoSuchElementException,
		IOException {
	final FeatureReader<SimpleFeatureType, SimpleFeature> reader = dataStore.getFeatureReader(
			query,
			Transaction.AUTO_COMMIT);
	int count = 0;
	while (reader.hasNext()) {
		final SimpleFeature feature = reader.next();
		assertTrue(fids.contains(feature.getID()));
		count++;
	}
	assertEquals(
			1,
			count);

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:20,代码来源:GeoWaveFeatureReaderTest.java

示例8: testAllAttributes

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testAllAttributes()
		throws CQLException,
		IOException {
	final Query query = new Query(
			typeName,
			CQL.toFilter(cqlPredicate),
			Query.ALL_PROPERTIES);
	final FeatureReader<SimpleFeatureType, SimpleFeature> reader = geotoolsDataStore.getFeatureReader(
			query,
			Transaction.AUTO_COMMIT);
	int count = 0;
	while (reader.hasNext()) {
		final SimpleFeature feature = reader.next();
		count++;
		Assert.assertTrue(feature.getAttribute(geometry_attribute) != null);
		Assert.assertTrue(feature.getAttribute(long_attribute) != null);
		Assert.assertTrue(feature.getAttribute(string_attribute) != null);
	}
	Assert.assertTrue(count == 3);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:22,代码来源:GeoToolsAttributesSubsetTest.java

示例9: testSubsetAttributes

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testSubsetAttributes()
		throws CQLException,
		IOException {
	final Query query = new Query(
			typeName,
			CQL.toFilter(cqlPredicate),
			new String[] {
				geometry_attribute,
				string_attribute
			});
	final FeatureReader<SimpleFeatureType, SimpleFeature> reader = geotoolsDataStore.getFeatureReader(
			query,
			Transaction.AUTO_COMMIT);
	int count = 0;
	while (reader.hasNext()) {
		final SimpleFeature feature = reader.next();
		count++;
		Assert.assertTrue(feature.getAttribute(geometry_attribute) != null);
		Assert.assertTrue(feature.getAttribute(long_attribute) == null);
		Assert.assertTrue(feature.getAttribute(string_attribute) != null);
	}
	Assert.assertTrue(count == 3);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:25,代码来源:GeoToolsAttributesSubsetTest.java

示例10: testAllShapesArePolygon

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
public void testAllShapesArePolygon() {
    try {
        File fin = new File(CommunityAreas.shapeFilePath);
        ShapefileDataStore r = new ShapefileDataStore(fin.toURI().toURL());
        SimpleFeatureType sft = r.getSchema();

        assertEquals(sft.getTypes().size(), 10);
        assertEquals(sft.getType(0).getName().getLocalPart(), "MultiPolygon");
        assertEquals(sft.getType(5).getName().getLocalPart(), "AREA_NUMBE");
        assertEquals(sft.getType(6).getName().getLocalPart(), "COMMUNITY");

        FeatureReader<SimpleFeatureType, SimpleFeature> fr = r.getFeatureReader();

        SimpleFeature shp;

        int total = 0;
        while (fr.hasNext()) {
            total ++;
            shp = fr.next();
            MultiPolygon g = (MultiPolygon) shp.getDefaultGeometry();
        }

        fr.close();
        r.dispose();

        assertEquals(total, 77);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:thekingofkings,项目名称:embedding,代码行数:31,代码来源:CommunityAreasTest.java

示例11: withSubjects

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
private void withSubjects(FeatureReader<SimpleFeatureType, SimpleFeature> featureReader, DataStore dataStore, BiConsumer<SimpleFeature, Subject> fn) throws IOException, FactoryException, TransformException {
    MathTransform crsTransform = GeotoolsDataStoreUtils.makeCrsTransform(getSourceEncoding());

    while(featureReader.hasNext()) {
        SimpleFeature feature = featureReader.next();
        buildSubjectFromFeature(feature, crsTransform).ifPresent(subject -> {
            fn.accept(feature, subject);
            subjectBuffer.add(subject);
        });
        flushBufferIfRequired();
    }

    flushBuffer();
}
 
开发者ID:FutureCitiesCatapult,项目名称:TomboloDigitalConnector,代码行数:15,代码来源:AbstractGeotoolsDataStoreImporter.java

示例12: testFID

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testFID() throws IllegalArgumentException, NoSuchElementException, IOException, CQLException {
    final FeatureReader<SimpleFeatureType, SimpleFeature> reader =
        dataStore.getFeatureReader(query, Transaction.AUTO_COMMIT);
    int count = 0;
    while (reader.hasNext()) {
        final SimpleFeature feature = reader.next();
        assertTrue(fids.contains(feature.getID()));
        count++;
    }
    assertTrue(count > 0);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:13,代码来源:GeoWaveFeatureReaderTest.java

示例13: testBBOX

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testBBOX() throws IllegalArgumentException, NoSuchElementException, IOException {
    final FilterFactoryImpl factory = new FilterFactoryImpl();
    final Query query = new Query(
            "GeoWaveFeatureReaderTest",
            factory.bbox(
                    "",
                    -180,
                    -90,
                    180,
                    90,
                    "EPSG:4326"),
            new String[] {
                "geometry",
                "pid"
            });

    final FeatureReader<SimpleFeatureType, SimpleFeature> reader =
        dataStore.getFeatureReader(query, Transaction.AUTO_COMMIT);
    int count = 0;
    while (reader.hasNext()) {
        final SimpleFeature feature = reader.next();
        assertTrue(fids.contains(feature.getID()));
        count++;
    }
    assertTrue(count > 0);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:28,代码来源:GeoWaveFeatureReaderTest.java

示例14: testRangeIndex

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testRangeIndex() throws IllegalArgumentException, NoSuchElementException, IOException {
    final FeatureReader<SimpleFeatureType, SimpleFeature> reader =
        dataStore.getFeatureReader(query, Transaction.AUTO_COMMIT);
    int count = 0;
    while (reader.hasNext()) {
        final SimpleFeature feature = reader.next();
        assertTrue(fids.contains(feature.getID()));
        count++;
    }
    assertEquals(1, count);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:13,代码来源:GeoWaveFeatureReaderTest.java

示例15: testRemoveFeature

import org.geotools.data.FeatureReader; //导入方法依赖的package包/类
@Test
public void testRemoveFeature() throws IllegalArgumentException, NoSuchElementException, IOException, CQLException {
    final Query query = new Query(
            "GeoWaveFeatureReaderTest",
            ECQL.toFilter("pid like '" + pids.get(
                    0).substring(
                    0,
                    1) + "%'"),
            new String[] {
                "geometry",
                "pid"
            });
    final FeatureReader<SimpleFeatureType, SimpleFeature> reader =
        dataStore.getFeatureReader(query, Transaction.AUTO_COMMIT);
    int count = 0;
    while (reader.hasNext()) {
        final SimpleFeature feature = reader.next();
        assertTrue(fids.contains(feature.getID()));
        count++;
    }
    assertEquals(1, count);

    // Remove
    final FeatureWriter<SimpleFeatureType, SimpleFeature> writer =
        dataStore.getFeatureWriter(type.getTypeName(), Transaction.AUTO_COMMIT);
    try {
        while (writer.hasNext()) {
            writer.next();
            writer.remove();
        }
    } finally {
        writer.close();
    }

    // Re-query
    final FeatureReader<SimpleFeatureType, SimpleFeature> reader2 =
            dataStore.getFeatureReader(query, Transaction.AUTO_COMMIT);
    int recount = 0;
    while (reader2.hasNext()) {
        reader2.next();
        recount++;
    }
    assertEquals(0, recount);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:45,代码来源:GeoWaveFeatureReaderTest.java


注:本文中的org.geotools.data.FeatureReader.next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。