Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureCollection


     * @param request
     * @return
     */
    private GetFeatureType toGetFeatureType(FeatureCollectionType featureCollection,
            GetLogType request) {
        SimpleFeatureCollection features = (SimpleFeatureCollection) featureCollection.getFeature().get(0);
        SimpleFeatureType featureType = features.getSchema();
        GetFeatureType ftRequest = WfsFactory.eINSTANCE.createGetFeatureType();
        QueryType query = WfsFactory.eINSTANCE.createQueryType();
        query.setTypeName(Collections.singletonList(featureType.getTypeName()));
        ftRequest.getQuery().add(query);
        ftRequest.setBaseUrl(request.getBaseUrl());
View Full Code Here


    }

    public void write(Object value, OutputStream output, Operation operation)
        throws IOException, ServiceException {
        FeatureCollectionType fct = (FeatureCollectionType) value;
        SimpleFeatureCollection fc = (SimpleFeatureCollection) fct.getFeature().get(0);

        // setup template subsystem
        GeoServerTemplateLoader templateLoader = new GeoServerTemplateLoader(getClass());
        templateLoader.setFeatureType(fc.getSchema());

        Template template = null;

        synchronized (templateConfig) {
            templateConfig.setTemplateLoader(templateLoader);
View Full Code Here

        // round up the info objects for each feature collection
        HashMap /* <String,Set> */ns2metas = new HashMap();

        for (Iterator fc = featureCollections.iterator(); fc.hasNext();) {
            SimpleFeatureCollection features = (SimpleFeatureCollection) fc.next();
            SimpleFeatureType featureType = features.getSchema();

            // load the metadata for the feature type
            String namespaceURI = featureType.getName().getNamespaceURI();
            FeatureTypeInfo meta = catalog.getFeatureTypeByName(namespaceURI, featureType.getTypeName() );

View Full Code Here

        final EObject originatingTransactionRequest = (EObject) source;

        Assert.notNull(originatingTransactionRequest);

        final TransactionEventType type = event.getType();
        final SimpleFeatureCollection affectedFeatures = event.getAffectedFeatures();

        if (isIgnorablePostEvent(originatingTransactionRequest, type)) {
            // if its a post event and there's no corresponding pre event bbox no need to
            // proceed(Saves some cpu cycles and a catalog lookup for findAffectedCachedLayers).
            return;
        }

        final Set<String> affectedLayers = findAffectedCachedLayers(event);
        if (affectedLayers.isEmpty()) {
            // event didn't touch a cached layer
            return;
        }

        if (PRE_INSERT == type || PRE_UPDATE == type || PRE_DELETE == type) {
            ReferencedEnvelope preBounds = affectedFeatures.getBounds();

            this.affectedLayers.put(originatingTransactionRequest, affectedLayers);
            this.affectedBounds.put(originatingTransactionRequest, preBounds);

        } else if (POST_UPDATE == type && affectedFeatures != null) {

            final ReferencedEnvelope bounds = affectedBounds.get(originatingTransactionRequest);

            // only truncate if the request didn't fail
            ReferencedEnvelope postBounds = affectedFeatures.getBounds();
            Assert.isTrue(bounds.getCoordinateReferenceSystem().equals(
                    postBounds.getCoordinateReferenceSystem()));
            bounds.expandToInclude(postBounds);

        } else {
View Full Code Here

    private static final SimpleFeatureType contourSchema = makeContourSchema();

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getGeoJsonIsochrone() throws Exception {
        SimpleFeatureCollection contourFeatures = makeContourFeatures(computeIsochrone());
        StringWriter writer = new StringWriter();
        FeatureJSON fj = new FeatureJSON();
        fj.writeFeatureCollection(contourFeatures, writer);
        CacheControl cc = new CacheControl();
        cc.setMaxAge(3600);
View Full Code Here

    @GET
    @Produces("application/x-zip-compressed")
    public Response getZippedShapefileIsochrone(@QueryParam("shpName") String shpName,
            @QueryParam("stream") @DefaultValue("true") boolean stream) throws Exception {
        SimpleFeatureCollection contourFeatures = makeContourFeatures(computeIsochrone());
        /* Output the staged features to Shapefile */
        final File shapeDir = Files.createTempDir();
        File shapeFile = new File(shapeDir, shpName + ".shp");
        LOG.debug("writing out shapefile {}", shapeFile);
        ShapefileDataStore outStore = new ShapefileDataStore(shapeFile.toURI().toURL());
View Full Code Here

        CoordinateReferenceSystem WGS84 = CRS.decode("EPSG:4326", true);
       
        Query query = new Query();
        query.setCoordinateSystem(sourceCRS);
        query.setCoordinateSystemReproject(WGS84);
        SimpleFeatureCollection featureCollection = featureSource.getFeatures(query);
       
        SimpleFeatureIterator it = featureCollection.features();
       
        PointSet ret = new PointSet(featureCollection.size());
        int i=0;
        while (it.hasNext()) {
            SimpleFeature feature = it.next();
            Geometry geom = (Geometry) feature.getDefaultGeometry();
           
View Full Code Here

    /** @return Evenly spaced travel time contours (isochrones) as GeoJSON. */
    @GET @Produces("application/json")
    public Response geoJsonGet() throws Exception {
        /* QGIS seems to want multi-features rather than multi-geometries. */
        SimpleFeatureCollection contourFeatures = makeContourFeatures();
        /* Output the staged features to JSON */
        StringWriter writer = new StringWriter();
        FeatureJSON fj = new FeatureJSON();
        fj.writeFeatureCollection(contourFeatures, writer);
        return Response.ok().entity(writer.toString()).build();
View Full Code Here

    /** @return Evenly spaced travel time contours (isochrones) as a zipped shapefile. */
    @GET @Produces("application/x-zip-compressed")
    public Response zippedShapefileGet(
            @QueryParam("stream") @DefaultValue("true") boolean stream)
            throws Exception {
        SimpleFeatureCollection contourFeatures = makeContourFeatures();
        /* Output the staged features to Shapefile */
        final File shapeDir = Files.createTempDir();
        File shapeFile = new File(shapeDir, shpName + ".shp");
        LOG.debug("writing out shapefile {}", shapeFile);
        ShapefileDataStore outStore = new ShapefileDataStore(shapeFile.toURI().toURL());
View Full Code Here

            CoordinateReferenceSystem WGS84 = CRS.decode("EPSG:4326", true);

            Query query = new Query();
            query.setCoordinateSystem(sourceCRS);
            query.setCoordinateSystemReproject(WGS84);
            SimpleFeatureCollection featureCollection = featureSource.getFeatures(query);

            SimpleFeatureIterator it = featureCollection.features();
            int i = 0;
            while (it.hasNext()) {
                SimpleFeature feature = it.next();
                Geometry geom = (Geometry) feature.getDefaultGeometry();
                Point point = null;
View Full Code Here

TOP

Related Classes of org.geotools.data.simple.SimpleFeatureCollection

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.