@Override public boolean equals(Object other) { if (!(other instanceof GeometryType)) { return false; } if (!super.equals(other)) { return false; } GeometryType o = (GeometryType) other; if (CRS == null) { return o.getCoordinateReferenceSystem() == null; } if (o.getCoordinateReferenceSystem() == null) { return false; } return org.geotools.referencing.CRS.equalsIgnoreMetadata( CRS, o.getCoordinateReferenceSystem()); } }
public CoordinateReferenceSystem getCoordinateReferenceSystem() { return ((GeometryType) getSubject()).getCoordinateReferenceSystem(); } }
public CoordinateReferenceSystem getCoordinateReferenceSystem() { return getType().getCoordinateReferenceSystem(); }
public CoordinateReferenceSystem getCoordinateReferenceSystem() { if (crs == null) { if (getGeometryDescriptor() != null && getGeometryDescriptor().getType().getCoordinateReferenceSystem() != null) { crs = defaultGeometry.getType().getCoordinateReferenceSystem(); } if (crs == null) { for (PropertyDescriptor property : getDescriptors()) { if (property instanceof GeometryDescriptor) { GeometryDescriptor geometry = (GeometryDescriptor) property; if (geometry.getType().getCoordinateReferenceSystem() != null) { crs = geometry.getType().getCoordinateReferenceSystem(); break; } } } } } return crs; }
/** * Finds the CRS of the specified attribute (or uses the default geometry instead) * * @param geomName * @param schema * @return */ org.opengis.referencing.crs.CoordinateReferenceSystem getAttributeCRS( PropertyName geomName, FeatureType schema) { if (geomName == null || "".equals(geomName.getPropertyName())) { GeometryDescriptor geom = schema.getGeometryDescriptor(); return geom.getType().getCoordinateReferenceSystem(); } else { GeometryDescriptor geom = (GeometryDescriptor) geomName.evaluate(schema); return geom.getType().getCoordinateReferenceSystem(); } }
public String toString() { StringBuffer sb = new StringBuffer(getClass().getSimpleName()).append(":"); sb.append(getDescriptor().getName().getLocalPart()); CoordinateReferenceSystem crs = getDescriptor().getType().getCoordinateReferenceSystem(); if (!getDescriptor() .getName()
/** * Returns the non null envelope of this attribute. If the attribute's geometry is <code>null * </code> the returned Envelope <code>isNull()</code> is true. * * @return */ public synchronized BoundingBox getBounds() { if (bounds == null) { ReferencedEnvelope bbox = new ReferencedEnvelope(getType().getCoordinateReferenceSystem()); Geometry geom = (Geometry) getValue(); if (geom != null) { bbox.expandToInclude(geom.getEnvelopeInternal()); } else { bbox.setToNull(); } bounds = bbox; } return bounds; }
.getGeometryDescriptor() .getType() .getCoordinateReferenceSystem(); } catch (NullPointerException e) {
AttributeType type = descriptor.getType(); if (type instanceof GeometryType) { coordinateReferenceSystem = ((GeometryType) type).getCoordinateReferenceSystem(); Map<Object, Object> userData = descriptor.getUserData(); if (userData != null && !userData.isEmpty()) {
/** * Remap the original featureType on top of the available definitions to create the Oracle * specific featureType */ private void remapFeatureType() { final SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); tb.setName(mappedName); final List<AttributeDescriptor> descriptors = wrappedFeatureType.getAttributeDescriptors(); // Loop over the attribute descriptors for (AttributeDescriptor descriptor : descriptors) { // Get main properties (name and type) Name name = descriptor.getName(); Definition definition = definitionsMapping.get(name); AttributeType type = descriptor.getType(); if (type instanceof GeometryType) { coordinateReferenceSystem = ((GeometryType) type).getCoordinateReferenceSystem(); tb.add( definition.getExpression().toString(), definition.getBinding(), coordinateReferenceSystem); } else { tb.add(definition.getExpression().toString(), definition.getBinding()); } } oracleFeatureType = tb.buildFeatureType(); }
((GeometryType) descriptor.getType()).getCoordinateReferenceSystem(); if (crs != null) {
((GeometryType) attType.getType()).getCoordinateReferenceSystem(); if (crs != null) {
public void add(final SimpleFeature feature) { Name name = feature.getFeatureType().getName(); QName typeName = getTypeName(); if (!new NameImpl(typeName).equals(name)) { throw new IllegalArgumentException( "Type name does not match. Expected " + new NameImpl(typeName) + ", but got " + name); } WFSStrategy strategy = getStrategy(); FeatureTypeInfo typeInfo = strategy.getFeatureTypeInfo(typeName); CoordinateReferenceSystem crs = typeInfo.getCRS(); for (Property property : feature.getProperties()) { if (!(property instanceof GeometryAttribute)) { continue; } CoordinateReferenceSystem attCrs = ((GeometryType) property.getType()).getCoordinateReferenceSystem(); if (!CRS.equalsIgnoreMetadata(crs, attCrs)) { throw new IllegalArgumentException( "Added Features shall match the native CRS: " + typeInfo.getDefaultSRS() + ". Got " + attCrs); } } added.add(feature); }
feature.getDefaultGeometryProperty() .getType() .getCoordinateReferenceSystem();
/** Initializes builder state from another attribute type. */ public AttributeTypeBuilder init(AttributeType type) { name = type.getName().getLocalPart(); separator = type.getName().getSeparator(); namespaceURI = type.getName().getNamespaceURI(); isAbstract = type.isAbstract(); if (type.getRestrictions() != null) { restrictions().addAll(type.getRestrictions()); } description = type.getDescription() != null ? type.getDescription().toString() : null; isIdentifiable = type.isIdentified(); binding = type.getBinding(); superType = type.getSuper(); if (type instanceof GeometryType) { crs = ((GeometryType) type).getCoordinateReferenceSystem(); } return this; }
&& originalAttributeType instanceof GeometryType) { GeometryType geometryType = (GeometryType) originalAttributeType; crs = geometryType.getCoordinateReferenceSystem(); } else { crs = origional.getCoordinateReferenceSystem();
GeometryType geometryType = (GeometryType) type; this.crs = geometryType.getCoordinateReferenceSystem();
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()); }
final GeometryDescriptor geometryAttribute = schema.getGeometryDescriptor(); if (geometryAttribute != null && geometryAttribute.getType() != null) { sourceCrs = geometryAttribute.getType().getCoordinateReferenceSystem(); } else { sourceCrs = null;
private MathTransform createTransform(GeometryType type) throws FactoryException { CoordinateReferenceSystem sourceCrs = type.getCoordinateReferenceSystem(); if(sourceCrs == null) { // if it's not WGS84, we'll soon find out as we check the geometry against the // country bounds sourceCrs = DefaultGeographicCRS.WGS84; } CoordinateReferenceSystem geoCRS = DefaultGeographicCRS.WGS84; boolean lenient = true; // allow for some error due to different datums return CRS.findMathTransform(sourceCrs, geoCRS, lenient); }