Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureSource


             
              // remove existing updload field mappings
              GisUploadField.delete("gisUpload = ?", gisUpload);
             
              FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile);
              SimpleFeatureSource featureSource = store.getFeatureSource();
             
              SimpleFeatureCollection featureCollection = featureSource.getFeatures();
              SimpleFeatureIterator featureIterator = featureCollection.features();
             
              List<AttributeDescriptor> attributeDescriptors = featureSource.getSchema().getAttributeDescriptors();
             
              // update field listing
              Long position = new Long(0);
             
              for(AttributeDescriptor attribute : attributeDescriptors)
              {
                GisUploadField field = new GisUploadField();
                field.fieldName = attribute.getName().toString();
                field.fieldType = attribute.getType().getName().getLocalPart();
                field.fieldPosition = position;
               
                field.gisUpload = gisUpload;
               
                field.save();
          
                position++;
              }
             
               
              CoordinateReferenceSystem dataCRS = featureSource.getSchema().getCoordinateReferenceSystem();
            
              String code = "EPSG:4326";
              CRSAuthorityFactory crsAuthorityFactory = CRS.getAuthorityFactory(true);
              CoordinateReferenceSystem mapCRS = crsAuthorityFactory.createCoordinateReferenceSystem(code);
               
View Full Code Here


              throw new Exception("Unknown export type.");

            Transaction transaction = new DefaultTransaction("create");

            String typeName = dataStore.getTypeNames()[0];
            SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);

            if (featureSource instanceof SimpleFeatureStore)
            {
                SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
View Full Code Here

    }
   
    private SimpleFeatureCollection getFeaturesInBbox( ILayer layer, Envelope bbox,
            IProgressMonitor monitor ) throws IOException {

        SimpleFeatureSource featureSource = (SimpleFeatureSource) layer.getResource(
                FeatureSource.class, new SubProgressMonitor(monitor, 1));

        if (featureSource == null) return null;

        Filter bboxFilter = layer.createBBoxFilter(bbox, monitor);
        return featureSource.getFeatures(bboxFilter);
    }
View Full Code Here

                    ReferencedEnvelope bbox = getContext().getBoundingBox(new Point(x, y), 5);
                    SimpleFeatureCollection collection = null;
                    FeatureIterator<SimpleFeature> iter = null;
                    try {
                        ILayer selectedLayer = getContext().getSelectedLayer();
                        SimpleFeatureSource source = selectedLayer.getResource(
                                SimpleFeatureSource.class, new SubProgressMonitor(monitor, 1));
                        if (source == null)
                            return;
                        collection = source.getFeatures(selectedLayer.createBBoxFilter(bbox,
                                new SubProgressMonitor(monitor, 1)));
                        iter = collection.features();
                        if (!iter.hasNext()) {
                            if (!e.buttonsDown()) {
                                getContext().sendASyncCommand(
View Full Code Here

    public void run() {
        ILayer layer = getContext().getSelectedLayer();
        if (layer.hasResource(SimpleFeatureSource.class)) {
            try {
                SimpleFeatureSource resource = featureSource(layer);
                Query query = layer.getQuery(true);
                ReferencedEnvelope bounds = resource.getBounds(query);
                if (bounds == null) {
                  FeatureCollection<SimpleFeatureType, SimpleFeature> featureResult = resource.getFeatures(query);
                  if (featureResult != null && !featureResult.isEmpty()) {
                    ReferencedEnvelope envelope = featureResult.getBounds();
                    if (envelope != null) {
                      bounds = new ReferencedEnvelope(envelope, layer.getCRS());
                    }
View Full Code Here

        }
    }

    private SimpleFeatureSource featureSource( ILayer layer ) throws IOException {
        SimpleFeatureSource resource = layer.getResource(SimpleFeatureSource.class, ProgressManager.instance().get());
        return resource;
    }
View Full Code Here

                        return;
                    }
                } else if (layer instanceof DataStore || layer instanceof UDIGFeatureStore) {
                    try {
                        DataStore store = ((DataStore) layer);
                        SimpleFeatureSource featureStore = store.getFeatureSource(store.getTypeNames()[0]);
                        Envelope envelope = featureStore.getBounds();

                        ProcessingRegionStyle style = getActiveRegionStyle();
                        ProcessingRegion activeWindow = new ProcessingRegion(style.west, style.east, style.south, style.north,
                                style.rows, style.cols);
                        ProcessingRegion newWindow = ProcessingRegion.adaptActiveRegionToEnvelope(envelope, activeWindow);
View Full Code Here

        DataStore dataStore = service(null).toDataAccess();
        return dataStore.getFeatureSource(name);
    }
    @Override
    protected IGeoResourceInfo createInfo( IProgressMonitor monitor ) throws IOException {
        SimpleFeatureSource featureSource = toFeatureSource();
        ResourceInfo gtInfo = featureSource.getInfo();
        return new FeatureSourceGeoResourceInfo(gtInfo);
    }
View Full Code Here

        }
        if (adaptee.isAssignableFrom(FeatureSourceGeoResourceInfo.class)) {
            return adaptee.cast(createInfo(monitor));
        }
        if (adaptee.isAssignableFrom(SimpleFeatureStore.class)) {
            SimpleFeatureSource fs = toFeatureSource();
            if (fs instanceof SimpleFeatureStore) {
                return adaptee.cast(fs);
            }
        }
        if (adaptee.isAssignableFrom(SimpleFeatureSource.class)) {
View Full Code Here

    }

    private void initLayer() throws IOException {
        activeMap = ApplicationGIS.getActiveMap();
        selectedLayer = activeMap.getEditManager().getSelectedLayer();
        SimpleFeatureSource featureSource = (SimpleFeatureSource) selectedLayer.getResource(FeatureSource.class,
                new SubProgressMonitor(new NullProgressMonitor(), 1));
        if (featureSource == null) {
            noProperLayerSelected();
            return;
        }
        SimpleFeatureCollection featureCollection = featureSource.getFeatures();
        crs = featureCollection.getSchema().getCoordinateReferenceSystem();
        featureList = featureCollectionToList(featureCollection);
        previousLayerName = selectedLayer.getName();
        index = 0;
    }
View Full Code Here

TOP

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

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.