Java Code Examples for org.opengis.feature.simple.SimpleFeature

The following examples show how to use org.opengis.feature.simple.SimpleFeature. These examples are extracted from open source projects. 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 Project: snap-desktop   Source File: FeatureLayer.java    License: GNU General Public License v3.0 6 votes vote down vote up
public FeatureLayer(LayerType layerType, final FeatureCollection<SimpleFeatureType, SimpleFeature> fc,
                    PropertySet configuration) {
    super(layerType, configuration);
    crs = fc.getSchema().getGeometryDescriptor().getCoordinateReferenceSystem();
    if (crs == null) {
        // todo - check me! Why can this happen??? (nf)
        crs = DefaultGeographicCRS.WGS84;
    }
    final ReferencedEnvelope envelope = new ReferencedEnvelope(fc.getBounds(), crs);
    modelBounds = new Rectangle2D.Double(envelope.getMinX(), envelope.getMinY(),
                                         envelope.getWidth(), envelope.getHeight());
    mapContext = new DefaultMapContext(crs);
    final Style style = (Style) configuration.getValue(FeatureLayerType.PROPERTY_NAME_SLD_STYLE);
    mapContext.addLayer(fc, style);
    renderer = new StreamingRenderer();
    workaroundLabelCacheBug();
    style.accept(new RetrievingStyleVisitor());
    renderer.setContext(mapContext);

}
 
Example 2
Source Project: geowave   Source File: QueryIndexHelper.java    License: Apache License 2.0 6 votes vote down vote up
private static TemporalRange getStatsRange(
    final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
    final AttributeDescriptor attr) {
  final TemporalRange timeRange = new TemporalRange();
  if (attr != null) {
    final TimeRangeDataStatistics stat =
        ((TimeRangeDataStatistics) statsMap.get(
            VectorStatisticsQueryBuilder.newBuilder().factory().timeRange().fieldName(
                attr.getLocalName()).build().getId()));
    if (stat != null) {
      timeRange.setStartTime(new Date(stat.getMin()));
      timeRange.setEndTime(new Date(stat.getMax()));
    }
  }
  return timeRange;
}
 
Example 3
public void write(SimpleFeatureCollection obj, OutputStream output) throws IOException {
	SimpleFeatureIterator it = obj.features();

	PrintStream printStream = new PrintStream(output);

	while (it.hasNext()) {
		SimpleFeature ft = it.next();
		printStream.print(ft.getID() + " [");
		boolean first = true;
		for (AttributeDescriptor ad : ft.getType().getAttributeDescriptors()) {
			if (!first) {
				printStream.print(", ");
			}
			printStream.print(ad.getLocalName() + ": " + ft.getAttribute(ad.getName()));
			first = false;
		}
		printStream.println("]");
	}

}
 
Example 4
@SuppressWarnings("nls")
public void testVectorFilter() throws Exception {
    SimpleFeatureCollection testFC = HMTestMaps.getTestFC();
    OmsVectorFilter filter = new OmsVectorFilter();
    filter.inVector = testFC;
    filter.pCql = "cat > 2";
    filter.process();
    SimpleFeatureCollection outFC = filter.outVector;

    assertTrue(outFC.size() == 1);

    FeatureIterator<SimpleFeature> featureIterator = outFC.features();
    SimpleFeature feature = featureIterator.next();
    assertNotNull(feature);

    Integer attribute = (Integer) feature.getAttribute("cat");
    assertEquals(3, attribute.intValue());
    featureIterator.close();

}
 
Example 5
@SuppressWarnings("nls")
public void testFeatureUtils() throws Exception {
    SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
    b.setName("typename");
    b.setCRS(DefaultGeographicCRS.WGS84);
    b.add("the_geom", Point.class);
    b.add("AttrName", String.class);
    SimpleFeatureType type = b.buildFeatureType();
    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
    Object[] values = new Object[]{GeometryUtilities.gf().createPoint(new Coordinate(0, 0)), "test"};
    builder.addAll(values);
    SimpleFeature feature = builder.buildFeature(type.getTypeName());

    Object attr = FeatureUtilities.getAttributeCaseChecked(feature, "attrname");
    assertEquals("test", attr.toString());
    attr = FeatureUtilities.getAttributeCaseChecked(feature, "attrnam");
    assertNull(attr);
}
 
