Java Code Examples for org.geotools.geometry.jts.ReferencedEnvelope#centre()

The following examples show how to use org.geotools.geometry.jts.ReferencedEnvelope#centre() . 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: RasterizedSpatialiteLasLayer.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
public RasterizedSpatialiteLasLayer( String title, ASpatialDb db, Integer tileSize, boolean transparentBackground,
        boolean doIntensity ) throws Exception {
    super(makeLevels(title, tileSize, transparentBackground, db, doIntensity));
    String plus = doIntensity ? INTENSITY : ELEVATION;
    this.layerName = title + " " + plus;
    this.setUseTransparentTextures(true);

    try {
        Envelope tableBounds = db.getTableBounds(LasSourcesTable.TABLENAME);
        GeometryColumn spatialiteGeometryColumns = db.getGeometryColumnsForTable(LasCellsTable.TABLENAME);
        CoordinateReferenceSystem dataCrs = CRS.decode("EPSG:" + spatialiteGeometryColumns.srid);
        CoordinateReferenceSystem targetCRS = DefaultGeographicCRS.WGS84;
        ReferencedEnvelope env = new ReferencedEnvelope(tableBounds, dataCrs);
        ReferencedEnvelope envLL = env.transform(targetCRS, true);

        centre = envLL.centre();
    } catch (Exception e) {
        e.printStackTrace();
        centre = CrsUtilities.WORLD.centre();
    }
}
 
Example 2
Source File: FeatureCollectionPointsLayer.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Coordinate getCenter() {
    try {
        ReferencedEnvelope bounds = getfeatureCollection().getBounds();
        return bounds.centre();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return new Coordinate(0, 0);
}
 
Example 3
Source File: FeatureCollectionLinesLayer.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Coordinate getCenter() {
    try {
        ReferencedEnvelope bounds = getfeatureCollection().getBounds();
        return bounds.centre();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return new Coordinate(0, 0);
}
 
Example 4
Source File: FeatureCollectionPolygonLayer.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Coordinate getCenter() {
    try {
        ReferencedEnvelope bounds = getfeatureCollection().getBounds();
        return bounds.centre();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return new Coordinate(0, 0);
}