Package org.geotools.feature.simple

Examples of org.geotools.feature.simple.SimpleFeatureBuilder.buildFeature()


                    }
                    objIndex++;
                }
                builder.addAll(values);

                SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + featureId);
                featureId++;
                newCollection.add(feature);
            }
        } finally {
            if (bR != null)
View Full Code Here


    try {
     
      // sets the features attributes
      SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
      builder.addAll(mergedFeature);
      feature = builder.buildFeature(null);

      // build the geometry
      Geometry geometry = buildMergeGeometry();
      feature.setDefaultGeometry(geometry);
     
View Full Code Here

            return;
        }

        if (isDefaultPresented) {
            SimpleFeatureBuilder builder = new SimpleFeatureBuilder(feature.getFeatureType());
            SimpleFeature temp = builder.buildFeature(feature.getID());

            feature.setAttributes(temp.getAttributes());
        } else {
            doStore();
        }
View Full Code Here

        SimpleFeatureBuilder sfb = new SimpleFeatureBuilder(type);
        WKTReader reader = new WKTReader();
        sfb.set("the_geom", reader.read("POINT (0.002 0.0008)"));
        sfb.set("FID", "023");
        sfb.set("NAME", "Old oak");
        SimpleFeature feature = sfb.buildFeature(null);
        FeatureCollection<SimpleFeatureType, SimpleFeature> fc = DataUtilities.collection(feature);

        FeatureStore<SimpleFeatureType, SimpleFeature> store = (FeatureStore) rts.getFeatureSource("oaks");
        List<FeatureId> ids = store.addFeatures(fc);
        assertEquals(1, ids.size());
View Full Code Here

        fs = (FeatureStore<SimpleFeatureType, SimpleFeature>) dataStore
                .getFeatureSource(featureType.getName());

        SimpleFeatureBuilder sfb = new SimpleFeatureBuilder(featureType);
        sfb.addAll(values);
        SimpleFeature feature = sfb.buildFeature(null);
        fs.addFeatures(DataUtilities.collection(feature));

        return feature;
    }
View Full Code Here

        WKTReader reader = new WKTReader();
        SimpleFeatureBuilder sb = new SimpleFeatureBuilder(ft);
        sb.set("the_geom", reader.read("POINT(10 10)"));
        sb.set("FID", "Fid001");
        sb.set("NAME", "Pluto");
        SimpleFeature f = sb.buildFeature("fidxxx");

        String template = "Hello this is ${FID.value} my name is ${NAME.value}";
        Expression freemarker = CQL.toExpression("freemarker('" + template + "')");
        String result = freemarker.evaluate(f, String.class);
        String expected = "Hello this is " + f.getAttribute("FID") + " my name is "
View Full Code Here

        SimpleFeatureBuilder sfb = new SimpleFeatureBuilder(type);
        WKTReader reader = new WKTReader();
        sfb.set("the_geom", reader.read("POINT (0.002 0.0008)"));
        sfb.set("FID", "023");
        sfb.set("NAME", "Old oak");
        SimpleFeature feature = sfb.buildFeature(null);
        FeatureCollection<SimpleFeatureType, SimpleFeature> fc = DataUtilities.collection(feature);

        FeatureStore<SimpleFeatureType, SimpleFeature> store = (FeatureStore) rts.getFeatureSource("oaks");
        List<FeatureId> ids = store.addFeatures(fc);
        assertEquals(1, ids.size());
View Full Code Here

    // creates the new feature
    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(
        unionFeatureType);
    builder.addAll(attrList);
    // SimpleFeature product = unionFeatureType.create(attrList);
    SimpleFeature product = builder.buildFeature(null);
    product.setDefaultGeometry(this.geometry);

    return product;
  }
View Full Code Here

                nameAttribute = f.getAttribute("name");
            } catch (Exception e){
                // ignore name attribute
            }
            builder.addAll(new Object[]{nameAttribute, geometry });
            SimpleFeature feature = builder.buildFeature(type.getTypeName() + "." + index++); //$NON-NLS-1$
            newCollection.add(feature);
        }

        return newCollection;
    }
View Full Code Here

          else {
            String colValue = node.getValue().asString();
            featureBuilder.add(colValue);
          }
        }
        SimpleFeature feature = featureBuilder.buildFeature(null);
        features.add(feature);
      } catch (Exception e) {
        logger.error("Error creating geometry! Skipping it.", e);
        continue;
      }
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.