Example 6
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 7
Source Project: geowave   Source File: TimeUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static Interval getInterval(final SimpleFeature entry, final String fieldName) {

    final Object o = entry.getAttribute(fieldName);
    final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    if (o == null) {
      return null;
    }
    if (o instanceof Date) {
      c.setTime((Date) o);
    } else if (o instanceof Calendar) {
      c.setTime(c.getTime());
    } else if (o instanceof Number) {
      c.setTimeInMillis(((Number) o).longValue());
    }
    final Instant time = Instant.ofEpochMilli(c.getTimeInMillis());
    return Interval.of(time, time);
  }
 
Example 8
Source Project: geowave   Source File: AbstractTransactionManagement.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> getDataStatistics() {
  final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> stats = new HashMap<>();
  final GeotoolsFeatureDataAdapter adapter = components.getAdapter();
  final short internalAdapterId =
      components.getGTstore().getInternalAdapterStore().getAdapterId(adapter.getTypeName());

  try (CloseableIterator<InternalDataStatistics<?, ?, ?>> it =
      components.getStatsStore().getDataStatistics(internalAdapterId, composeAuthorizations())) {
    while (it.hasNext()) {
      final InternalDataStatistics<?, ?, ?> stat = it.next();
      stats.put(
          new StatisticsId(stat.getType(), stat.getExtendedId()),
          (InternalDataStatistics<SimpleFeature, ?, ?>) stat);
    }

  } catch (final Exception e) {
    GeoWaveTransactionManagement.LOGGER.error("Failed to access statistics from data store", e);
  }
  return stats;
}
 
Example 9
Source Project: geowave   Source File: SimpleFeatureCentroidExractorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void test() throws SchemaException {
  final SimpleFeatureType schema =
      DataUtilities.createType("testGeo", "location:Point:srid=4326,name:String");
  final List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
  final Object[] defaults = new Object[descriptors.size()];
  int p = 0;
  for (final AttributeDescriptor descriptor : descriptors) {
    defaults[p++] = descriptor.getDefaultValue();
  }

  final SimpleFeature feature =
      SimpleFeatureBuilder.build(schema, defaults, UUID.randomUUID().toString());
  final GeometryFactory geoFactory = new GeometryFactory();

  feature.setAttribute("location", geoFactory.createPoint(new Coordinate(-45, 45)));

  final Point point = extractor.getCentroid(feature);
  assertEquals(4326, point.getSRID());
}
 
Example 10
Source Project: geowave   Source File: SplitsProviderIT.java    License: Apache License 2.0 6 votes vote down vote up
private void ingestWithDistribution(final Distribution distr) {
  final DataStore dataStore = dataStorePluginOptions.createDataStore();
  dataStore.addType(fda, idx);
  try (final Writer<SimpleFeature> writer = dataStore.createWriter(fda.getTypeName())) {

    switch (distr) {
      case UNIFORM:
        createUniformFeatures(new SimpleFeatureBuilder(sft), writer, 100000);
        break;
      case BIMODAL:
        createBimodalFeatures(new SimpleFeatureBuilder(sft), writer, 400000);
        break;
      case SKEWED:
      default:
        createSkewedFeatures(new SimpleFeatureBuilder(sft), writer, 700000);
        break;
    }
  }
}
 
