Package org.geotools.feature

Examples of org.geotools.feature.FeatureType


    }

    FeatureType getSchema(String dataStoreID, String typeName)
        throws IOException {
        DataStore dataStore = aquireDataStore(dataStoreID);
        FeatureType type;

        return dataStore.getSchema(typeName);
    }
View Full Code Here


                       //the very least be present right after creation.
                       if (schemaFile != null &&
                            schemaFile.exists() && schemaFile.canRead()) {
                           generatedType = writeFile(schemaFile);
                       } else {
                           FeatureType ft2 = meta.getFeatureType();
                           String gType2 = generateFromSchema(ft2);

                            if ((gType2 != null) && (gType2 != "")) {
                                generatedType = gType2;
                            }
View Full Code Here

    public void writeFeatures(FeatureCollection features, Style style)
    throws IOException, AbortedException {
        Feature ft;
       
        try {
            FeatureType featureType = features.getSchema();
            Class gtype = featureType.getDefaultGeometry().getType();
           
            setUpWriterHandler(featureType);
            startFolder(null, null);
            FeatureTypeStyle[] fts = style.getFeatureTypeStyles();
            processStylers(features, fts);
            endFolder();
           
            LOGGER.fine("encoded " + featureType.getTypeName());
        } catch (NoSuchElementException ex) {
            throw new DataSourceException(ex.getMessage(), ex);
        } catch (IllegalAttributeException ex) {
            throw new DataSourceException(ex.getMessage(), ex);
        }
View Full Code Here

        FilterFactory fFac = FilterFactory.createFilterFactory();
        for (int i = 0; i < nLayers; i++) {
            MapLayer layer = layers[i];
            FeatureReader featureReader = null;
            FeatureSource fSource = layer.getFeatureSource();
            FeatureType schema = fSource.getSchema();
            try {
                Expression bboxExpression = fFac.createBBoxExpression(mapContext
                        .getAreaOfInterest());
                GeometryFilter bboxFilter = fFac.createGeometryFilter(FilterType.GEOMETRY_INTERSECTS);
                bboxFilter.addLeftGeometry(bboxExpression);
                bboxFilter.addRightGeometry(fFac.createAttributeExpression(
                        schema, schema.getDefaultGeometry().getName()));
               
                Query bboxQuery = new DefaultQuery(schema.getTypeName(),
                        bboxFilter);
               
                featureReader = fSource.getFeatures(bboxQuery).reader();
                FeatureCollection fc = fSource.getFeatures(bboxQuery);
                writer.writeFeatures(fc, layer.getStyle());
View Full Code Here

                try {
                    InsertRequest insert = (InsertRequest) element;
                    FeatureCollection collection = insert.getFeatures();

                    FeatureReader reader = DataUtilities.reader(collection);
                    FeatureType schema = store.getSchema();

                    // Need to use the namespace here for the lookup, due to our weird
                    // prefixed internal typenames.  see
                    //   http://jira.codehaus.org/secure/ViewIssue.jspa?key=GEOS-143
                   
View Full Code Here

            // Check attributes configured correctly against schema
            String typeName = featureTypeDTO.getName();

            try {
                DataStore dataStore = dataStoreInfo.getDataStore();
                FeatureType featureType = dataStore.getSchema(typeName);

                Set attributeNames = new HashSet();
                Set ATTRIBUTENames = new HashSet();

                //as far as I can tell an emtpy list indicates that no
                //schema.xml file was found.  I may be approaching this
                //all wrong, is this logic contained elsewhere?
                //CH: Yeah, this shit was super messed up.  It was causing null pointer
                //exceptions, and then it created this createAttrDTO flag that wasn't
                //then used by anyone.  So I fixed the null and made it so it creates
                //AttributeTypeInfoDTO's (once again, I hate these) from the FeatureType
                //of the real datastore.
                //boolean createAttrDTO = (featureTypeDTO.getSchemaAttributes().size() == 0);
                LOGGER.fine("loading datastore " + typeName);

                boolean createAttrDTO;

                if (featureTypeDTO.getSchemaAttributes() == null) {
                    createAttrDTO = true;
                } else {
                    createAttrDTO = featureTypeDTO.getSchemaAttributes().size() == 0;
                }

                if (createAttrDTO) {
                    List attributeDTOs = createAttrDTOsFromSchema(featureType);
                    featureTypeDTO.setSchemaAttributes(attributeDTOs);
                    LOGGER.finer(
                        "No schema found, setting featureTypeDTO with "
                        + attributeDTOs);
                } else {
                    for (int index = 0;
                            index < featureType.getAttributeCount(); index++) {
                        AttributeType attrib = featureType.getAttributeType(index);
                        attributeNames.add(attrib.getName());
                        ATTRIBUTENames.add(attrib.getName().toUpperCase());
                    }

                    if (featureTypeDTO.getSchemaAttributes() != null) {
View Full Code Here

        FeatureReader reader = null;
        try {
            for (int i = 0; i < results.size(); i++) {
                FeatureResults fr = (FeatureResults) results.get(i);
                FeatureType schema = fr.getSchema();

                writer.println("<table border='1'>");
                writer.println("<tr><th colspan=" + schema.getAttributeCount()
                    + " scope='col'>" + schema.getTypeName() + " </th></tr>");
                writer.println("<tr>");

                for (int j = 0; j < schema.getAttributeCount(); j++) {
                    writer.println("<td>"
                        + schema.getAttributeType(j).getName() + "</td>");
                }

                writer.println("</tr>");

                //writer.println("Found " + fr.getCount() + " in " + schema.getTypeName());
                reader = fr.reader();

                while (reader.hasNext()) {
                    Feature f = reader.next();
                    AttributeType[] types = schema.getAttributeTypes();
                    writer.println("<tr>");

                    for (int j = 0; j < types.length; j++) {
                        if (Geometry.class.isAssignableFrom(types[j].getType())) {
                            writer.println("<td>");
View Full Code Here

                while (reader.hasNext())
                {
                    Feature f = reader.next();

                    FeatureType schema = f.getFeatureType();
                    AttributeType[] types = schema.getAttributeTypes();

                    if (featuresPrinted<maxfeatures)
          {
                      writer.println("--------------------------------------------");
                      for (int j = 0; j < types.length; j++) //for each column in the featuretype
View Full Code Here

          + "\"");
    }

    String layer = getValue("LAYER");
    FeatureTypeInfo fti;
    FeatureType ft;

    try {
      WMS wms = request.getWMS();
      Data catalog = wms.getData();
      fti = catalog.getFeatureTypeInfo(layer);
View Full Code Here

            List atts = readFlat(rawAtts, ",");
            byFeatureTypes.set(i, atts);

            //FeatureType schema = layers[i].getSchema();
            try {
                FeatureType schema = layers[i].getFeatureType();

                //verify that propper attributes has been requested
                for (Iterator attIt = atts.iterator(); attIt.hasNext();) {
                    String attName = (String) attIt.next();

                    if (attName.length() > 0) {
                        LOGGER.finer("checking that " + attName + " is valid");

                        if ("#FID".equalsIgnoreCase(attName)
                                || "#BOUNDS".equalsIgnoreCase(attName)) {
                            LOGGER.finer("special attribute name requested: "
                                + attName);

                            continue;
                        }

                        if (schema.getAttributeType(attName) == null) {
                            throw new WmsException("Attribute '" + attName
                                + "' requested for layer "
                                + schema.getTypeName() + " does not exists");
                        }
                    } else {
                        LOGGER.finest(
                            "removing empty attribute name from request");
                        attIt.remove();
                    }
                }

                LOGGER.finest("attributes requested for "
                    + schema.getTypeName() + " checked: " + rawAtts);
            } catch (java.io.IOException e) {
                throw new WmsException(e);
            }
        }
View Full Code Here

TOP

Related Classes of org.geotools.feature.FeatureType

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.