Package org.geotools.data

Examples of org.geotools.data.Query


   

    public FeatureCollection<SimpleFeatureType, SimpleFeature> getVersionedFeatures(Query query)
            throws IOException {
        final VersioningFeatureSource versioningSource = ((VersioningFeatureSource) source);
        Query newQuery = adaptQuery(query, versioningSource.getVersionedFeatures().getSchema());
       
        CoordinateReferenceSystem targetCRS = query.getCoordinateSystemReproject();
        try {
            //this is the raw "unprojected" feature collection
           
View Full Code Here


    }

    public FeatureCollection<SimpleFeatureType, SimpleFeature> getVersionedFeatures(Query query)
            throws IOException {
        final VersioningFeatureSource versioningSource = ((VersioningFeatureSource) source);
        Query newQuery = adaptQuery(query, versioningSource.getVersionedFeatures().getSchema());
       
        CoordinateReferenceSystem targetCRS = query.getCoordinateSystemReproject();
        try {
            //this is the raw "unprojected" feature collection
           
View Full Code Here

                            // int numberLocked =
                            // ((DEFQueryFeatureLocking)source).lockFeature(feature);
                            // HACK: Query.NO_NAMES isn't working in postgis
                            // right now,
                            // so we'll just use all.
                            Query query = new DefaultQuery(meta.getName(), (Filter) fidFilter,
                                    Query.DEFAULT_MAX, Query.ALL_NAMES, lock.getHandle());

                            numberLocked = ((FeatureLocking<SimpleFeatureType, SimpleFeature>) source)
                                    .lockFeatures(query);
View Full Code Here

                    } else {
                        postFilter = rulesFilters;
                    }

                    String typeName = schema.getName().getLocalPart();
                    Query q = new DefaultQuery(typeName, null, getFInfoFilter, request.getFeatureCount(), Query.ALL_NAMES, null);
                   
                    FeatureCollection<? extends FeatureType, ? extends Feature> match;
                    match = featureSource.getFeatures(q);
                   
                    // if we could not include the rules filter into the query, post process in memory
View Full Code Here

        if (ul.getInlineFeatureType().getCoordinateReferenceSystem() == null) {
            LOGGER
                    .warning("No CRS set on inline features default geometry.  Assuming the requestor has their inlinefeatures in the boundingbox CRS.");

            SimpleFeatureType currFt = ul.getInlineFeatureType();
            Query q = new DefaultQuery(currFt.getTypeName(), Filter.INCLUDE);
            FeatureReader<SimpleFeatureType, SimpleFeature> ilReader;
            DataStore inlineFeatureDatastore = ul.getInlineFeatureDatastore();
            ilReader = inlineFeatureDatastore.getFeatureReader(q, Transaction.AUTO_COMMIT);
            CoordinateReferenceSystem crs = (getMapRequest.getCrs() == null) ? DefaultGeographicCRS.WGS84
                    : getMapRequest.getCrs();
View Full Code Here

        FeatureLocking<SimpleFeatureType, SimpleFeature> fl2;
        fl2 = (FeatureLocking<SimpleFeatureType, SimpleFeature>) rts.getFeatureSource(RENAMED);
        fl.setFeatureLock(lock);
        fl2.setTransaction(new DefaultTransaction());

        Query q = new DefaultQuery(RENAMED, fidFilter);
        assertEquals(1, fl.lockFeatures(q));
        assertEquals(0, fl2.lockFeatures(q));

        fl.unLockFeatures(q);
        assertEquals(1, fl2.lockFeatures(q));
View Full Code Here

        if (ul.getInlineFeatureType().getCoordinateReferenceSystem() == null) {
            LOGGER.warning("No CRS set on inline features default geometry.  "
                    + "Assuming the requestor has their inlinefeatures in the boundingbox CRS.");

            SimpleFeatureType currFt = ul.getInlineFeatureType();
            Query q = new DefaultQuery(currFt.getTypeName(), Filter.INCLUDE);
            FeatureReader<SimpleFeatureType, SimpleFeature> ilReader;
            ilReader = inlineDatastore.getFeatureReader(q, Transaction.AUTO_COMMIT);
            ForceCoordinateSystemFeatureReader reader = new ForceCoordinateSystemFeatureReader(
                    ilReader, requestCrs);
            MemoryDataStore reTypedDS = new MemoryDataStore(reader);
View Full Code Here

     *
     * @see org.geotools.data.FeatureSource#getFeatures(org.geotools.data.Query)
     */
    public FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatures(Query query)
            throws IOException {
        Query reprojected = reprojectFilter(query);
        Query newQuery = adaptQuery(reprojected, schema);
       
        CoordinateReferenceSystem targetCRS = query.getCoordinateSystemReproject();
        try {
            //this is the raw "unprojected" feature collection
            FeatureCollection<SimpleFeatureType, SimpleFeature> fc = source.getFeatures(newQuery);
View Full Code Here

     */
    protected Query adaptQuery(Query query, SimpleFeatureType schema) throws IOException {
        // if needed, reproject the filter to the native srs
       
       
        Query newQuery = makeDefinitionQuery(query, schema);

//        // see if the CRS got xfered over
//        // a. old had a CRS, new doesnt
//        boolean requireXferCRS = (newQuery.getCoordinateSystem() == null)
//            && (query.getCoordinateSystem() != null);
//
//        if ((newQuery.getCoordinateSystem() != null) && (query.getCoordinateSystem() != null)) {
//            //b. both have CRS, but they're different
//            requireXferCRS = !(newQuery.getCoordinateSystem().equals(query.getCoordinateSystem()));
//        }
//
//        if (requireXferCRS) {
//            //carry along the CRS
//            if (!(newQuery instanceof DefaultQuery)) {
//                newQuery = new DefaultQuery(newQuery);
//            }
//
//            ((DefaultQuery) newQuery).setCoordinateSystem(query.getCoordinateSystem());
//        }
       
        //JD: this is a huge hack... but its the only way to ensure that we
        // we get what we ask for ... which is not reprojection, since
        // datastores are unreliable in this aspect we dont know if they will
        // reproject or not.
        // AA: added force coordinate system reset as well, since we cannot
        // trust GT2 datastores there neither.
        if ( newQuery.getCoordinateSystemReproject() != null ) {
            ((DefaultQuery)newQuery).setCoordinateSystemReproject(null);
        }
        if ( newQuery.getCoordinateSystem() != null ) {
            ((DefaultQuery)newQuery).setCoordinateSystem(null);
        }
        return newQuery;
    }
View Full Code Here

    public ReferencedEnvelope getBounds() throws IOException {
        // since CRS is at most forced, we don't need to change this code
        if (definitionQuery == Filter.INCLUDE) {
            return source.getBounds();
        } else {
            Query query = new DefaultQuery(getSchema().getTypeName(), definitionQuery);

            return source.getBounds(query);
        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.data.Query

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.