Examples of FeatureCollectionType


Examples of net.opengis.wfs.FeatureCollectionType

        final Catalog catalog = getCatalog();
        final GeoServerResourceLoader resourceLoader = getResourceLoader();

        ShapeZipOutputFormat zip = new ShapeZipOutputFormat(geoServer, catalog, resourceLoader);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        FeatureCollectionType fct = WfsFactory.eINSTANCE.createFeatureCollectionType();
        fct.getFeature().add(fs.getFeatures());

        // add the charset
        Map options = new HashMap();
        gft.setFormatOptions(options);
        zip.write(fct, bos, op);
View Full Code Here

Examples of net.opengis.wfs.FeatureCollectionType

     * output as a byte array
     */
    byte[] writeOut(FeatureCollection fc) throws IOException {
        ShapeZipOutputFormat zip = new ShapeZipOutputFormat();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        FeatureCollectionType fct = WfsFactory.eINSTANCE.createFeatureCollectionType();
        fct.getFeature().add(fc);
        zip.write(fct, bos, op);
        return bos.toByteArray();
    }
View Full Code Here

Examples of net.opengis.wfs.FeatureCollectionType

            results = execute(request);
        } finally {
            EnvFunction.clearLocalValues();
        }
       
        FeatureCollectionType ret = buildResults(results);

        return ret;
    }
View Full Code Here

Examples of net.opengis.wfs.FeatureCollectionType

    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    private FeatureCollectionType buildResults(List<FeatureCollection> results) {

        FeatureCollectionType result = WfsFactory.eINSTANCE.createFeatureCollectionType();
        result.setTimeStamp(Calendar.getInstance());
        result.getFeature().addAll(results);

        return result;
    }
View Full Code Here

Examples of net.opengis.wfs.FeatureCollectionType

       
        // build the request objects and feed the output format
        GetFeatureType gft = WfsFactory.eINSTANCE.createGetFeatureType();
        Operation op = new Operation("GetFeature", getServiceDescriptor10(), null, new Object[] {gft});
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        FeatureCollectionType fct = WfsFactory.eINSTANCE.createFeatureCollectionType();
        fct.getFeature().add(fs.getFeatures());
       
        // write out the results
        CSVOutputFormat format = new CSVOutputFormat(getGeoServer());
        format.write(fct, bos, op);
       
View Full Code Here

Examples of net.opengis.wfs.FeatureCollectionType

        if (EMFUtils.isUnset(queries, "typeName")) {
            String msg = "No feature types specified";
            throw new WFSException(msg);
        }

        FeatureCollectionType result = WfsFactory.eINSTANCE.createFeatureCollectionType();
        int residual = request.getMaxFeatures() != null ? request.getMaxFeatures().intValue() : Integer.MAX_VALUE;

        // for each difference query check the feature type is versioned, and
        // gather bounds
        try {
            for (int i = 0; i < queries.size() && residual > 0; i++) {
                DifferenceQueryType query = (DifferenceQueryType) queries.get(i);
                FeatureTypeInfo meta = featureTypeInfo((QName) query.getTypeName());
                FeatureSource<? extends FeatureType, ? extends Feature> source = meta.getFeatureSource(null,null);

                if (!(source instanceof VersioningFeatureSource)) {
                    throw new WFSException("Feature type" + query.getTypeName()
                        + " is not versioned");
                }

                Filter filter = (Filter) query.getFilter();

                //  make sure filters are sane
                if (filter != null) {
                    final FeatureType featureType = source.getSchema();
                    ExpressionVisitor visitor = new AbstractExpressionVisitor() {
                            public Object visit(PropertyName name, Object data) {
                                // case of multiple geometries being returned
                                if (name.evaluate(featureType) == null) {
                                    // we want to throw wfs exception, but cant
                                    throw new WFSException("Illegal property name: "
                                        + name.getPropertyName(), "InvalidParameterValue");
                                }

                                return name;
                            }
                            ;
                        };

                    filter.accept(new AbstractFilterVisitor(visitor), null);
                }

                // extract collection
                VersioningFeatureSource store = (VersioningFeatureSource) source;
                SimpleFeatureCollection logs = store.getLog(query
                        .getFromFeatureVersion(), query.getToFeatureVersion(), filter, null,
                        residual);
                residual -= logs.size();

                // TODO: handle logs reprojection in another CRS
                result.getFeature().add(logs);
            }
        } catch (IOException e) {
            throw new WFSException("Error occurred getting features", e, request.getHandle());
        }

        result.setNumberOfFeatures(BigInteger.valueOf(residual));
        result.setTimeStamp(Calendar.getInstance());

        return result;
    }
View Full Code Here

Examples of net.opengis.wfs.FeatureCollectionType

            GetFeatureKvpRequestReader reader = (GetFeatureKvpRequestReader) context
                    .getBean("getFeatureKvpReader");
            gft = (GetFeatureType) kvpParse(ref.getHref(), reader);
        }

        FeatureCollectionType featureCollectionType = wfs.getFeature(gft);
        // this will also deal with axis order issues
        return ((ComplexPPIO) ppio).decode(featureCollectionType);
    }
View Full Code Here

Examples of net.opengis.wfs.FeatureCollectionType

                + "    </wps:RawDataOutput>\n" + "  </wps:ResponseForm>\n" + "</wps:Execute>";

        MockHttpServletResponse response = postAsServletResponse(root(), xml);

        Parser p = new Parser(new WFSConfiguration());
        FeatureCollectionType fct = (FeatureCollectionType) p.parse(new ByteArrayInputStream(
                response.getOutputStreamContent().getBytes()));
        FeatureCollection fc = (FeatureCollection) fct.getFeature().get(0);

        assertEquals(36, fc.size());
       
        // get first feature
        SimpleFeature sf = (SimpleFeature) fc.features().next();
View Full Code Here

Examples of net.opengis.wfs.FeatureCollectionType

    public void write(Object value, OutputStream output, Operation operation)
        throws IOException, ServiceException {
        WFSInfo wfs = getInfo();
       
        FeatureCollectionType featureCollection = (FeatureCollectionType) value;

        //create a new feautre collcetion type with just the numbers
        FeatureCollectionType hits = WfsFactory.eINSTANCE.createFeatureCollectionType();
        if (GML3OutputFormat.isComplexFeature(featureCollection)) {
            // we have to count the number of features here manually because complex feature
            // collection size() now returns 0. In order to count the number of features,
            // we have to build the features to count them and this has great performance
            // impact. Unless we introduce joins in our fetching of
            // data, we will have to count the number of features manually when needed. In
            // GML3Outputformat I use xslt to populate numberOfFeatures attribute.
            hits.setNumberOfFeatures(countFeature(featureCollection));
        } else {
            hits.setNumberOfFeatures(featureCollection.getNumberOfFeatures());
        }
        hits.setTimeStamp(featureCollection.getTimeStamp());

        Encoder encoder = new Encoder(configuration, configuration.schema());
        encoder.setEncoding(Charset.forName( wfs.getGeoServer().getGlobal().getCharset()) );
        encoder.setSchemaLocation(org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
            ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd"));
View Full Code Here

Examples of net.opengis.wfs.FeatureCollectionType

     * @param lockId
     * @return
     */
    protected FeatureCollectionType buildResults(int count, List results,
            String lockId) {
        FeatureCollectionType result = WfsFactory.eINSTANCE.createFeatureCollectionType();
        result.setNumberOfFeatures(BigInteger.valueOf(count));
        result.setTimeStamp(Calendar.getInstance());
        result.setLockId(lockId);
        result.getFeature().addAll(results);
        return result;
    }
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.