public SimpleFeature next() throws IOException { // closed already, error! if (featureReader == null) { throw new IOException("Writer closed"); } // we have to write the current feature back into the stream if (currentFeature != null) { write(); } // is there another? If so, return it if (featureReader.hasNext()) { return currentFeature = featureReader.next(); } // reader has no more (no were are adding to the file) // so return an empty feature String featureID = getFeatureType().getTypeName() + "." + (records + 1); return currentFeature = DataUtilities.template(getFeatureType(), featureID, emptyAtts); }
public void testTemplateFeatureType() throws IllegalAttributeException { SimpleFeature feature = DataUtilities.template(roadType); assertNotNull(feature); assertEquals(roadType.getAttributeCount(), feature.getAttributeCount()); }
final SimpleFeature destFeature = DataUtilities.template(indexSchema); Collection<Property> props = sourceFeature.getProperties(); Name propName = null;
final SimpleFeatureType indexSchema) { final SimpleFeature feature = DataUtilities.template(indexSchema); feature.setAttribute( CoverageSlice.Attributes.GEOMETRY,
new ShapefileCompatibleFeature(DataUtilities.template(indexSchema)); store.setTransaction(transaction);
public void testTemplateFeatureTypeString() throws IllegalAttributeException { SimpleFeature feature = DataUtilities.template(roadType, "Foo"); assertNotNull(feature); assertEquals(roadType.getAttributeCount(), feature.getAttributeCount()); assertEquals("Foo", feature.getID()); assertNull(feature.getAttribute("name")); assertNull(feature.getAttribute("id")); assertNull(feature.getAttribute("geom")); }
public Feature next() throws IOException, NoSuchElementException { if (hasNext()) { // existing content live = (SimpleFeature) iterator.next(); try { current = featureType.duplicate(live); } catch (IllegalAttributeException e) { throw new DataSourceException("Unable to edit " + live.getID() + " of " + typeName); } } else { // new content live = null; try { current = DataUtilities.template(featureType); } catch (IllegalAttributeException e) { throw new DataSourceException("Unable to add additional Features of " + typeName); } } return current; }
public org.geotools.feature.Feature next() throws IOException { // closed already, error! if (featureReader == null) { throw new IOException("Writer closed"); } // we have to write the current feature back into the stream if (currentFeature != null) { write(); } // is there another? If so, return it if (featureReader.hasNext()) { try { return currentFeature = featureReader.next(); } catch (IllegalAttributeException iae) { throw new DataSourceException("Error in reading", iae); } } // reader has no more (no were are adding to the file) // so return an empty feature try { return currentFeature = DataUtilities.template(getFeatureType(), emptyAtts); } catch (IllegalAttributeException iae) { throw new DataSourceException("Error creating empty Feature", iae); } }
SimpleFeature feature = DataUtilities.template(featureType);
@Test public void testFeatureTypeAdapterHandlesSimilarCRSes() throws SchemaException, IOException { // create two FT - only difference is they have different (but compatible) CRS. SimpleFeatureType schema1 = createSampleType((CoordinateReferenceSystem) PROJ_EPSG4326_CRS); SimpleFeatureType schema2 = createSampleType( (CoordinateReferenceSystem) PROJ_EQUIV_EPSG4326_CRS); // make 2 features for the first schema SimpleFeature f1 = DataUtilities.template(schema1); f1.setDefaultGeometry(gf.createPoint(new Coordinate(1, 1))); SimpleFeature f2 = DataUtilities.template(schema1); f2.setDefaultGeometry(gf.createPoint(new Coordinate(2, 2))); // create a FeatureSource for these 2 features SimpleFeature[] features = new SimpleFeature[] { f1, f2 }; SimpleFeatureSource fs = DataUtilities.source(features); // this is what we are testing - adapting between the two different (but compatible) CRS. FeatureTypeAdapterFeatureSource ftafs = new FeatureTypeAdapterFeatureSource(fs, schema2); // get the resulting features List<SimpleFeature> newFeatures = DataUtilities.list(ftafs.getFeatures()); //verify correct Assert.isTrue(f1.equals(newFeatures.get(0))); Assert.isTrue(f2.equals(newFeatures.get(1))); }
public SimpleFeature next() throws IOException { // closed already, error! if (featureReader == null) { throw new IOException("Writer closed"); } // we have to write the current feature back into the stream if (currentFeature != null) { write(); } // is there another? If so, return it if (featureReader.hasNext()) { try { return currentFeature = featureReader.next(); } catch (IllegalAttributeException iae) { throw new DataSourceException("Error in reading", iae); } } // reader has no more (no were are adding to the file) // so return an empty feature try { String featureID = getFeatureType().getTypeName()+"."+(records+1); return currentFeature = DataUtilities.template(getFeatureType(), featureID, emptyAtts); } catch (IllegalAttributeException iae) { throw new DataSourceException("Error creating empty Feature", iae); } }
final int dimSize = variable.getDimensions().size(); final SimpleFeature feature = DataUtilities.template(indexSchema); feature.setAttribute(CoverageSlice.Attributes.GEOMETRY, UnidataCRSUtilities.GEOM_FACTORY.toGeometry(reader.boundingBox)); feature.setAttribute(CoverageSlice.Attributes.INDEX, imageIndex);
public SimpleFeature next() throws IOException { // closed already, error! if (featureReader == null) { throw new IOException("Writer closed"); } // we have to write the current feature back into the stream if (currentFeature != null) { write(); } // is there another? If so, return it if (featureReader.hasNext()) { try { return currentFeature = featureReader.next(); } catch (IllegalAttributeException iae) { throw new DataSourceException("Error in reading", iae); } } // reader has no more (no were are adding to the file) // so return an empty feature try { String featureID = getFeatureType().getTypeName()+"."+(records+1); return currentFeature = DataUtilities.template(getFeatureType(), featureID, emptyAtts); } catch (IllegalAttributeException iae) { throw new DataSourceException("Error creating empty Feature", iae); } }
public org.geotools.feature.Feature next() throws IOException { // closed already, error! if (featureReader_ == null) { throwIOExc(); } // we have to write the current feature back into the stream if (currentFeature_ != null) { write(); } // is there another? If so, return it if (featureReader_.hasNext()) { try { return currentFeature_ = featureReader_.next(); } catch (final IllegalAttributeException iae) { throw new DataSourceException("Error in reading", iae); } } // reader has no more (no were are adding to the file) // so return an empty feature try { return currentFeature_ = DataUtilities.template(getFeatureType(), emptyAtts_); } catch (final IllegalAttributeException iae) { throw new DataSourceException("Error creating empty Feature", iae); } }
return currentFeature = DataUtilities.template( getFeatureType(), getCurrentTypeName()+"."+id, emptyAtts); } catch (IllegalAttributeException iae) {
final SimpleFeature feature = DataUtilities.template(indexSchema); feature.setAttribute(indexSchema.getGeometryDescriptor().getLocalName(), geomFactory.toGeometry(new ReferencedEnvelope((Envelope) envelope))); feature.setAttribute(runConfiguration.getLocationAttribute(), prepareLocation(fileBeingProcessed));
Feature temp = DataUtilities.template(featureType);
@Test public void testFeatureTypeAdapterHandlesSimilarCRSes() throws SchemaException, IOException { // create two FT - only difference is they have different (but compatible) CRS. SimpleFeatureType schema1 = createSampleType((CoordinateReferenceSystem) PROJ_EPSG4326_CRS); SimpleFeatureType schema2 = createSampleType( (CoordinateReferenceSystem) PROJ_EQUIV_EPSG4326_CRS); // make 2 features for the first schema SimpleFeature f1 = DataUtilities.template(schema1); f1.setDefaultGeometry(gf.createPoint(new Coordinate(1, 1))); SimpleFeature f2 = DataUtilities.template(schema1); f2.setDefaultGeometry(gf.createPoint(new Coordinate(2, 2))); // create a FeatureSource for these 2 features SimpleFeature[] features = new SimpleFeature[] { f1, f2 }; SimpleFeatureSource fs = DataUtilities.source(features); // this is what we are testing - adapting between the two different (but compatible) CRS. FeatureTypeAdapterFeatureSource ftafs = new FeatureTypeAdapterFeatureSource(fs, schema2); // get the resulting features List<SimpleFeature> newFeatures = DataUtilities.list(ftafs.getFeatures()); //verify correct Assert.isTrue(f1.equals(newFeatures.get(0))); Assert.isTrue(f2.equals(newFeatures.get(1))); }
final SimpleFeatureType indexSchema) { final SimpleFeature feature = DataUtilities.template(indexSchema); feature.setAttribute( CoverageSlice.Attributes.GEOMETRY,