Example 11
Source Project: geowave   Source File: BoundaryPartitioner.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public List<PartitionData> getCubeIdentifiers(final Object entry) {
  final Geometry geom = extractor.getGeometry((SimpleFeature) entry);
  final Coordinate[] coords = (geom.getCoordinates());
  System.out.println(geom.toString());
  if (coords.length < 2) {
    return super.getCubeIdentifiers(geom);
  } else {
    final List<PartitionData> r = new ArrayList<>();
    for (int i = 0; i < (coords.length - 1); i++) {
      r.addAll(
          super.getCubeIdentifiers(
              geom.getFactory().createLineString(new Coordinate[] {coords[i], coords[i + 1]})));
    }
    return r;
  }
}
 
Example 12
Source Project: rya   Source File: GeoMesaGeoIndexer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void storeStatements(final Collection<RyaStatement> ryaStatements) throws IOException {
    // create a feature collection
    final DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
    for (final RyaStatement ryaStatement : ryaStatements) {
        final Statement statement = RyaToRdfConversions.convertStatement(ryaStatement);
        // if the predicate list is empty, accept all predicates.
        // Otherwise, make sure the predicate is on the "valid" list
        final boolean isValidPredicate = validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate());

        if (isValidPredicate && (statement.getObject() instanceof Literal)) {
            try {
                final SimpleFeature feature = createFeature(featureType, statement);
                featureCollection.add(feature);
            } catch (final ParseException e) {
                logger.warn("Error getting geo from statement: " + statement.toString(), e);
            }
        }
    }

    // write this feature collection to the store
    if (!featureCollection.isEmpty()) {
        featureStore.addFeatures(featureCollection);
    }
}
 
Example 13
public Coordinate[] getCoordinates() {
    Coordinate[] coordinates = new Coordinate[coordinateTableModel.getRowCount()];
    for (int i = 0; i < coordinateTableModel.getRowCount(); i++) {
        final Placemark placemark = coordinateTableModel.getPlacemarkAt(i);
        SimpleFeature feature = placemark.getFeature();
        final Date dateTime = (Date) feature.getAttribute(Placemark.PROPERTY_NAME_DATETIME);
        final Coordinate.OriginalValue[] originalValues = PixExOp.getOriginalValues(feature);
        if (placemark.getGeoPos() == null) {
            final Point point = (Point) feature.getDefaultGeometry();
            coordinates[i] = new Coordinate(placemark.getName(), point.getY(), point.getX(),
                                            dateTime, originalValues);
        } else {
            coordinates[i] = new Coordinate(placemark.getName(), placemark.getGeoPos().getLat(),
                                            placemark.getGeoPos().getLon(), dateTime, originalValues);
        }
    }
    return coordinates;
}
 
Example 14
Source Project: geowave   Source File: QueryIndexHelperTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testBBOXStatReprojection() {

  // create a EPSG:3785 feature (units in meters)
  final SimpleFeature mercFeat =
      createGeoMercFeature(factory.createPoint(new Coordinate(19971868.8804, 20037508.3428)));

  // convert from EPSG:3785 to EPSG:4326 (convert to degrees lon/lat)
  // approximately 180.0, 85.0
  final SimpleFeature defaultCRSFeat = GeometryUtils.crsTransform(mercFeat, geoType, transform);

  final FeatureBoundingBoxStatistics geoStats =
      new FeatureBoundingBoxStatistics("geometry", geoType, transform);

  geoStats.entryIngested(mercFeat);

  final Coordinate coord = ((Point) defaultCRSFeat.getDefaultGeometry()).getCoordinate();

  // coordinate should match reprojected feature
  assertEquals(coord.x, geoStats.getMinX(), 0.0001);
  assertEquals(coord.x, geoStats.getMaxX(), 0.0001);
  assertEquals(coord.y, geoStats.getMinY(), 0.0001);
  assertEquals(coord.y, geoStats.getMaxY(), 0.0001);
}
 
