Example usage for com.mongodb.client.model.geojson GeometryCollection getGeometries

List of usage examples for com.mongodb.client.model.geojson GeometryCollection getGeometries

Introduction

In this page you can find the example usage for com.mongodb.client.model.geojson GeometryCollection getGeometries.

Prototype

public List<? extends Geometry> getGeometries() 

Source Link

Document

Gets the list of Geometry objects in this collection.

Usage

From source file:com.bc.fiduceo.db.MongoDbDriver.java

License:Open Source License

private static com.mongodb.client.model.geojson.Geometry convertGeometryCollectionToGeoJSON(
        GeometryCollection geometryCollection) {
    final Geometry[] geometries = geometryCollection.getGeometries();
    if (geometries.length == 1) {
        return convertToGeoJSON(geometries[0]);
    }//w  ww . j  a  v a  2  s. co m

    final List<com.mongodb.client.model.geojson.Geometry> geometryList = new ArrayList<>();
    for (final Geometry geometry : geometries) {
        geometryList.add(convertToGeoJSON(geometry));
    }
    return new com.mongodb.client.model.geojson.GeometryCollection(geometryList);
}