Examples of DefaultQuery


Examples of org.geotools.data.DefaultQuery

       
        BBOX filter = ff.bbox(geom.getLocalName(), nativeEnv.getMinX(),
                nativeEnv.getMinY(), nativeEnv.getMaxX(), nativeEnv.getMaxY(), null);

        // build an optimized query (only the necessary attributes
        DefaultQuery q = new DefaultQuery();
        q.setFilter(filter);
        // TODO: enable this when JTS learns how to compute centroids
        // without triggering the
        // generation of Coordinate[] out of the sequences...
        // q.setHints(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY,
        // PackedCoordinateSequenceFactory.class));
        q.setPropertyNames(new String[] { geom.getLocalName() });

        // return the reader
        return fs.getFeatures(q).features();
    }
View Full Code Here

Examples of org.geotools.data.DefaultQuery

                filter = createBBoxFilters(schema, attributes, aoi);

                // now build the query using only the attributes and the bounding
                // box needed
                DefaultQuery q = new DefaultQuery(schema.getTypeName());
                q.setFilter(filter);
                q.setPropertyNames(attributes);

                // now, if a definition query has been established for this layer, be
                // sure to respect it by combining it with the bounding box one.
                Query definitionQuery = layer.getQuery();

                if (definitionQuery != Query.ALL) {
                    if (q == Query.ALL) {
                        q = (DefaultQuery) definitionQuery;
                    } else {
                        q = (DefaultQuery) DataUtilities.mixQueries(definitionQuery, q, "KMLEncoder");
                    }
                }

                q.setCoordinateSystem(layer.getFeatureSource().getSchema().getCoordinateReferenceSystem());

                FeatureCollection<SimpleFeatureType, SimpleFeature> fc = fSource.getFeatures(q);

                // decide wheter to render vector or raster based on kmscore
                int kmscore = mapContext.getRequest().getWMS().getKmScore();
View Full Code Here

Examples of org.geotools.data.DefaultQuery

            // build an optimized query, loading only the necessary attributes
            GeometryDescriptor geom = fs.getSchema()
                    .getGeometryDescriptor();
            CoordinateReferenceSystem nativeCrs = geom
                    .getCoordinateReferenceSystem();
            DefaultQuery q = new DefaultQuery();
           
            if (geom.getLocalName().equals(attribute)) {
                q.setPropertyNames(new String[] { geom.getLocalName() });
            } else {
                q.setPropertyNames(new String[] { attribute, geom.getLocalName() });
            }
           
            // setup the eventual transform
            MathTransform tx = null;
            double[] coords = new double[2];
View Full Code Here

Examples of org.geotools.data.DefaultQuery

        Element urlSet = new Element("urlset", SITEMAP);
        urlSet.addNamespaceDeclaration(GEOSITEMAP);
        d.setRootElement(urlSet);

        try {
            DefaultQuery q = new DefaultQuery();
            if (fti.getFeatureSource(null, null).getQueryCapabilities().isOffsetSupported()){
                // surely no one would use a shapefile for more than 50000 features, right?
                q.setStartIndex(1 + 50000 * (page - 1));
                q.setMaxFeatures(50000);
            }

            FeatureCollection col = fti.getFeatureSource(null, null).getFeatures(q);
           
            Iterator fi = col.iterator();
View Full Code Here

Examples of org.geotools.data.DefaultQuery

                + featureType.getMetadata().get("indexingEnabled"),
                Status.CLIENT_ERROR_FORBIDDEN
                );
        }

        DefaultQuery q = new DefaultQuery();
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

        q.setFilter(ff.id(Collections.singleton(ff.featureId(feature))));

        FeatureCollection col = null;
        try {
            col = featureType.getFeatureSource(null, null).getFeatures(q);
        } catch (IOException e) {
View Full Code Here

Examples of org.geotools.data.DefaultQuery

        }
    }

    public FeatureCollection<SimpleFeatureType, SimpleFeature> getVersionedFeatures(Filter filter)
            throws IOException {
        return getFeatures(new DefaultQuery(schema.getTypeName(), filter));
    }
View Full Code Here

Examples of org.geotools.data.DefaultQuery

    public void testFilter() throws Exception {
        // Set up a map context with a filtered layer
        WMSMapContext map = new WMSMapContext(createGetMapRequest(MockData.BUILDINGS));
        MapLayer layer = createMapLayer(MockData.BUILDINGS);
        Filter f = ff.equals(ff.property("ADDRESS"), ff.literal("215 Main Street"));
        layer.setQuery(new DefaultQuery(MockData.BUILDINGS.getLocalPart(), f));
        map.addLayer(layer);
       
        Document document = getRSSResponse(map, AtomGeoRSSTransformer.GeometryEncoding.LATLONG);
        NodeList items = document.getDocumentElement().getElementsByTagName("item");
        assertEquals(1, items.getLength());
View Full Code Here

Examples of org.geotools.data.DefaultQuery

        }
    }

    public FeatureCollection<SimpleFeatureType, SimpleFeature> getVersionedFeatures(Filter filter)
            throws IOException {
        return getFeatures(new DefaultQuery(schema.getTypeName(), filter));
    }
View Full Code Here

Examples of org.geotools.data.DefaultQuery

        }
    }

    public FeatureCollection<SimpleFeatureType, SimpleFeature> getVersionedFeatures(Filter filter)
            throws IOException {
        return getFeatures(new DefaultQuery(schema.getTypeName(), filter));
    }
View Full Code Here

Examples of org.geotools.data.DefaultQuery

        LOG.info("getFeatureReader #2 " + query.getClass().getName());
        if (!query.retrieveAllProperties()) {
            String[] props = new String[query.getPropertyNames().length + 1];
            System.arraycopy(query.getPropertyNames(), 0, props, 0, query.getPropertyNames().length);
            props[props.length - 1] = featureUniqueKey;
            query = new DefaultQuery(query.getTypeName(), query.getNamespace(), query.getFilter(), query.getMaxFeatures(), props, query.getHandle());
        }
        return new LineMergerFeatureReader(super.getFeatureReader(query, trans), featureUniqueKey);
        //return super.getFeatureReader(query, trans);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.