Java Code Examples for org.geotools.feature.simple.SimpleFeatureTypeBuilder#setCRS()
The following examples show how to use
org.geotools.feature.simple.SimpleFeatureTypeBuilder#setCRS() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestScanLineRasterizer.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
private SimpleFeatureCollection doCollection( RegionMap envelopeParams ) { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("typename"); b.setCRS(crs); b.add("the_geom", Polygon.class); b.add("cat", Double.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Object[] values = new Object[]{polygon, 1.0}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(null); DefaultFeatureCollection newCollection = new DefaultFeatureCollection(); newCollection.add(feature); return newCollection; }
Example 2
Source File: GeometryTranslator.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
/** * Builds a line feature from a dwg polyline 3D. * * TODO handle these as contourlines * */ public SimpleFeature convertDwgPolyline3D( String typeName, String layerName, DwgPolyline3D polyline3d, int id ) { double[][] ptos = polyline3d.getPts(); CoordinateList coordList = new CoordinateList(); if (ptos != null) { for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j][0], ptos[j][1], ptos[j][2]); coordList.add(coord); } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, LineString.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry lineString = gF.createLineString(coordList.toCoordinateArray()); Object[] values = new Object[]{lineString, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); } return null; }
Example 3
Source File: DBScanIT.java From geowave with Apache License 2.0 | 6 votes |
private SimpleFeatureBuilder getBuilder() { final SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); typeBuilder.setName("test"); typeBuilder.setSRS(ClusteringUtils.CLUSTERING_CRS); try { typeBuilder.setCRS(CRS.decode(ClusteringUtils.CLUSTERING_CRS, true)); } catch (final FactoryException e) { e.printStackTrace(); return null; } // add attributes in order typeBuilder.add("geom", Point.class); typeBuilder.add("name", String.class); typeBuilder.add("count", Long.class); // build the type return new SimpleFeatureBuilder(typeBuilder.buildFeatureType()); }
Example 4
Source File: OmsGridsGenerator.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
private void createPolygons( CoordinateReferenceSystem crs, GeometryFactory gf, List<Geometry> polygons ) { outMap = new DefaultFeatureCollection(); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(POLYGON); b.setCRS(crs); b.add("the_geom", Polygon.class); b.add("id", Long.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder fbuilder = new SimpleFeatureBuilder(type); long index = 0; int numGeometries = polygons.size(); for( int i = 0; i < numGeometries; i++ ) { Geometry geometry = polygons.get(i); Object[] values = new Object[]{geometry, index++}; fbuilder.addAll(values); SimpleFeature feature = fbuilder.buildFeature(null); ((DefaultFeatureCollection) outMap).add(feature); } }
Example 5
Source File: AnalyticFeature.java From geowave with Apache License 2.0 | 5 votes |
public static FeatureDataAdapter createFeatureAdapter( final String centroidDataTypeId, final String[] extraNumericDimensions, final String namespaceURI, final String SRID, final ClusterFeatureAttribute[] attributes, final Class<? extends Geometry> geometryClass) { try { final SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName(centroidDataTypeId); builder.setNamespaceURI( namespaceURI == null ? BasicFeatureTypes.DEFAULT_NAMESPACE : namespaceURI); builder.setSRS(SRID); builder.setCRS(CRS.decode(SRID, true)); for (final ClusterFeatureAttribute attrVal : attributes) { builder.add( attrVal.name, attrVal.equals(ClusterFeatureAttribute.GEOMETRY) ? geometryClass : attrVal.type); } for (final String extraDim : extraNumericDimensions) { builder.add(extraDim, Double.class); } final FeatureDataAdapter adapter = new FeatureDataAdapter(builder.buildFeatureType()); // TODO any consumers of this method will not be able to utilize // custom CRS adapter.init(new SpatialDimensionalityTypeProvider().createIndex(new SpatialOptions())); return adapter; } catch (final Exception e) { LOGGER.warn("Schema Creation Error. Hint: Check the SRID.", e); } return null; }
Example 6
Source File: ShapeFile.java From tutorials with MIT License | 5 votes |
static SimpleFeatureType createFeatureType() { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName("Location"); builder.setCRS(DefaultGeographicCRS.WGS84); builder.add("Location", Point.class); builder.length(15) .add("Name", String.class); return builder.buildFeatureType(); }
Example 7
Source File: GeopaparazziUtilities.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
public static SimpleFeatureType getGpsLogLinesFeatureType() { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("geopaparazzilogs"); b.setCRS(DefaultGeographicCRS.WGS84); b.add("the_geom", MultiLineString.class); b.add(GPSLOG_startdateFN, String.class); b.add(GPSLOG_enddateFN, String.class); b.add(GPSLOG_descrFN, String.class); SimpleFeatureType featureType = b.buildFeatureType(); return featureType; }
Example 8
Source File: GeopaparazziUtilities.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
public static SimpleFeatureType getSimpleNotesfeatureType() { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("gpsimplenotes"); //$NON-NLS-1$ b.setCRS(DefaultGeographicCRS.WGS84); b.add("the_geom", Point.class); //$NON-NLS-1$ b.add(NOTES_textFN, String.class); b.add(NOTES_descFN, String.class); b.add(NOTES_tsFN, String.class); b.add(NOTES_altimFN, Double.class); b.add(NOTES_dirtyFN, Integer.class); SimpleFeatureType featureType = b.buildFeatureType(); return featureType; }
Example 9
Source File: OmsLW08_NetworkBufferWidthCalculator.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
private SimpleFeatureBuilder getNewLinesBuilder( CoordinateReferenceSystem crs ) throws Exception { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("net"); b.setCRS(crs); b.add("the_geom", LineString.class); b.add(PFAF, String.class); b.add(LINKID, Integer.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); return builder; }
Example 10
Source File: DateFieldRetypingSource.java From geowave with Apache License 2.0 | 5 votes |
@Override public SimpleFeatureType getRetypedSimpleFeatureType() { debugType("IN", typeIn); final SimpleFeatureTypeBuilder typeOutBuilder = new SimpleFeatureTypeBuilder(); // Manually set the basics and replace the date fields typeOutBuilder.setCRS(typeIn.getCoordinateReferenceSystem()); typeOutBuilder.setDescription(typeIn.getDescription()); typeOutBuilder.setName(typeIn.getName()); for (final AttributeDescriptor att : typeIn.getAttributeDescriptors()) { if (fieldNameToTimestampFormat.containsKey(att.getLocalName())) { typeOutBuilder.add(att.getLocalName(), Date.class); } else { typeOutBuilder.add(att); } } // TODO - restore this procedure when support for GeoTools 12.x is // dropped // typeOutBuilder.init(typeIn); // for (Entry<String, String> fieldToChange : // fieldNameToTimestampFormat.entrySet()) { // final AttributeTypeBuilder dateFieldBuilder = new // AttributeTypeBuilder(); // dateFieldBuilder.setName(fieldToChange.getKey()); // dateFieldBuilder.setBinding(Date.class); // typeOutBuilder.set( // fieldToChange.getKey(), // dateFieldBuilder); // } final SimpleFeatureType typeOut = typeOutBuilder.buildFeatureType(); debugType("OUT", typeOut); return typeOut; }
Example 11
Source File: FeatureExtender.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
/** * @param oldFeatureType the {@link FeatureType} of the existing features. * @param fieldArray the list of the names of new fields. * @param classesArray the list of classes of the new fields. * @throws FactoryRegistryException * @throws SchemaException */ public FeatureExtender( SimpleFeatureType oldFeatureType, String[] fieldArray, Class<?>[] classesArray ) throws FactoryRegistryException, SchemaException { List<AttributeDescriptor> oldAttributeDescriptors = oldFeatureType .getAttributeDescriptors(); List<AttributeDescriptor> addedAttributeDescriptors = new ArrayList<AttributeDescriptor>(); for( int i = 0; i < fieldArray.length; i++ ) { AttributeTypeBuilder build = new AttributeTypeBuilder(); build.setNillable(true); build.setBinding(classesArray[i]); AttributeDescriptor descriptor = build.buildDescriptor(fieldArray[i]); addedAttributeDescriptors.add(descriptor); } List<AttributeDescriptor> newAttributesTypesList = new ArrayList<AttributeDescriptor>(); for( AttributeDescriptor attributeDescriptor : oldAttributeDescriptors ) { newAttributesTypesList.add(attributeDescriptor); } newAttributesTypesList.addAll(addedAttributeDescriptors); // create the feature type SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(oldFeatureType.getName()); b.setCRS(oldFeatureType.getCoordinateReferenceSystem()); b.addAll(newAttributesTypesList); newFeatureType = b.buildFeatureType(); }
Example 12
Source File: TestVectorFieldRounder.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
public void testVectorFieldRounder() throws Exception { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("test"); b.setCRS(DefaultGeographicCRS.WGS84); b.add("the_geom", Point.class); b.add("area", Double.class); DefaultFeatureCollection newCollection = new DefaultFeatureCollection(); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Point point = GeometryUtilities.gf().createPoint(new Coordinate(0, 0)); Object[] values = new Object[]{point, 123.456789}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(type.getTypeName() + ".0"); newCollection.add(feature); OmsVectorFieldRounder rounder = new OmsVectorFieldRounder(); rounder.inVector = newCollection; rounder.fRound = "area"; rounder.pPattern = ".##"; rounder.process(); SimpleFeatureCollection outFeatures = rounder.outVector; SimpleFeature f = FeatureUtilities.featureCollectionToList(outFeatures).get(0); String areaStr = f.getAttribute("area").toString(); assertTrue(areaStr.equals("123.46")); }
Example 13
Source File: OmsTrentoPProjectFilesGenerator.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
/** * Build the Project Type. * * @param crs * @return the type for the calibration shp. */ private SimpleFeatureType getProjectFeatureType( CoordinateReferenceSystem crs ) { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); ITrentoPType[] values = TrentoPFeatureType.PipesTrentoP.values(); String typeName = values[0].getName(); b.setName(typeName); b.setCRS(crs); b.add("the_geom", LineString.class); // create ID attribute. b.add(values[0].getAttributeName(), values[0].getClazz()); // create drain area attribute. b.add(values[2].getAttributeName(), values[2].getClazz()); // create the percentage area. b.add(values[11].getAttributeName(), values[12].getClazz()); // The upstream elevation of the land. b.add(values[3].getAttributeName(), values[3].getClazz()); // The downstream elevation of the land. b.add(values[4].getAttributeName(), values[4].getClazz()); // runoff coefficent. b.add(values[5].getAttributeName(), values[5].getClazz()); // average residence time. b.add(values[6].getAttributeName(), values[6].getClazz()); // ks b.add(values[7].getAttributeName(), values[7].getClazz()); // minimum slope. b.add(values[8].getAttributeName(), values[8].getClazz()); // section type b.add(values[9].getAttributeName(), values[9].getClazz()); // average slope of the basin. b.add(values[10].getAttributeName(), values[10].getClazz()); return b.buildFeatureType(); }
Example 14
Source File: GeometryTranslator.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
private SimpleFeature createPointTextFeature( String typeName, String layerName, int id, Coordinate coord, String textString ) { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, Point.class); b.add("text", String.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry point = gF.createPoint(coord); Object[] values = new Object[]{point, textString, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
Example 15
Source File: OmsEpanetProjectFilesGenerator.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
private void makePointLayer( IEpanetType[] types, File baseFolder, CoordinateReferenceSystem mapCrs ) throws MalformedURLException, IOException { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); String shapefileName = types[0].getShapefileName(); String typeName = types[0].getName(); b.setName(typeName); b.setCRS(mapCrs); b.add("the_geom", Point.class); for( IEpanetType type : types ) { b.add(type.getAttributeName(), type.getClazz()); } SimpleFeatureType tanksType = b.buildFeatureType(); ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory(); File file = new File(baseFolder, shapefileName); Map<String, Serializable> create = new HashMap<String, Serializable>(); create.put("url", file.toURI().toURL()); ShapefileDataStore newDataStore = (ShapefileDataStore) factory.createNewDataStore(create); newDataStore.createSchema(tanksType); Transaction transaction = new DefaultTransaction(); SimpleFeatureStore featureStore = (SimpleFeatureStore) newDataStore.getFeatureSource(); featureStore.setTransaction(transaction); try { featureStore.addFeatures(new DefaultFeatureCollection()); transaction.commit(); } catch (Exception problem) { problem.printStackTrace(); transaction.rollback(); } finally { transaction.close(); } }
Example 16
Source File: OmsLW03_NetworkHierarchyToPointsSplitter.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
@Execute public void process() throws Exception { checkNull(inNet); if (pGauklerStrickler < 10) { throw new ModelsIllegalargumentException("KS can't be negative.", this); } // Creates the list of contained features List<SimpleFeature> netList = FeatureUtilities.featureCollectionToList(inNet); // Creates the output feature collection DefaultFeatureCollection outNetPointsFC = new DefaultFeatureCollection(); // Creates the structure of the output point layer SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("net"); b.setCRS(inNet.getBounds().getCoordinateReferenceSystem()); b.add("the_geom", Point.class); b.add(PFAF, String.class); b.add(LINKID, Integer.class); b.add(GAUKLER, Double.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); /*for each line generates the points geometries of the contained * vertexes with attributes -> it is assumed that the input network is * the output of the tool NetworkAttributesBuilder */ for( SimpleFeature netLineFeature : netList ) { int count = 1; Object pfaf = netLineFeature.getAttribute(PFAF); Geometry netLine = (Geometry) netLineFeature.getDefaultGeometry(); for( int i = 0; i < netLine.getNumGeometries(); i++ ) { LineString net = (LineString) netLine.getGeometryN(i); Coordinate[] coordinates = net.getCoordinates(); for( int j = 0; j < coordinates.length - 1; j++ ) { Point point = gf.createPoint(coordinates[j]); Object[] values = new Object[]{point, pfaf, count, pGauklerStrickler}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(null); outNetPointsFC.add(feature); count++; } } } outNetPoints = outNetPointsFC; }
Example 17
Source File: OmsGeopaparazzi3Converter.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
private void simpleNotesToShapefile( Connection connection, File outputFolderFile, IHMProgressMonitor pm ) throws Exception { File outputShapeFile = new File(outputFolderFile, "simplenotes.shp"); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("gpsimplenotes"); //$NON-NLS-1$ b.setCRS(crs); b.add("the_geom", Point.class); //$NON-NLS-1$ b.add("DESCR", String.class); b.add("TIMESTAMP", String.class); b.add("ALTIM", Double.class); SimpleFeatureType featureType = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType); pm.beginTask("Import simple notes...", -1); SimpleFeatureCollection newCollection = new DefaultFeatureCollection(); try (Statement statement = connection.createStatement()) { statement.setQueryTimeout(30); // set timeout to 30 sec. ResultSet rs = statement.executeQuery("select lat, lon, altim, ts, text, form from notes"); while( rs.next() ) { String form = rs.getString("form"); if (form != null && form.trim().length() != 0) { continue; } 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); Object[] values = new Object[]{point, text, dateTimeString, altim}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(null); ((DefaultFeatureCollection) newCollection).add(feature); } } finally { pm.done(); } dumpVector(newCollection, outputShapeFile.getAbsolutePath()); }
Example 18
Source File: OmsLinesPolygonizer.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
@Execute public void process() throws Exception { checkNull(inMap); outMap = new DefaultFeatureCollection(); EGeometryType geometryType = EGeometryType.forGeometryDescriptor(inMap.getSchema().getGeometryDescriptor()); switch( geometryType ) { case LINESTRING: case MULTILINESTRING: break; default: throw new ModelsIllegalargumentException("The module only works with line layers.", this, pm); } List<Geometry> linesList = FeatureUtilities.featureCollectionToGeometriesList(inMap, true, null); // Polygonization final Polygonizer polygonizer = new Polygonizer(); polygonizer.add(linesList); @SuppressWarnings("unchecked") final Collection<Polygon> polygonizedLines = polygonizer.getPolygons(); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("polygonized"); b.setCRS(inMap.getSchema().getCoordinateReferenceSystem()); b.add("the_geom", Polygon.class); b.add(fNewId, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); List<Geometry> pointGeometries = new ArrayList<Geometry>(); if (inPoints != null) { fId = FeatureUtilities.findAttributeName(inPoints.getSchema(), fId); pointGeometries = FeatureUtilities.featureCollectionToGeometriesList(inPoints, false, fId); } pm.beginTask("Generating polygon features...", polygonizedLines.size()); int index = 0; for( Polygon polygon : polygonizedLines ) { String attribute = String.valueOf(index++); if (inPoints != null) { attribute = "-"; for( Geometry point : pointGeometries ) { if (polygon.contains(point)) { attribute = point.getUserData().toString(); break; } } } Object[] values = new Object[]{polygon, attribute}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(null); ((DefaultFeatureCollection) outMap).add(feature); pm.worked(1); } pm.done(); }
Example 19
Source File: TmsShpGenerator.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
public static void main( String[] args ) throws Exception { String EPSG_MERCATOR = "EPSG:3857"; CoordinateReferenceSystem mercatorCrs = CrsUtilities.getCrsFromEpsg(EPSG_MERCATOR, null); double w = -180; double e = 180; double s = -90; double n = 90; int pMinzoom = 1; int pMaxzoom = 7; String folder = "/home/moovida/TMP/AAAAAAAAA_BM/mappe_x_android/outtiles/shps/"; GlobalMercator mercator = new GlobalMercator(); for( int z = pMinzoom; z <= pMaxzoom; z++ ) { DefaultFeatureCollection newCollection = new DefaultFeatureCollection(); // List<Geometry> g = new ArrayList<Geometry>(); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("typename"); b.setCRS(mercatorCrs); b.add("the_geom", Polygon.class); b.add("tms", String.class); b.add("google", String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); // get ul and lr tile number in GOOGLE tiles int[] llTileXY = mercator.GoogleTile(s, w, z); int[] urTileXY = mercator.GoogleTile(n, e, z); int startXTile = Math.min(llTileXY[0], urTileXY[0]); int endXTile = Math.max(llTileXY[0], urTileXY[0]); int startYTile = Math.min(llTileXY[1], urTileXY[1]); int endYTile = Math.max(llTileXY[1], urTileXY[1]); for( int i = startXTile; i <= endXTile; i++ ) { for( int j = startYTile; j <= endYTile; j++ ) { double[] bounds = mercator.TileBounds(i, j, z); double west = bounds[0]; double south = bounds[1]; double east = bounds[2]; double north = bounds[3]; Coordinate c1 = new Coordinate(west, south); Coordinate c2 = new Coordinate(west, north); Coordinate c3 = new Coordinate(east, north); Coordinate c4 = new Coordinate(east, south); Coordinate c5 = new Coordinate(west, south); Coordinate[] c = {c1, c2, c3, c4, c5}; Polygon p = gf.createPolygon(gf.createLinearRing(c), null); String google = z + "/" + i + "/" + j; int[] tmsTile = mercator.TMSTileFromGoogleTile(i, j, z); String tms = z + "/" + tmsTile[0] + "/" + tmsTile[1]; Object[] values = new Object[]{p, google, tms}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(null); newCollection.add(feature); } } String name = "tiles_" + z + ".shp"; OmsVectorWriter.writeVector(folder + name, newCollection); } }
Example 20
Source File: OmsHoughCirclesRaster.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
@Execute public void process() throws Exception { checkNull(inRaster, pMinRadius, pMaxRadius, pRadiusIncrement); if (pColorNv != null) { colorNv = pColorNv; useColorNv = true; } RegionMap regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inRaster); offx = 0; offy = 0; width = regionMap.getCols(); height = regionMap.getRows(); offset = width; xRes = regionMap.getXres(); radiusMinPixel = (int) round(width * pMinRadius / (regionMap.getEast() - regionMap.getWest())); radiusMaxPixel = (int) round(width * pMaxRadius / (regionMap.getEast() - regionMap.getWest()));; radiusIncPixel = (int) round(width * pRadiusIncrement / (regionMap.getEast() - regionMap.getWest())); if (radiusIncPixel < 1) { radiusIncPixel = 1; } maxCircles = pMaxCircleCount; depth = ((radiusMaxPixel - radiusMinPixel) / radiusIncPixel) + 1; Geometry[] circles = getCircles(); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("houghcircles"); b.setCRS(inRaster.getCoordinateReferenceSystem()); b.add("the_geom", Polygon.class); b.add("value", Double.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); DefaultFeatureCollection outFC = new DefaultFeatureCollection(); for( Geometry geometry : circles ) { Object[] values = new Object[]{geometry, referenceImageValue}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(null); outFC.add(feature); } outCircles = outFC; }