Example 15
Source Project: snap-desktop   Source File: ShapefileLoader.java    License: GNU General Public License v3.0 5 votes vote down vote up
private FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatureCollection(File file) throws IOException {
    Object featureCollectionValue = context.getPropertyValue(ShapefileLayerSource.PROPERTY_NAME_FEATURE_COLLECTION);
    FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection;
    if (featureCollectionValue == null) {
        featureCollection = FeatureUtils.getFeatureSource(file.toURI().toURL()).getFeatures();
    } else {
        featureCollection = (FeatureCollection<SimpleFeatureType, SimpleFeature>) featureCollectionValue;
    }
    return featureCollection;
}
 
Example 16
private List<Feature> getGmlFeatures(InputStream stream, Version version) throws IOException, SAXException,
		ParserConfigurationException {
	List<Feature> features = new ArrayList<Feature>();
	GML gml = new GML(version);
	FeatureCollection<?, SimpleFeature> collection = gml.decodeFeatureCollection(stream);
	FeatureIterator<SimpleFeature> it = collection.features();

	while (it.hasNext()) {
		features.add(toDto(it.next()));
	}
	return features;
}
 
Example 17
Source Project: geowave   Source File: CustomIndexExample.java    License: Apache License 2.0 5 votes vote down vote up
private SimpleFeature buildSimpleFeature(
    final String featureId,
    final Coordinate coordinate,
    final String uuid) {

  final SimpleFeatureBuilder builder = new SimpleFeatureBuilder(simpleFeatureType);
  builder.set("geometry", GeometryUtils.GEOMETRY_FACTORY.createPoint(coordinate));
  builder.set("uuid", uuid);

  return builder.buildFeature(featureId);
}
 
Example 18
/**
 * Extracts features from a {@link FeatureCollection} into an {@link STRtree}.
 * 
 * @param collection the feature collection.
 * @return the tree containing the features.
 */
public static STRtree featureCollectionToSTRtree( SimpleFeatureCollection collection ) {
    STRtree tree = new STRtree();
    SimpleFeatureIterator featureIterator = collection.features();
    while( featureIterator.hasNext() ) {
        SimpleFeature feature = featureIterator.next();
        Geometry geometry = (Geometry) feature.getDefaultGeometry();
        tree.insert(geometry.getEnvelopeInternal(), feature);
    }
    featureIterator.close();
    return tree;
}
 
Example 19
@Override
public SimpleFeature getFeatureById(Object fetureProviderEndPoint, String layerName, Map parameters) {
	FeatureCollection featureCollection;

	String wfsUrl = null;
	String geoIdPName = null;
	String geoIdPValue = null;

	logger.debug("IN");

	try {
		wfsUrl = (String) fetureProviderEndPoint;

		geoIdPName = (String) parameters.get(GEOID_PNAME);
		logger.debug("Parameter [" + GEOID_PNAME + "] is equal to [" + geoIdPName + "]");

		geoIdPValue = (String) parameters.get(GEOID_PVALUE);
		logger.debug("Parameter [" + GEOID_PVALUE + "] is equal to [" + geoIdPValue + "]");

		wfsUrl += "?request=GetFeature" + "&typename=" + layerName + "&Filter=<Filter><PropertyIsEqualTo><PropertyName>" + geoIdPName
				+ "</PropertyName><Literal>" + geoIdPValue + "</Literal></PropertyIsEqualTo></Filter>" + "&outputformat=json" + "&version=1.0.0";

		featureCollection = getFeatures(wfsUrl);
	} catch (Throwable t) {
		throw new SpagoBIRuntimeException("An unexpected error occured while executing service call [" + wfsUrl + "]", t);
	} finally {
		logger.debug("OUT");
	}

	return (SimpleFeature) featureCollection.features().next();
}
 
Example 20
Source Project: geowave   Source File: GeoWaveGTPluginUtils.java    License: Apache License 2.0 5 votes vote down vote up
protected static List<InternalDataStatistics<SimpleFeature, ?, ?>> getStatsFor(
    final String name,
    final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap) {
  final List<InternalDataStatistics<SimpleFeature, ?, ?>> stats = new LinkedList<>();
  for (final Map.Entry<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> stat : statsMap.entrySet()) {
    if ((stat.getValue() instanceof FieldNameStatistic)
        && ((FieldNameStatistic) stat.getValue()).getFieldName().endsWith(name)) {
      stats.add(stat.getValue());
    }
  }
  return stats;
}
 
