Search in sources :

Example 1 with Envelope

use of com.vividsolutions.jts.geom.Envelope in project ignite by apache.

the class GridH2SpatialIndex method getEnvelope.

/**
 * @param row Row.
 * @param rowId Row id.
 * @return Envelope.
 */
private SpatialKey getEnvelope(SearchRow row, long rowId) {
    Value v = row.getValue(columnIds[0]);
    Geometry g = ((ValueGeometry) v.convertTo(Value.GEOMETRY)).getGeometry();
    Envelope env = g.getEnvelopeInternal();
    return new SpatialKey(rowId, (float) env.getMinX(), (float) env.getMaxX(), (float) env.getMinY(), (float) env.getMaxY());
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) ValueGeometry(org.h2.value.ValueGeometry) SpatialKey(org.h2.mvstore.rtree.SpatialKey) ValueGeometry(org.h2.value.ValueGeometry) Value(org.h2.value.Value) Envelope(com.vividsolutions.jts.geom.Envelope)

Example 2 with Envelope

use of com.vividsolutions.jts.geom.Envelope in project ddf by codice.

the class WfsFilterDelegate method createEnvelopeFromWkt.

private Envelope createEnvelopeFromWkt(String wkt) {
    Envelope envelope = null;
    try {
        Geometry geo = getGeometryFromWkt(wkt);
        envelope = geo.getEnvelopeInternal();
    } catch (ParseException e) {
        throw new IllegalArgumentException("Unable to parse WKT String", e);
    }
    return envelope;
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) ParseException(com.vividsolutions.jts.io.ParseException) Envelope(com.vividsolutions.jts.geom.Envelope)

Example 3 with Envelope

use of com.vividsolutions.jts.geom.Envelope in project ddf by codice.

the class WfsFilterDelegate method createCoordinatesTypeFromWkt.

private JAXBElement<CoordinatesType> createCoordinatesTypeFromWkt(String wkt) {
    Envelope envelope = createEnvelopeFromWkt(wkt);
    String coords = buildCoordinateString(envelope);
    CoordinatesType coordinatesType = new CoordinatesType();
    coordinatesType.setValue(coords);
    return gmlObjectFactory.createCoordinates(coordinatesType);
}
Also used : LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) Envelope(com.vividsolutions.jts.geom.Envelope) CoordinatesType(ogc.schema.opengis.gml.v_2_1_2.CoordinatesType)

Example 4 with Envelope

use of com.vividsolutions.jts.geom.Envelope in project GeoGig by boundlessgeo.

the class GeogigSimpleFeature method getAttribute.

@Override
public Object getAttribute(int index) throws IndexOutOfBoundsException {
    if (node != null && index == defaultGeomIndex && defaultGeomIsPoint && (resolvedValues == null || resolvedValues instanceof ImmutableList)) {
        Envelope e = new Envelope();
        node.expand(e);
        if (e.isNull()) {
            return null;
        }
        return DEFAULT_GEOM_FACTORY.createPoint(new Coordinate(e.getMinX(), e.getMinY()));
    }
    return getValues().get(index).orNull();
}
Also used : Coordinate(com.vividsolutions.jts.geom.Coordinate) ImmutableList(com.google.common.collect.ImmutableList) ReferencedEnvelope(org.geotools.geometry.jts.ReferencedEnvelope) Envelope(com.vividsolutions.jts.geom.Envelope)

Example 5 with Envelope

use of com.vividsolutions.jts.geom.Envelope in project GeoGig by boundlessgeo.

the class DiffTreeTest method feature.

private Node feature(int i, ObjectId oid) {
    String name = String.valueOf(i);
    TYPE type = TYPE.FEATURE;
    Envelope bounds = new Envelope(i, i, i, i);
    return Node.create(name, oid, metadataId, type, bounds);
}
Also used : ReferencedEnvelope(org.geotools.geometry.jts.ReferencedEnvelope) Envelope(com.vividsolutions.jts.geom.Envelope) TYPE(org.locationtech.geogig.api.RevObject.TYPE)

Aggregations

Envelope (com.vividsolutions.jts.geom.Envelope)111 Coordinate (com.vividsolutions.jts.geom.Coordinate)21 Node (org.locationtech.geogig.api.Node)16 Geometry (com.vividsolutions.jts.geom.Geometry)13 ObjectId (org.locationtech.geogig.api.ObjectId)13 ReferencedEnvelope (org.geotools.geometry.jts.ReferencedEnvelope)12 STRtree (com.vividsolutions.jts.index.strtree.STRtree)11 ArrayList (java.util.ArrayList)11 Vertex (org.opentripplanner.routing.graph.Vertex)11 Test (org.junit.Test)9 NodeRef (org.locationtech.geogig.api.NodeRef)9 Edge (org.opentripplanner.routing.graph.Edge)9 LineString (com.vividsolutions.jts.geom.LineString)8 RevTree (org.locationtech.geogig.api.RevTree)8 TransitStop (org.opentripplanner.routing.vertextype.TransitStop)7 Map (java.util.Map)6 RevFeatureType (org.locationtech.geogig.api.RevFeatureType)6 StreetEdge (org.opentripplanner.routing.edgetype.StreetEdge)6 RevFeature (org.locationtech.geogig.api.RevFeature)5 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)5