SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); tb.setName("foo"); tb.setSRS("epsg:4326"); tb.add("geom", Point.class);
public SimpleFeatureType convertParsedFeatureType( SimpleFeatureType ft, String name, Set<String> untypedAttributes) { SimpleFeatureType transformedType = kmlTransform.convertFeatureType(ft); SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder(); ftb.init(transformedType); Set<String> existringAttrNames = new HashSet<String>(); for (AttributeDescriptor ad : ft.getAttributeDescriptors()) { existringAttrNames.add(ad.getLocalName()); } for (String attr : untypedAttributes) { if (!existringAttrNames.contains(attr)) { ftb.add(attr, String.class); } } ftb.setName(name); ftb.setCRS(KML_CRS); ftb.setSRS(KML_SRS); return ftb.buildFeatureType(); }
public SimpleFeatureType convertParsedFeatureType(SimpleFeatureType ft, String name, Set<String> untypedAttributes) { SimpleFeatureType transformedType = kmlTransform.convertFeatureType(ft); SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder(); ftb.init(transformedType); Set<String> existringAttrNames = new HashSet<String>(); for (AttributeDescriptor ad : ft.getAttributeDescriptors()) { existringAttrNames.add(ad.getLocalName()); } for (String attr : untypedAttributes) { if (!existringAttrNames.contains(attr)) { ftb.add(attr, String.class); } } ftb.setName(name); ftb.setCRS(KML_CRS); ftb.setSRS(KML_SRS); return ftb.buildFeatureType(); }
public SimpleFeatureType convertFeatureType(SimpleFeatureType oldFeatureType) { SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder(); ftb.add("Geometry", Geometry.class); ftb.setDefaultGeometry("Geometry"); List<AttributeDescriptor> attributeDescriptors = oldFeatureType.getAttributeDescriptors(); for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { String localName = attributeDescriptor.getLocalName(); if (!"Geometry".equals(localName)) { ftb.add(attributeDescriptor); } } ftb.setName(oldFeatureType.getName()); ftb.setDescription(oldFeatureType.getDescription()); ftb.setCRS(KMLFileFormat.KML_CRS); ftb.setSRS(KMLFileFormat.KML_SRS); // remove style attribute for now if (oldFeatureType.getDescriptor("Style") != null) { ftb.remove("Style"); } ftb.add("Folder", String.class); SimpleFeatureType ft = ftb.buildFeatureType(); return ft; }
public SimpleFeatureType convertFeatureType(SimpleFeatureType oldFeatureType) { SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder(); ftb.add("Geometry", Geometry.class); ftb.setDefaultGeometry("Geometry"); List<AttributeDescriptor> attributeDescriptors = oldFeatureType.getAttributeDescriptors(); for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { String localName = attributeDescriptor.getLocalName(); if (!"Geometry".equals(localName)) { ftb.add(attributeDescriptor); } } ftb.setName(oldFeatureType.getName()); ftb.setDescription(oldFeatureType.getDescription()); ftb.setCRS(KMLFileFormat.KML_CRS); ftb.setSRS(KMLFileFormat.KML_SRS); // remove style attribute for now if (oldFeatureType.getDescriptor("Style") != null) { ftb.remove("Style"); } ftb.add("Folder", String.class); SimpleFeatureType ft = ftb.buildFeatureType(); return ft; }
builder.setCRS(fti.getCRS()); } else if(fti.getSRS() != null) { builder.setSRS(fti.getSRS());
builder.setCRS(fti.getCRS()); } else if (fti.getSRS() != null) { builder.setSRS(fti.getSRS());
@BeforeClass public static void classSetup() { styleFactory = (StyleFactory2) CommonFactoryFinder.getStyleFactory(); filterFactory = (FilterFactory2) CommonFactoryFinder.getFilterFactory2(); GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); typeBuilder.setName("example"); typeBuilder.setNamespaceURI("http://example.com/"); typeBuilder.setSRS("EPSG:4326"); typeBuilder.add("field", String.class); typeBuilder.add("geom", Point.class, "EPSG:4326"); featureType = typeBuilder.buildFeatureType(); SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType); featureBuilder.set("field", "1"); featureBuilder.set("geom", geometryFactory.createPoint(new Coordinate(0, 0))); fieldIs1 = featureBuilder.buildFeature(null); featureBuilder.set("field", "2"); featureBuilder.set("geom", geometryFactory.createPoint(new Coordinate(0, 0))); fieldIs2 = featureBuilder.buildFeature(null); }