I am trying to figure out how to display a rotated grid correctly with GeoServer with using the affine transformation in WKT as described here: Defining coordinate reference system with rotation in GeoServer?
I am getting the affine parameters by using the Affine.rotation
function within Python. However the images is cropped and the georeferencing isn't correct afterwards.
Affine parameters used:
affine=Affine.rotation(58.0)# angle in degrees
elt_0_0=affine.a
elt_0_1=affine.b
elt_0_2=918079.626281209 #X Value of lower left Coordinate which is also the rotation point
elt_1_0=affine.d
elt_1_1=affine.e
elt_1_2=6445039.217828758 #Y Value of lower left Coordinate which is also the rotation point
Original Image:
Current result with affine transformation:
The Raster should be rotated like this with maintaining its actual size:
The lower left corner of this raster should have the coordinates as mentioned above and are already known. The Size of the "real" raster image (containing value data) should be maintained (2000m*1200m)
This is the currently used WKT String:
FITTED_CS["BPAF",
PARAM_MT["Affine",
PARAMETER["num_row", 3],
PARAMETER["num_col", 3],
PARAMETER["elt_0_0",0.5299192642332049],
PARAMETER["elt_0_1", -0.848048096156426],
PARAMETER["elt_0_2", 918079.626281209],
PARAMETER["elt_1_0", 0.848048096156426],
PARAMETER["elt_1_1", 0.5299192642332049],
PARAMETER["elt_1_2", 6445039.217828758]],
PROJCS["WGS84 / Google Mercator",
GEOGCS["WGS 84",
DATUM["World Geodetic System 1984",
SPHEROID["WGS 84", 6378137.0, 298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich", 0.0,
AUTHORITY["EPSG","8901"]],
UNIT["degree", 0.017453292519943295],
AXIS["Longitude", EAST],
AXIS["Latitude", NORTH],
AUTHORITY["EPSG","4326"]],
PROJECTION["Mercator_1SP"],
PARAMETER["semi_minor", 6378137.0],
PARAMETER["latitude_of_origin", 0.0],
PARAMETER["central_meridian", 0.0],
PARAMETER["scale_factor", 1.0],
PARAMETER["false_easting", 0.0],
PARAMETER["false_northing", 0.0],
UNIT["m", 1.0],
AXIS["x", EAST],
AXIS["y", NORTH],
AUTHORITY["EPSG","900913"]],
AUTHORITY["EPSG","8011113"]]
The Bounding Box Values had not been changed, the Lat/Lon Bounding Box coordinates are not correct whithout reprojection:
When declaring a reprojection from EPSG:8011113 to EPSG:900913 the Lat/Lon values are correct:
However, after the reprojection the raster can't be displayed:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" > <ServiceException>
java.io.IOException: Failed to create reader from file:data/NetCDF/test/test.nc and hints Hints:
GRID_COVERAGE_FACTORY = GridCoverageFactory
TILE_ENCODING = null
STYLE_FACTORY = StyleFactoryImpl
REPOSITORY = org.geoserver.catalog.CatalogRepository@89dd00
FORCE_LONGITUDE_FIRST_AXIS_ORDER = true
FORCE_AXIS_ORDER_HONORING = http
EXECUTOR_SERVICE = java.util.concurrent.ThreadPoolExecutor@d14e79e[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
FEATURE_FACTORY = org.geotools.feature.LenientFeatureFactoryImpl@3bfc6a5e
LENIENT_DATUM_SHIFT = true
COMPARISON_TOLERANCE = 1.0E-8
FILTER_FACTORY = FilterFactoryImpl
Failed to create reader from file:data/NetCDF/test/test.nc and hints Hints:
GRID_COVERAGE_FACTORY = GridCoverageFactory
TILE_ENCODING = null
STYLE_FACTORY = StyleFactoryImpl
REPOSITORY = org.geoserver.catalog.CatalogRepository@89dd00
FORCE_LONGITUDE_FIRST_AXIS_ORDER = true
FORCE_AXIS_ORDER_HONORING = http
EXECUTOR_SERVICE = java.util.concurrent.ThreadPoolExecutor@d14e79e[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
FEATURE_FACTORY = org.geotools.feature.LenientFeatureFactoryImpl@3bfc6a5e
LENIENT_DATUM_SHIFT = true
COMPARISON_TOLERANCE = 1.0E-8
FILTER_FACTORY = FilterFactoryImpl
</ServiceException></ServiceExceptionReport>