Package org.opengis.feature.type

Examples of org.opengis.feature.type.AttributeDescriptor


     */
    private static Filter createBBoxFilter(SimpleFeatureType schema,
            Envelope bbox) throws IllegalFilterException {
        List filters = new ArrayList();
        for (int j = 0; j < schema.getAttributeCount(); j++) {
            AttributeDescriptor attType = schema.getDescriptor(j);

            if (attType instanceof GeometryDescriptor) {
                Filter gfilter = filterFactory.bbox(attType.getLocalName(),
                        bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox
                                .getMaxY(), null);
                filters.add(gfilter);
            }
        }
View Full Code Here


    SimpleFeature reproject(SimpleFeature feature) throws IOException {
        Object[] attributes = new Object[schema.getAttributeCount()];

        for (int i = 0; i < attributes.length; i++) {
            AttributeDescriptor type = schema.getDescriptor(i);
            Object object = feature.getAttribute(type.getName());

            if (object instanceof Geometry) {
                // check for crs
                Geometry geometry = (Geometry) object;
                CoordinateReferenceSystem crs = (CoordinateReferenceSystem) geometry.getUserData();
View Full Code Here

    private Filter createBBoxFilters(SimpleFeatureType schema, String[] attributes, Envelope bbox)
        throws IllegalFilterException {
        List filters = new ArrayList();
        final int length = attributes.length;
        for (int j = 0; j < length; j++) {
            AttributeDescriptor ad = schema.getDescriptor(attributes[j]);

            //DJB: added this for better error messages!
            if (ad == null) {
                if (LOGGER.isLoggable(Level.FINE)) {
                    LOGGER.fine(new StringBuffer("Could not find '").append(attributes[j])
                                                                    .append("' in the FeatureType (")
                                                                    .append(schema.getTypeName())
                                                                    .append(")").toString());
                }

                throw new IllegalFilterException(new StringBuffer("Could not find '").append(attributes[j]
                        + "' in the FeatureType (").append(schema.getTypeName()).append(")")
                                                                                     .toString());
            }

            if (ad instanceof GeometryDescriptor) {
                Filter gfilter = filterFactory.bbox(ad.getLocalName(), bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), null);
                filters.add(gfilter);
            }
        }

        if(filters.size() == 0)
View Full Code Here

        if (attribute == null)
            throw new WmsException(
                    "Regionating attribute has not been specified");

        // Make sure the attribute is actually there
        AttributeDescriptor ad = ft.getDescriptor(attribute);
        if (ad == null) {
            throw new WmsException("Could not find regionating attribute "
                    + attribute + " in layer " + featureType.getName());
        }

        // Make sure we know how to turn that attribute into a H2 type
        h2Type = getH2DataType(ad);
        if (h2Type == null)
            throw new WmsException("Attribute type " + ad.getType()
                    + " is not " + "supported for external sorting on "
                    + featureType.getName() + "#" + attribute);
    }
View Full Code Here

            // TODO: or shall we encode only the types that are well known in SchemaData
            // and jump over the rest? Besides, how does one limit the number of attributes
            // displayed? a PROPERTY=x,y,z like in GetFeature would be beneficial
            // to GetFeatureInfo as well
            for (int i = 0; i < schema.getAttributeCount(); i++) {
                AttributeDescriptor at = schema.getDescriptor(i);
                if (at instanceof GeometryDescriptor)
                    continue;

                final String[] atAttributes = new String[] { "type", getType(at), "name",
                        at.getLocalName() };
                start("SimpleField", KMLUtils.attributes(atAttributes));
                element("displayName", at.getLocalName());
                end("SimpleField");
            }

            end("Schema");
        }
View Full Code Here

            start("SchemaData", KMLUtils.attributes(new String[] { "schemaUrl", "#" + schemaId }));

            final int count = feature.getAttributeCount();
            final SimpleFeatureType schema = feature.getFeatureType();
            for (int i = 0; i < count; i++) {
                final AttributeDescriptor at = schema.getDescriptor(i);
                if(at instanceof GeometryDescriptor)
                    continue;
               
                final Attributes atts = KMLUtils.attributes(new String[] { "name",
                        at.getLocalName() });
                element("SimpleData", encodeValue(feature.getAttribute(i)), atts);
            }

            end("SchemaData");
            end("ExtendedData");
View Full Code Here

            start("ExtendedData", KMLUtils.attributes(new String[] { "schemaUrl", "#" + schemaId }));

            final int count = feature.getAttributeCount();
            final SimpleFeatureType schema = feature.getFeatureType();
            for (int i = 0; i < count; i++) {
                final AttributeDescriptor at = schema.getDescriptor(i);
                if(at instanceof GeometryDescriptor)
                    continue;
               
                final Attributes atts = KMLUtils.attributes(new String[] { "name",
                        at.getLocalName() });
                element("Data", encodeValue(feature.getAttribute(i)), atts);
            }

            end("ExtendedData");
        }
View Full Code Here

          
        //write out the header
        SimpleFeatureType ft = fc.getSchema();
        w.write("FID,");
        for ( int i = 0; i < ft.getAttributeCount(); i++ ) {
            AttributeDescriptor ad = ft.getDescriptor( i );
            w.write( prepCSVField(ad.getLocalName()) );
              
            if ( i < ft.getAttributeCount()-1 ) {
               w.write( "," );
            }
        }
View Full Code Here

                            for ( PropertyDescriptor pd : ft.getDescriptors() ) {
                                if ( !( pd instanceof AttributeDescriptor ) ) {
                                    continue;
                                }
                               
                                AttributeDescriptor ad = (AttributeDescriptor) pd;
                                ad = handleDescriptor(ad, info);
                                tb.add( ad );
                            }
                        }
                        else {
                            //only load native attributes configured
                            for ( AttributeTypeInfo att : info.getAttributes() ) {
                                String attName = att.getName();
                               
                                //load the actual underlying attribute type
                                PropertyDescriptor pd = ft.getDescriptor( attName );
                                if ( pd == null || !( pd instanceof AttributeDescriptor) ) {
                                    throw new IOException("the SimpleFeatureType " + info.getPrefixedName()
                                            + " does not contains the configured attribute " + attName
                                            + ". Check your schema configuration");
                                }
                           
                                AttributeDescriptor ad = (AttributeDescriptor) pd;
                                ad = handleDescriptor(ad, info);
                                tb.add( (AttributeDescriptor) ad );
                            }
                        }
                        ft = tb.buildFeatureType();
View Full Code Here

   
        FeatureType featureType = getFeatureType( ftInfo );
        if ( featureType != null ) {
            for ( PropertyDescriptor pd : featureType.getDescriptors() ) {
                if (pd instanceof AttributeDescriptor) {
                    AttributeDescriptor ad = (AttributeDescriptor) pd;
                    if (atInfo.getName().equals(ad.getLocalName())) {
                        return ad;
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.opengis.feature.type.AttributeDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.