Examples of FeatureSource


Examples of org.geotools.data.FeatureSource

        MemoryDataStore ds = new MemoryDataStore();
        ds.createSchema(type);
        ds.addFeatures(new SimpleFeature[] { f1, f2, f3 });

        FeatureSource fs = ds.getFeatureSource("test");

        final WMSMapContext map = new WMSMapContext();
        map.setAreaOfInterest(new ReferencedEnvelope(-250, 250, -250, 250, null));
        map.setMapWidth(300);
        map.setMapHeight(300);
View Full Code Here

Examples of org.geotools.data.FeatureSource

                //unless configure specified "all", only configure the first feature type
                if ( !"all".equalsIgnoreCase( configure ) && i > 0 ) {
                    break;
                }
               
                FeatureSource fs = ds.getFeatureSource(featureTypeNames[i]);
                FeatureTypeInfo ftinfo = null;
                if ( add ) {
                    //auto configure the feature type as well
                    ftinfo = builder.buildFeatureType(fs);
                    builder.lookupSRS(ftinfo, true);
                    builder.setupBounds(ftinfo);
                }
                else {
                    ftinfo = catalog.getFeatureTypeByName( namespace.getPrefix(), featureTypeNames[i] );
                }
               
                //update the bounds
                ReferencedEnvelope bounds = fs.getBounds();
                ftinfo.setNativeBoundingBox( bounds );
               
                //TODO: set lat lon bounding box
                if ( add ) {
                    catalog.add( ftinfo );
View Full Code Here

Examples of org.geotools.data.FeatureSource

        IOUtils.copy(SecureCatalogIntegrationTest.class
                .getResourceAsStream("functional.properties"), layers);
    }

    public void testFullAccess() throws Exception {
        FeatureSource source = getFeatureSource(MockData.LINES);
        FeatureCollection fc = source.getFeatures();
        FeatureStore store = (FeatureStore) source;
        store.removeFeatures(Filter.INCLUDE);
    }
View Full Code Here

Examples of org.geotools.data.FeatureSource

    public void testReadOnlyFeatureSourceDataStore() throws Exception {
        // build up the mock
        DataStore ds = createNiceMock(DataStore.class);
        replay(ds);
        FeatureSource fs = createNiceMock(FeatureSource.class);
        FeatureCollection fc = createNiceMock(FeatureCollection.class);
        expect(fs.getDataStore()).andReturn(ds);
        expect(fs.getFeatures()).andReturn(fc);
        expect(fs.getFeatures(Filter.INCLUDE)).andReturn(fc);
        expect(fs.getFeatures(new DefaultQuery())).andReturn(fc);
        replay(fs);
       
        ReadOnlyFeatureSource ro = new ReadOnlyFeatureSource(fs, WrapperPolicy.HIDE);
        assertTrue(ro.getDataStore() instanceof ReadOnlyDataStore);
        ReadOnlyFeatureCollection collection = (ReadOnlyFeatureCollection) ro.getFeatures();
View Full Code Here

Examples of org.geotools.data.FeatureSource

   
    public void testReadOnlyFeatureSourceDataAccess() throws Exception {
        // build the mock up
        DataAccess da = createNiceMock(DataAccess.class);
        replay(da);
        FeatureSource fs = createNiceMock(FeatureSource.class);
        expect(fs.getDataStore()).andReturn(da);
        replay(fs);
       
        ReadOnlyFeatureSource ro = new ReadOnlyFeatureSource(fs, WrapperPolicy.RO_CHALLENGE);
        assertTrue(ro.getDataStore() instanceof ReadOnlyDataAccess);
    }
View Full Code Here

Examples of org.geotools.data.FeatureSource

    private NameImpl name;

    protected void setUp() throws Exception {
        super.setUp();

        FeatureSource fs = createNiceMock(FeatureSource.class);
        replay(fs);
        FeatureType schema = createNiceMock(FeatureType.class);
        replay(schema);
        da = createNiceMock(DataAccess.class);
        name = new NameImpl("blah");
View Full Code Here

Examples of org.geotools.data.FeatureSource

public class CSVOutputFormatTest extends WFSTestSupport {

    public void testFullRequest() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=sf:PrimitiveGeoFeature&outputFormat=csv");
       
        FeatureSource fs = getFeatureSource(MockData.PRIMITIVEGEOFEATURE);
       
//        System.out.println(resp.getOutputStreamContent());
       
        // check the mime type
        assertEquals("text/csv", resp.getContentType());
       
        // check the content disposition
        assertEquals("attachment; filename=PrimitiveGeoFeature.csv", resp.getHeader("Content-Disposition"));
       
        // read the response back with a parser that can handle escaping, newlines and what not
        List<String[]> lines = readLines(resp.getOutputStreamContent());
       
        // we should have one header line and then all the features in that feature type
        assertEquals(fs.getCount(Query.ALL) + 1, lines.size());
       
        for (String[] line : lines) {
            // check each line has the expected number of elements (num of att + 1 for the id)
            assertEquals(fs.getSchema().getDescriptors().size() + 1, line.length);
        }
    }
View Full Code Here

Examples of org.geotools.data.FeatureSource

          // in this case the features field is not null but it is filled externally
                    if (features==null) {
                       
              store = FileDataStoreFinder.getDataStore(file);
              if (store==null) throw new ActionException(this, "the layer "+file.getCanonicalPath()+" cannot be found. Skip execution.");
                        FeatureSource featureSource = store.getFeatureSource();
                        SimpleFeatureType schema = (SimpleFeatureType) featureSource.getSchema();
                        Query query = new Query( schema.getTypeName(), Filter.INCLUDE );
                        query.setCoordinateSystem(CRS.decode("EPSG:4326", true));
                        features = (SimpleFeatureCollection) featureSource.getFeatures( query );
                       
          //    features = (SimpleFeatureCollection) featureSource.getFeatures();
                    }
                   
          //CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84;
View Full Code Here

Examples of org.geotools.data.FeatureSource

                Throwables.propagate(e);
            }

            DataAccess data = dataStore.getDataStore(null);

            FeatureSource source = data.getFeatureSource(resourceName);
            builder.setupBounds(ft, source);

            return builder.buildLayer(ft);
        }
        else if (store instanceof CoverageStoreInfo) {
View Full Code Here

Examples of org.geotools.data.FeatureSource

                }
                progressListener.setDescription("Importing " + tableName + " (" + tableCount + "/"
                        + typeNames.length + ")... ");
            }

            FeatureSource featureSource = getFeatureSource(typeName);
            SimpleFeatureType featureType = (SimpleFeatureType) featureSource.getSchema();

            final String fidPrefix = featureType.getTypeName() + ".";

            String path;
            if (destPath == null) {
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.