use of org.geotools.gce.geotiff.GeoTiffReader in project OpenTripPlanner by opentripplanner.
the class GeotiffGridCoverageFactoryImpl method getGridCoverage.
@Override
public GridCoverage2D getGridCoverage() {
try {
// There is a serious standardization failure around the axis order of WGS84. See issue #1930.
// GeoTools assumes strict EPSG axis order of (latitude, longitude) unless told otherwise.
// Both NED and SRTM data use the longitude-first axis order, so OTP makes grid coverages
// for unprojected DEMs assuming coordinates are in (longitude, latitude) order.
Hints forceLongLat = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
GeoTiffFormat format = new GeoTiffFormat();
GeoTiffReader reader = format.getReader(path, forceLongLat);
coverage = reader.read(null);
LOG.info("Elevation model CRS is: {}", coverage.getCoordinateReferenceSystem2D());
} catch (IOException e) {
throw new RuntimeException("Error getting coverage automatically. ", e);
}
return coverage;
}
Aggregations