/** * Sets the srs of the next attribute added to the feature type. * * <p>The <tt>srs</tt> parameter is the id of a spatial reference system, for example: * "epsg:4326". * * <p>This only applies if the attribute added is geometric. * * <p>This value is reset after a call to {@link #add(String, Class)} * * @param srs The spatial reference system. */ public SimpleFeatureTypeBuilder srs(String srs) { if (srs == null) { return crs(null); } return crs(decode(srs)); }
/** * Sets the srid of the next attribute added to the feature type. * * <p>The <tt>srid</tt> parameter is the epsg code of a spatial reference system, for example: * "4326". * * <p>This only applies if the attribute added is geometric. * * <p>This value is reset after a call to {@link #add(String, Class)} * * @param srid The id of a spatial reference system. */ public SimpleFeatureTypeBuilder srid(Integer srid) { if (srid == null) { return crs(null); } return crs(decode("EPSG:" + srid)); }
ftBuilder.crs(crs);
/** * Sets all the attribute specific state from a single descriptor. * * <p>This method is convenience for: <code> * builder.minOccurs( descriptor.getMinOccurs() ).maxOccurs( descriptor.getMaxOccurs() ) * .nillable( descriptor.isNillable() )... * </code> */ public SimpleFeatureTypeBuilder descriptor(AttributeDescriptor descriptor) { minOccurs(descriptor.getMinOccurs()); maxOccurs(descriptor.getMaxOccurs()); nillable(descriptor.isNillable()); // namespaceURI( descriptor.getName().getNamespaceURI() ); defaultValue(descriptor.getDefaultValue()); if (descriptor instanceof GeometryDescriptor) { crs(((GeometryDescriptor) descriptor).getCoordinateReferenceSystem()); } return this; }
crs = origional.getCoordinateReferenceSystem(); build.crs(crs); build.add(name, binding); } else {
ftBuilder.crs(crs);
/** * Sets the srid of the next attribute added to the feature type. * <p> * The <tt>srid</tt> parameter is the epsg code of a spatial reference * system, for example: "4326". * </p> * <p> * This only applies if the attribute added is geometric. * </p> * <p> * This value is reset after a call to {@link #add(String, Class)} * </p> * * @param srid The id of a spatial reference system. */ public SimpleFeatureTypeBuilder srid( Integer srid ) { if ( srid == null ) { return crs( null ); } return crs( decode( "EPSG:" + srid ) ); }
/** * Sets the srs of the next attribute added to the feature type. * <p> * The <tt>srs</tt> parameter is the id of a spatial reference system, for * example: "epsg:4326". * </p> * <p> * This only applies if the attribute added is geometric. * </p> * <p> * This value is reset after a call to {@link #add(String, Class)} * </p> * * @param srs The spatial reference system. */ public SimpleFeatureTypeBuilder srs( String srs ) { if ( srs == null ) { return crs( null ); } return crs(decode(srs)); }
public ZonalStatisticsCollection( SimpleFeatureCollection data, String dataAttribute, SimpleFeatureCollection zones) { super(zones); this.dataAttribute = dataAttribute; this.data = data; SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); for (AttributeDescriptor att : zones.getSchema().getAttributeDescriptors()) { tb.minOccurs(att.getMinOccurs()); tb.maxOccurs(att.getMaxOccurs()); tb.restrictions(att.getType().getRestrictions()); if (att instanceof GeometryDescriptor) { GeometryDescriptor gatt = (GeometryDescriptor) att; tb.crs(gatt.getCoordinateReferenceSystem()); } tb.add("z_" + att.getLocalName(), att.getType().getBinding()); } tb.add("count", Long.class); tb.add("min", Double.class); tb.add("max", Double.class); tb.add("sum", Double.class); tb.add("avg", Double.class); tb.add("stddev", Double.class); tb.setName(zones.getSchema().getName()); targetSchema = tb.buildFeatureType(); }
public void testCRS() { builder.setName("testName"); builder.setNamespaceURI("testNamespaceURI"); builder.setCRS(DefaultGeographicCRS.WGS84); builder.crs(null).add("point", Point.class); builder.add("point2", Point.class, DefaultGeographicCRS.WGS84); builder.setDefaultGeometry("point"); SimpleFeatureType type = builder.buildFeatureType(); assertEquals(DefaultGeographicCRS.WGS84, type.getCoordinateReferenceSystem()); assertNull(type.getGeometryDescriptor().getType().getCoordinateReferenceSystem()); assertEquals( DefaultGeographicCRS.WGS84, ((GeometryType) type.getType("point2")).getCoordinateReferenceSystem()); }
tb.crs(crs);
if (att instanceof GeometryDescriptor) { GeometryDescriptor gatt = (GeometryDescriptor) att; tb.crs(gatt.getCoordinateReferenceSystem());
if (crs != null) { try { sftb.crs(CRS.decode(crs, true)); } catch (FactoryException e) { log.warn("Unable to decode CRS [" + crs + "] for attribute [" + name + "]", e);
Object data = geom.getUserData(); if( data instanceof CoordinateReferenceSystem ){ builder.descriptor(att).crs((CoordinateReferenceSystem)data).add( att.getLocalName(), att.getType().getBinding()); }else if( data instanceof String){ String string=(String) data; crs=null; builder.descriptor(att).crs((CoordinateReferenceSystem)data).add( att.getLocalName(), att.getType().getBinding());
/** * Sets all the attribute specific state from a single descriptor. * <p> * This method is convenience for: * <code> * builder.minOccurs( descriptor.getMinOccurs() ).maxOccurs( descriptor.getMaxOccurs() ) * .nillable( descriptor.isNillable() )... * </code> * </p> */ public SimpleFeatureTypeBuilder descriptor( AttributeDescriptor descriptor ) { minOccurs( descriptor.getMinOccurs() ); maxOccurs( descriptor.getMaxOccurs() ); nillable( descriptor.isNillable() ); //namespaceURI( descriptor.getName().getNamespaceURI() ); defaultValue( descriptor.getDefaultValue() ); if ( descriptor instanceof GeometryDescriptor ) { crs( ( (GeometryDescriptor) descriptor).getCoordinateReferenceSystem() ); } return this; }
crs = origional.getCoordinateReferenceSystem(); build.crs(crs); build.add(name, binding);
tb.crs( crs );
public RasterZonalStatisticsCollection(GridCoverage2D coverage, int band, SimpleFeatureCollection zones, GridCoverage2D classification) { super(zones); this.coverage = coverage; this.band = band; this.classification = classification; SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); for (AttributeDescriptor att : zones.getSchema().getAttributeDescriptors()) { tb.minOccurs(att.getMinOccurs()); tb.maxOccurs(att.getMaxOccurs()); tb.restrictions(att.getType().getRestrictions()); if (att instanceof GeometryDescriptor) { GeometryDescriptor gatt = (GeometryDescriptor) att; tb.crs(gatt.getCoordinateReferenceSystem()); } tb.add("z_" + att.getLocalName(), att.getType().getBinding()); } if(classification != null) { tb.add("classification", Integer.class); } tb.add("count", Long.class); tb.add("min", Double.class); tb.add("max", Double.class); tb.add("sum", Double.class); tb.add("avg", Double.class); tb.add("stddev", Double.class); tb.setName(zones.getSchema().getName()); targetSchema = tb.buildFeatureType(); }
public ZonalStatisticsCollection(SimpleFeatureCollection data, String dataAttribute, SimpleFeatureCollection zones) { super(zones); this.dataAttribute = dataAttribute; this.data = data; SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); for (AttributeDescriptor att : zones.getSchema().getAttributeDescriptors()) { tb.minOccurs(att.getMinOccurs()); tb.maxOccurs(att.getMaxOccurs()); tb.restrictions(att.getType().getRestrictions()); if (att instanceof GeometryDescriptor) { GeometryDescriptor gatt = (GeometryDescriptor) att; tb.crs(gatt.getCoordinateReferenceSystem()); } tb.add("z_" + att.getLocalName(), att.getType().getBinding()); } AttributeDescriptor dataDescriptor = data.getSchema().getDescriptor(dataAttribute); tb.add("count", Long.class); tb.add("min", Double.class); tb.add("max", Double.class); tb.add("sum", Double.class); tb.add("avg", Double.class); tb.add("stddev", Double.class); tb.setName(zones.getSchema().getName()); targetSchema = tb.buildFeatureType(); }