Examples of SimpleFeatureType


Examples of org.opengis.feature.simple.SimpleFeatureType

        FeatureTypeStyle fts = null;
        if (ftsList.size()>0) {
            fts  = ftsList.get(0);
        }

        SimpleFeatureType schema = getLayer().getSchema();
        geometryName.setInput(schema);
        String name = DEFAULT_GEOMETRY;

        Stroke stroke = null;
        Fill fill = null;
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        b.setCRS(mapCrs);
        b.add("the_geom", Point.class); //$NON-NLS-1$
        for( String fieldName : GEOPAPARAZZI_NOTES_DESCRIPTIONFIELDS ) {
            b.add(fieldName, String.class);
        }
        SimpleFeatureType featureType = b.buildFeatureType();
        MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, mapCrs);
        pm.beginTask("Import notes...", IProgressMonitor.UNKNOWN);
        DefaultFeatureCollection newCollection = new DefaultFeatureCollection();

        Statement statement = null;
        try {
            statement = connection.createStatement();
            statement.setQueryTimeout(30); // set timeout to 30 sec.

            ResultSet rs = statement.executeQuery("select lat, lon, altim, ts, text from notes");
            int i = 0;
            while( rs.next() ) {

                double lat = rs.getDouble("lat");
                double lon = rs.getDouble("lon");
                double altim = rs.getDouble("altim");
                String dateTimeString = rs.getString("ts");
                String text = rs.getString("text");

                if (lat == 0 || lon == 0) {
                    continue;
                }

                // and then create the features
                Coordinate c = new Coordinate(lon, lat);
                Point point = gF.createPoint(c);
                Geometry reprojectPoint = JTS.transform(point, transform);

                SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
                Object[] values = new Object[]{reprojectPoint, text, dateTimeString, String.valueOf(altim)};
                builder.addAll(values);
                SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + i++);
                newCollection.add(feature);
                pm.worked(1);
            }
        } finally {
            pm.done();
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        b.setCRS(mapCrs);
        b.add("the_geom", MultiLineString.class);
        b.add("STARTDATE", String.class);
        b.add("ENDDATE", String.class);
        b.add("DESCR", String.class);
        SimpleFeatureType featureType = b.buildFeatureType();

        try {
            MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, mapCrs);
            pm.beginTask("Import gps to lines...", logsList.size());
            DefaultFeatureCollection newCollection = new DefaultFeatureCollection();
            int index = 0;
            for( GpsLog log : logsList ) {
                List<GpsPoint> points = log.points;

                List<Coordinate> coordList = new ArrayList<Coordinate>();
                String startDate = log.startTime;
                String endDate = log.endTime;
                for( GpsPoint gpsPoint : points ) {
                    Coordinate c = new Coordinate(gpsPoint.lon, gpsPoint.lat);
                    coordList.add(c);
                }
                Coordinate[] coordArray = (Coordinate[]) coordList.toArray(new Coordinate[coordList.size()]);
                if (coordArray.length < 2) {
                    continue;
                }
                LineString lineString = gF.createLineString(coordArray);
                LineString reprojectLineString = (LineString) JTS.transform(lineString, transform);
                MultiLineString multiLineString = gF.createMultiLineString(new LineString[]{reprojectLineString});

                SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
                Object[] values = new Object[]{multiLineString, startDate, endDate, log.text};
                builder.addAll(values);
                SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + index++);

                newCollection.add(feature);
                pm.worked(1);
            }
            pm.done();

            ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory();
            Map<String, Serializable> params = new HashMap<String, Serializable>();
            params.put("url", outputLinesShapeFile.toURI().toURL());
            params.put("create spatial index", Boolean.TRUE);
            ShapefileDataStore dStore = (ShapefileDataStore) factory.createNewDataStore(params);
            dStore.createSchema(featureType);
            dStore.forceSchemaCRS(mapCrs);

            JGrassToolsPlugin.getDefault().writeToShapefile(dStore, newCollection);

            JGrassToolsPlugin.getDefault().addServiceToCatalogAndMap(outputLinesShapeFile.getAbsolutePath(), true, true,
                    new NullProgressMonitor());

        } catch (Exception e1) {
            JGrassToolsPlugin.log(e1.getLocalizedMessage(), e1);
            e1.printStackTrace();
        }
        /*
         * create the points shapefile
         */

        File outputPointsShapeFile = new File(outputFolderFile, "gpspoints.shp");

        b = new SimpleFeatureTypeBuilder();
        b.setName("geopaparazzinotes");
        b.setCRS(mapCrs);
        b.add("the_geom", Point.class);
        b.add("ALTIMETRY", String.class);
        b.add("DATE", String.class);
        featureType = b.buildFeatureType();

        try {
            MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, mapCrs);

            pm.beginTask("Import gps to points...", logsList.size());
            DefaultFeatureCollection newCollection = new DefaultFeatureCollection();
            int index = 0;
            for( GpsLog log : logsList ) {
                List<GpsPoint> gpsPointList = log.points;
                for( GpsPoint gpsPoint : gpsPointList ) {
                    Coordinate c = new Coordinate(gpsPoint.lon, gpsPoint.lat);
                    Point point = gF.createPoint(c);

                    Point reprojectPoint = (Point) JTS.transform(point, transform);
                    Object[] values = new Object[]{reprojectPoint, String.valueOf(gpsPoint.altim), gpsPoint.utctime};

                    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
                    builder.addAll(values);
                    SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + index++);
                    newCollection.add(feature);
                }
                pm.worked(1);
            }
            pm.done();
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

            b.add("the_geom", Point.class);
            b.add("ALTIMETRY", String.class);
            b.add("DATE", String.class);
            b.add("AZIMUTH", Double.class);
            b.add("IMAGE", String.class);
            SimpleFeatureType featureType = b.buildFeatureType();

            MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, mapCrs);

            DefaultFeatureCollection newCollection = new DefaultFeatureCollection();
            for( File imageFile : listFiles ) {
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        }
        sldContentManager.init(SLDContent.getStyleBuilder(), style);
       
        // pull the feature type name out of the layer
        if (layer.getSchema() != null) {
            SimpleFeatureType featureType = layer.getSchema();
       
            //set the name of the feature type style for the feature renderer
            String name = featureType.getName().getLocalPart();
            sldContentManager.getDefaultFeatureTypeStyle().setFeatureTypeName(SLDs.GENERIC_FEATURE_TYPENAME);
        }
       
        // force the toolbar to refresh
        //
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        }
        getApplyAction().setEnabled(false);
        if( this.aoiButton == null || this.aoiButton.isDisposed()){
            return; // we are shut down and thus ignoring this request to update the ui
        }
        SimpleFeatureType type = getLayer().getSchema();
        FilterInput filterInput = filterViewer.getInput();
        filterInput.setSchema( type );
       
        final FilterStyle style = getFilterStyle();
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

    @Override
    public void synchronize() {
        List<Symbolizer> acquire = new ArrayList<Symbolizer>();
        TextSymbolizer textSym = this.label.get(this.build);

        SimpleFeatureType schema = getLayer().getSchema();
        this.mode = determineMode(schema, true);

        String geometryPropertyName = null;
        if (geometryName.getCombo().getSelectionIndex() != 0) {
            geometryPropertyName = geometryName.getCombo().getText();
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        data.add(new SummaryData(Messages.LayerSummary_id,layer.getID()));
        data.add(new SummaryData(Messages.LayerSummary_bounds, bounds==null?Messages.LayerSummary_unknownBounds:parseBounds(bounds)));
        data.add(new SummaryData(Messages.LayerSummary_selection,layer.getFilter()));
        data.add(new SummaryData(Messages.LayerSummary_status, layer.getStatusMessage()));
        if ( layer.getSchema()!=null ){
            SimpleFeatureType schema = layer.getSchema();
            SummaryData schemaData=new SummaryData(Messages.LayerSummary_featureType, schema.getName().getLocalPart());
            SummaryData[] children=new SummaryData[schema.getAttributeCount()];
           
            for( int i = 0; i < children.length; i++ ) {
                AttributeDescriptor attributeType = schema.getDescriptor(i);
                children[i]=new SummaryData(attributeType.getLocalName(), attributeType.getType().getBinding().getSimpleName());
                children[i].setParent(schemaData);
                List<SummaryData> attTypeChildren=new ArrayList<SummaryData>();
                attTypeChildren.add(new SummaryData(Messages.LayerSummary_nillable, attributeType.isNillable()));
                attTypeChildren.get(0).setParent(children[i]);
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        SimpleFeatureSource featureSource
          = resource.resolve(SimpleFeatureSource.class, m);
       
        if (featureSource != null) {
          //match up the feature type style name and the feature type name
          SimpleFeatureType type = featureSource.getSchema();
          FeatureTypeStyle fstyle = SLDs.featureTypeStyle(style,type);
          if (fstyle == null) {
            //force a name match
            List<FeatureTypeStyle> fstyles = style.featureTypeStyles();
            if (fstyles != null && !fstyles.isEmpty()) {
              fstyle = fstyles.get(0);
            }
          }
         
          if (fstyle != null) {
            fstyle.setName(type.getName().getLocalPart());
            StyleBlackboard styleBlackboard = (StyleBlackboard) layer.getStyleBlackboard();
                    styleBlackboard.put(SLDContent.ID, style);
              styleBlackboard.setSelected(new String[]{SLDContent.ID});

//            //force a rerender, TODO: blackboard events
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

             FeatureSource<SimpleFeatureType, SimpleFeature> featureSource ) throws IOException {
        if (featureSource == null) {
            return null;
        }
       
        SimpleFeatureType schema = featureSource.getSchema();
        GeometryDescriptor geom = schema.getGeometryDescriptor();
        if (geom == null) {
            return null;
        }

        Style style = styleBuilder.createStyle();
        SLDContentManager sldContentManager = new SLDContentManager(styleBuilder, style);

        // initialize the symbolizers based on geometry type
        if (SLD.isLine(geom)) {
            sldContentManager.addSymbolizer(createLineSymbolizer(colour));
        } else if (SLD.isPoint(geom)) {
            sldContentManager.addSymbolizer(createPointSymbolizer(colour));
        } else if (SLD.isPolygon(geom)) {
            PolygonSymbolizer symbol = createPolygonSymbolizer(colour);
            sldContentManager.addSymbolizer(symbol);
        } else {
            try {
                createGeometrySLD(colour, schema.getGeometryDescriptor().getName().getLocalPart(),
                        sldContentManager);
            } catch (Exception e) {
                SLDPlugin.log("Failed to create geometry SLD", e); //$NON-NLS-1$
                sldContentManager.addSymbolizer(styleBuilder.createLineSymbolizer());
            }
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.