Example 21
@Test
public void testDefaultMaxFeatures() throws Exception {
    init();
    dataStore.setDefaultMaxFeatures(2);
    Query q = new Query();
    List<SimpleFeature> features = readFeatures(featureSource.getFeatures(q).features());
    assertEquals(2, features.size());
}
 
Example 22
@Test
@Ignore
public void testRead() throws Exception {
	System.out.println("Start : " + new Date());
	int count;
	for (Iterator<?> it = layer.getElements(Filter.INCLUDE, 0, 2); it.hasNext();) {
		SimpleFeature sf = (SimpleFeature) it.next();
		System.out.println(sf.getID());
	}

	System.out.println("Stop : " + new Date());
}
 
Example 23
@Test
public void testIntersectsFilter() throws Exception {
	Geometry geom = (Geometry) ((SimpleFeature) layer.read("filtertest.1")).getDefaultGeometry();
	Filter filter = filterCreator.createIntersectsFilter(geom, "the_geom");
	Iterator<?> it = layer.getElements(filter, 0, 0);

	int t = 0;
	while (it.hasNext()) {
		it.next();
		t++;
	}
	Assert.assertEquals(6, t);
}
 
Example 24
Source Project: geowave   Source File: SimpleFeatureItemWrapperFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public AnalyticItemWrapper<SimpleFeature> createNextItem(
    final SimpleFeature feature,
    final String groupID,
    final Coordinate coordinate,
    final String[] extraNames,
    final double[] extraValues) {
  final Geometry geometry =
      (Geometry) feature.getAttribute(ClusterFeatureAttribute.GEOMETRY.attrName());

  return new SimpleFeatureAnalyticItemWrapper(
      AnalyticFeature.createGeometryFeature(
          feature.getFeatureType(),
          feature.getAttribute(ClusterFeatureAttribute.BATCH_ID.attrName()).toString(),
          UUID.randomUUID().toString(),
          getAttribute(feature, ClusterFeatureAttribute.NAME.attrName()),
          groupID,
          ((Double) feature.getAttribute(
              ClusterFeatureAttribute.WEIGHT.attrName())).doubleValue(),
          geometry.getFactory().createPoint(coordinate),
          extraNames,
          extraValues,
          ((Integer) feature.getAttribute(
              ClusterFeatureAttribute.ZOOM_LEVEL.attrName())).intValue(),
          ((Integer) feature.getAttribute(
              ClusterFeatureAttribute.ITERATION.attrName())).intValue() + 1,
          ((Long) feature.getAttribute(ClusterFeatureAttribute.COUNT.attrName())).longValue()));
}
 
Example 25
@Test
public void testRead() throws GeomajasException {
	Iterator<?> it = pointLayer.getElements(Filter.INCLUDE, 0, 0);
	Map<String, SimpleFeature> all = new HashMap<String, SimpleFeature>();
	while (it.hasNext()) {
		SimpleFeature f = (SimpleFeature) it.next();
		all.put(f.getID(), f);
	}
	Assert.assertEquals(4, all.size());
	for (int i = 1; i <= 4; i++) {
		Assert.assertEquals("point" + i, all.get("POINT." + i).getAttribute("NAME"));
	}
}
 
Example 26
Source Project: geowave   Source File: NNMapReduceTest.java    License: Apache License 2.0 5 votes vote down vote up
private SimpleFeature createTestFeature(final Coordinate coord) {
  return AnalyticFeature.createGeometryFeature(
      ftype,
      "b1",
      UUID.randomUUID().toString(),
      "fred",
      "NA",
      20.30203,
      factory.createPoint(coord),
      new String[] {"extra1"},
      new double[] {0.022},
      1,
      1,
      0);
}
 
