/** * Sets the crs of the next attribute added to the feature type. * * <p>This only applies if the attribute added is geometric. Example: <code> * builder.crs( DefaultGeographicCRS.WGS84 ).add( "geom", Polygon.class )</code> * * <p>This value is reset after a call to {@link #add(String, Class)} */ public SimpleFeatureTypeBuilder crs(CoordinateReferenceSystem crs) { attributeBuilder.setCRS(crs); return this; }
public AttributeTypeBuilder crs(CoordinateReferenceSystem crs) { setCRS(crs); return this; }
b.setCRS(getCRS(info.getSRS())); ad = b.buildDescriptor(old.getLocalName());
/** * Adds a new geometric attribute w/ provided name, class, and coordinate reference system. * * <p>The <tt>crs</tt> parameter may be <code>null</code>. * * @param name The name of the attribute. * @param binding The class that the attribute is bound to. * @param crs The crs of of the geometry, may be <code>null</code>. */ public void add(String name, Class<?> binding, CoordinateReferenceSystem crs) { attributeBuilder.setBinding(binding); attributeBuilder.setName(name); attributeBuilder.setCRS(crs); GeometryType type = attributeBuilder.buildGeometryType(); GeometryDescriptor descriptor = attributeBuilder.buildDescriptor(name, type); attributes().add(descriptor); }
+ " with null CoordinateReferenceSystem - did you mean to setCRS?"); attributeBuilder.setCRS(defaultCrs);
ab.setName(name); if (computedCRS != null) { ab.setCRS(computedCRS);
+ " was added as a geoemtry"); attributeBuilder.init(att); attributeBuilder.setCRS(defaultCrs); GeometryType type = attributeBuilder.buildGeometryType();
b.setCRS(metadata);
public AttributeTypeBuilder crs(CoordinateReferenceSystem crs) { setCRS(crs); return this; }
/** * Sets the crs of the next attribute added to the feature type. * <p> * This only applies if the attribute added is geometric. * </p> * Example: <code> builder.crs( DefaultGeographicCRS.WGS84 ).add( "geom", Polygon.class )</code> * <p> * This value is reset after a call to {@link #add(String, Class)} * </p> */ public SimpleFeatureTypeBuilder crs(CoordinateReferenceSystem crs) { attributeBuilder.setCRS(crs); return this; }
/** * Create a SimpleFeatureType with the same content; just updating the geometry attribute to * match the provided coordinate reference system. * * @param original SimpleFeatureType * @param crs CoordinateReferenceSystem of result * @return SimpleFeatureType updated with the provided CoordinateReferenceSystem */ public static SimpleFeatureType retype( SimpleFeatureType original, CoordinateReferenceSystem crs) { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); // initialize the builder b.init(original); // clear the attributes b.attributes().clear(); // add attributes in order for (AttributeDescriptor descriptor : original.getAttributeDescriptors()) { if (descriptor instanceof GeometryDescriptor) { GeometryDescriptor geometryDescriptor = (GeometryDescriptor) descriptor; AttributeTypeBuilder adjust = new AttributeTypeBuilder(b.factory); adjust.init(geometryDescriptor); adjust.setCRS(crs); b.add(adjust.buildDescriptor(geometryDescriptor.getLocalName())); continue; } b.add(descriptor); } return b.buildFeatureType(); }
build.setName(Classes.getShortName(geometryClass)); build.setNillable(true); build.setCRS(crs); build.setBinding(geometryClass);
AttributeTypeBuilder ab = new AttributeTypeBuilder(); ab.init(types[i]); ab.setCRS(override); types[i] = ab.buildDescriptor(types[i].getLocalName(), ab.buildGeometryType());
builder.setMaxOccurs(descriptor.getMaxOccurs()); builder.setDefaultValue(descriptor.getDefaultValue()); builder.setCRS(schema.getCoordinateReferenceSystem()); AttributeDescriptor intersectionDescriptor = builder.buildDescriptor(
ab.setCRS(crs); if (srid != null) { ab.addUserData(JDBCDataStore.JDBC_NATIVE_SRID, srid);
static AttributeDescriptor getIntersectionType( SimpleFeatureCollection first, SimpleFeatureCollection second) { Class firstGeomType = first.getSchema().getGeometryDescriptor().getType().getBinding(); Class secondGeomType = second.getSchema().getGeometryDescriptor().getType().getBinding(); // figure out the output geometry type Class binding; if (isGeometryTypeIn(secondGeomType, Point.class)) { binding = Point.class; } else if (isGeometryTypeIn(secondGeomType, MultiPoint.class)) { binding = MultiPoint.class; } else if (isGeometryTypeIn(secondGeomType, LineString.class, MultiLineString.class)) { binding = MultiLineString.class; } else if (isGeometryTypeIn(secondGeomType, Polygon.class, MultiPolygon.class)) { if (isGeometryTypeIn(firstGeomType, Polygon.class, MultiPolygon.class)) { binding = MultiPolygon.class; } else { binding = MultiLineString.class; } } else { // we can't be more precise than this binding = Geometry.class; } AttributeTypeBuilder builder = new AttributeTypeBuilder(); builder.setName("the_geom"); builder.setBinding(binding); builder.setCRS(first.features().next().getFeatureType().getCoordinateReferenceSystem()); AttributeDescriptor descriptor = builder.buildDescriptor("the_geom"); return descriptor; }
/** * Adds a new geometric attribute w/ provided name, class, and coordinate * reference system. * <p> * The <tt>crs</tt> parameter may be <code>null</code>. * </p> * @param name The name of the attribute. * @param binding The class that the attribute is bound to. * @param crs The crs of of the geometry, may be <code>null</code>. */ public void add(String name, Class<?> binding, CoordinateReferenceSystem crs ) { attributeBuilder.setBinding(binding); attributeBuilder.setName(name); attributeBuilder.setCRS(crs); GeometryType type = attributeBuilder.buildGeometryType(); GeometryDescriptor descriptor = attributeBuilder.buildDescriptor(name,type); attributes().add(descriptor); }
builder.setMaxOccurs(descriptor.getMaxOccurs()); builder.setDefaultValue(descriptor.getDefaultValue()); builder.setCRS( this.delegate .features()
@Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder featureBuilder = createBuilder(csvFileState); // For WKT strategy, we need to make sure the wktField is recognized as a Geometry AttributeDescriptor descriptor = featureBuilder.get(wktField); if (descriptor != null) { AttributeTypeBuilder attributeBuilder = new AttributeTypeBuilder(); attributeBuilder.init(descriptor); attributeBuilder.setCRS(DefaultGeographicCRS.WGS84); attributeBuilder.binding(Geometry.class); AttributeDescriptor modified = attributeBuilder.buildDescriptor(wktField); featureBuilder.set(modified); } return featureBuilder.buildFeatureType(); } // docs end buildFeatureType