String attName = at.getLocalName(); if (!properties.contains(attName)) { tb.remove(attName);
tb.remove("surfaceProperty"); // the store cannot create multi-geom tables it seems tb.remove("curveProperty"); // the store cannot create multi-geom tables it seems tb.remove("uriProperty"); // this would render the store read only tb.setName("pgeo"); SimpleFeatureType schema = tb.buildFeatureType();
@Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder builder = CSVStrategySupport.createBuilder(csvFileState); String[] csvHeaders = csvFileState.getCSVHeaders(); List<String> headers = Arrays.asList(csvHeaders); if (headers.contains(wktField)) { builder.remove(wktField); builder.add(wktField, Geometry.class); } return builder.buildFeatureType(); }
public void testRemoveDefaultGeometryAfterInit() { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName("testGeometries"); builder.add("geo1", Point.class, DefaultGeographicCRS.WGS84); builder.add("geo2", Polygon.class, DefaultGeographicCRS.WGS84); builder.setDefaultGeometry("geo2"); SimpleFeatureType type1 = builder.buildFeatureType(); builder = new SimpleFeatureTypeBuilder(); builder.init(type1); builder.remove("geo2"); SimpleFeatureType type2 = builder.buildFeatureType(); assertEquals("geo2", type1.getGeometryDescriptor().getLocalName()); assertEquals("geo1", type2.getGeometryDescriptor().getLocalName()); } }
@Override public SimpleFeatureType apply(ImportTask task, DataStore dataStore, SimpleFeatureType featureType) throws Exception { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); int latIndex = featureType.indexOf(latField); int lngIndex = featureType.indexOf(lngField); if (latIndex < 0 || lngIndex < 0) { throw new Exception("FeatureType " + featureType.getName() + " does not have lat lng fields named '" + latField + "'" + " and " + "'" + lngField + "'"); } GeometryDescriptor geometryDescriptor = featureType.getGeometryDescriptor(); if (geometryDescriptor != null) { builder.remove(geometryDescriptor.getLocalName()); } builder.remove(latField); builder.remove(lngField); builder.add(pointFieldName, Point.class); return builder.buildFeatureType(); }
@Override public SimpleFeatureType apply( ImportTask task, DataStore dataStore, SimpleFeatureType featureType) throws Exception { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); int latIndex = featureType.indexOf(latField); int lngIndex = featureType.indexOf(lngField); if (latIndex < 0 || lngIndex < 0) { throw new Exception( "FeatureType " + featureType.getName() + " does not have lat lng fields named '" + latField + "'" + " and " + "'" + lngField + "'"); } GeometryDescriptor geometryDescriptor = featureType.getGeometryDescriptor(); if (geometryDescriptor != null) { builder.remove(geometryDescriptor.getLocalName()); } builder.remove(latField); builder.remove(lngField); builder.add(pointFieldName, Point.class); return builder.buildFeatureType(); }
@Override protected SimpleFeatureType buildFeatureType() { String[] headers; Map<String, Class<?>> typesFromData; CsvReader csvReader = null; try { csvReader = csvFileState.openCSVReader(); headers = csvReader.getHeaders(); typesFromData = CSVStrategySupport.findMostSpecificTypesFromData(csvReader, headers); } catch (IOException e) { throw new RuntimeException(e); } finally { if (csvReader != null) { csvReader.close(); } } SimpleFeatureTypeBuilder builder = CSVStrategySupport.createBuilder(csvFileState, headers, typesFromData); Class<?> latClass = typesFromData.get(latField); Class<?> lngClass = typesFromData.get(lngField); if (CSVStrategySupport.isNumeric(latClass) && CSVStrategySupport.isNumeric(lngClass)) { builder.remove(latField); builder.remove(lngField); builder.add(pointField, Point.class); } return builder.buildFeatureType(); }
public SimpleFeatureType apply(ImportTask task, DataStore dataStore, SimpleFeatureType featureType) throws Exception { //remap the type SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); int index = featureType.indexOf(field); if (index < 0) { throw new Exception("FeatureType " + featureType.getName() + " does not have attribute named '" + field + "'"); } //remap the attribute to type date and ensure schema ordering is the same //@todo improve FeatureTypeBuilder to support this directly AttributeDescriptor existing = builder.remove(field); AttributeTypeBuilder attBuilder = new AttributeTypeBuilder(); attBuilder.init(existing); attBuilder.setBinding(type); builder.add(index, attBuilder.buildDescriptor(field)); return builder.buildFeatureType(); }
public SimpleFeatureType apply( ImportTask task, DataStore dataStore, SimpleFeatureType featureType) throws Exception { // remap the type SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); int index = featureType.indexOf(field); if (index < 0) { throw new Exception( "FeatureType " + featureType.getName() + " does not have attribute named '" + field + "'"); } // remap the attribute to type date and ensure schema ordering is the same // @todo improve FeatureTypeBuilder to support this directly AttributeDescriptor existing = builder.remove(field); AttributeTypeBuilder attBuilder = new AttributeTypeBuilder(); attBuilder.init(existing); attBuilder.setBinding(type); builder.add(index, attBuilder.buildDescriptor(field)); return builder.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; }
featureTypeBuilder.remove(columnName);
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; }
tb.remove("surfaceProperty"); // the store cannot create multi-geom tables it seems tb.remove("curveProperty"); // the store cannot create multi-geom tables it seems tb.remove("uriProperty"); // this would render the store read only tb.setName("pgeo"); SimpleFeatureType schema = tb.buildFeatureType();