Example 27
Source Project: geowave   Source File: SceneFeatureIteratorTest.java    License: Apache License 2.0 5 votes vote down vote up
private Matcher<SimpleFeature> inBounds(final BoundingBox bounds) {
  return new BaseMatcher<SimpleFeature>() {
    @Override
    public boolean matches(final Object item) {
      final SimpleFeature feature = (SimpleFeature) item;
      return feature.getBounds().intersects(bounds);
    }

    @Override
    public void describeTo(final Description description) {
      description.appendText("feature should be in bounds " + bounds);
    }
  };
}
 
Example 28
private void withSubjects(FeatureReader<SimpleFeatureType, SimpleFeature> featureReader, DataStore dataStore, BiConsumer<SimpleFeature, Subject> fn) throws IOException, FactoryException, TransformException {
    MathTransform crsTransform = GeotoolsDataStoreUtils.makeCrsTransform(getSourceEncoding());

    while(featureReader.hasNext()) {
        SimpleFeature feature = featureReader.next();
        buildSubjectFromFeature(feature, crsTransform).ifPresent(subject -> {
            fn.accept(feature, subject);
            subjectBuffer.add(subject);
        });
        flushBufferIfRequired();
    }

    flushBuffer();
}
 
Example 29
Source Project: geowave   Source File: VectorExportMapper.java    License: Apache License 2.0 5 votes vote down vote up
private void writeRemainingAvroBatches(
    final Mapper<GeoWaveInputKey, SimpleFeature, AvroKey<AvroSimpleFeatureCollection>, NullWritable>.Context context)
    throws IOException, InterruptedException {
  for (final AvroSFCWriter writer : adapterIdToAvroWriterMap.values()) {
    if (writer.avList.size() > 0) {
      writer.simpleFeatureCollection.setSimpleFeatureCollection(writer.avList);
      outKey.datum(writer.simpleFeatureCollection);
      context.write(outKey, outVal);
    }
  }
}
 
Example 30
Source Project: geowave   Source File: GeometryDataSetGenerator.java    License: Apache License 2.0 5 votes vote down vote up
private SimpleFeature createNewFeature(final double[] minAxis, final double[] maxAxis) {

    final int dims = coordSystem.getDimension();

    // HP Fortify "Insecure Randomness" false positive
    // This random number is not used for any purpose
    // related to security or cryptography
    final int shapeSize = includePolygons ? (rand.nextInt(Integer.MAX_VALUE) % 5) + 1 : 1;
    final Coordinate[] shape = new Coordinate[shapeSize > 2 ? shapeSize + 1 : shapeSize];
    final double[] constrainedMaxAxis = Arrays.copyOf(maxAxis, maxAxis.length);
    final double[] constrainedMinAxis = Arrays.copyOf(minAxis, minAxis.length);
    for (int s = 0; s < shapeSize; s++) {
      final Coordinate coordinate = new Coordinate();
      for (int i = 0; i < dims; i++) {
        // HP Fortify "Insecure Randomness" false positive
        // This random number is not used for any purpose
        // related to security or cryptography
        coordinate.setOrdinate(
            i,
            constrainedMinAxis[i]
                + (rand.nextDouble() * (constrainedMaxAxis[i] - constrainedMinAxis[i])));
      }
      shape[s] = coordinate;
      if (s == 0) {
        constrain(coordinate, constrainedMaxAxis, constrainedMinAxis);
      }
    }
    if (shapeSize > 2) {
      shape[shapeSize] = shape[0];
      return createFeatureWithGeometry(geoFactory.createLinearRing(shape).convexHull());
    } else if (shapeSize == 2) {
      return createFeatureWithGeometry(geoFactory.createLineString(shape));
    } else {
      return createFeatureWithGeometry(geoFactory.createPoint(shape[0]));
    }
  }