2

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:

original image

Current result with affine transformation:

Current Result

The Raster should be rotated like this with maintaining its actual size:

desired result

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:

enter image description here

When declaring a reprojection from EPSG:8011113 to EPSG:900913 the Lat/Lon values are correct:

Bounding Box with reprojection

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>
  • what did you set the bounding box to? – Ian Turton Mar 11 at 8:19
  • You mean in the geoserver Settings? Native Bounding Box Min X 918.079,625 Min Y 6.445.039 Max X 920.079,625 Max Y 6.446.239 Those Values refer to EPSG:900913 The Lat/Lon Bounding Box coordinates are not correct: Min X -40,9167389547673 Min Y 37,139289543793076 Max X -40,898420235646235 Max Y 37,15598775147418 When declaring a reprojection from EPSG:8011113 to EPSG:900913 they are correct: Min X 8,247249591762188 Min Y 49,99285762873216 Max X 8,265215897444577 Max Y 49,99978726994185 However afterwards the raster can't be displayed anymore – Elias Mar 11 at 12:01
  • 1
    please use the edit button to update your question – Ian Turton Mar 11 at 12:05
0

fixed by editing the code from this topic: Using customized Coordinate System in ArcGIS Desktop?

My used grid_mapping:

def addGridMappingVars(var,locationLat,locationLon,rotation):
    var.grid_mapping_name= "mercator"
    var.standard_parallel= 0.0
    var._CoordinateTransformType= "Projection"
    var._CoordinateAxisTypes= "GeoX GeoY"
    var.spatial_ref= 'PROJCS["Hotine_Oblique_Mercator_Azimuth_Center",GEOGCS["GCS_WGS_1984",DATUM["D_unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator_Azimuth_Center"],PARAMETER["latitude_of_center",'+str(locationLat)+'],PARAMETER["longitude_of_center",'+str(locationLon)+'],PARAMETER["rectified_grid_angle",'+str(-rotation)+'],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["m",1.0], AUTHORITY["EPSG","8011112"]]'
    return var
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.