2

Starting with a grib file with limited projection information, I am trying to import it as a GeoTiff in Geoserver 2.7.x.

The original gdalinfo is:

Size is 218, 81 Coordinate System is: GEOGCS["Coordinate System imported from GRIB file", DATUM["unknown", SPHEROID["Sphere",6371229,0]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]] Origin = (174.849999999999994,79.150000000000006) Pixel Size = (0.300000000000000,-0.300000000000000) Corner Coordinates: Upper Left ( 174.8500000, 79.1500000) (174d51' 0.00"E, 79d 9' 0.00"N) Lower Left ( 174.8500000, 54.8500000) (174d51' 0.00"E, 54d51' 0.00"N) Upper Right ( 240.250, 79.150) (240d15' 0.00"E, 79d 9' 0.00"N) Lower Right ( 240.250, 54.850) (240d15' 0.00"E, 54d51' 0.00"N) Center ( 207.550, 67.000) (207d33' 0.00"E, 67d 0' 0.00"N) Band 1 Block=218x1 Type=Float64, ColorInterp=Undefined

the file covers alaska and crosses lon 180. When I try this: gdalwarp -s_srs "EPSG:4326" -t_srs "+proj=lcc +lon_0=-152.45 +lat_0=60.925 +lat_1=73.075 +datum=WGS84" input.grb output.tif

The results fail to import into geoserver. Geoserver complains that

Error decoding CRS: Value 207.55 is out of range [-180..180].

The resulting tif gdal info is: Size is 230, 182 Coordinate System is: PROJCS["unnamed", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4326"]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["standard_parallel_1",73.075], PARAMETER["standard_parallel_2",0], PARAMETER["latitude_of_origin",60.925], PARAMETER["central_meridian",207.55], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]]] Origin = (-1694471.810281516984105,2114705.707116945646703) Pixel Size = (14712.347452214831719,-14712.347452214831719) Metadata: AREA_OR_POINT=Area Image Structure Metadata: INTERLEAVE=BAND Corner Coordinates: Upper Left (-1694471.810, 2114705.707) (145d28'51.94"E, 75d15'58.24"N) Lower Left (-1694471.810, -562941.529) (176d50'52.24"E, 51d39'16.98"N) Upper Right ( 1689368.104, 2114705.707) ( 90d30'45.10"W, 75d17'39.86"N) Lower Right ( 1689368.104, -562941.529) (121d49'59.11"W, 51d40'25.97"N) Center ( -2551.853, 775882.089) (152d31' 3.00"W, 68d43'25.61"N)

I have tried using +over and +lon_wrap in attempt to cerce the central meridian to a value between -180 and +180, but all the combinations I have tried result in no change to the reprojected tif at all.

  • It looks like the output raster is okay. Can you use one of the geotiff utilities to update the coordinate sytem information and change the central meridian to -152.45? Also, note the standard parallel 2 value. Because you didn't specify it, it was set to zero. Is that what you wanted? Or did you want it equal to standard parallel 1? – mkennedy Sep 29 '15 at 19:49
  • @mkennedy. No, that's not what I wanted, but +lon_0=-152.45 +lat_0=67.0 +lat_1=60.925 +lat_2=1=73.075 didn't set set SP2 either. Trying to get the central lat & lon to be in the grid center and the standard parallels to be at the 1/3 and 2/3 points repectively. But at this point, the lon > 180 seems to be the bigger problem. – DaveParillo Sep 29 '15 at 20:04
  • @mkennedy - Also, I don't follow your comment re: "use one of the geotiff utilities to update the coordinate sytem information and change the central meridian to -152.45" - isn't that what lon_0 is supposed to do? – DaveParillo Sep 29 '15 at 20:19
  • You said GeoServer is complaining about the 207.55 value--it's doing a check of the parameters and expects longitude values between -180 and +180. If you update the metadata, it might pass the check. Looks like GDAL has some: gdal_edit.py but I was thinking of geotifcp – mkennedy Sep 29 '15 at 20:24
1

Managed to solve my own problem, inspired by mkennedy's comments, perhaps not in the most elegant way possible...

Could not figure out how to get gdalwarp to reproject this correctly using proj4 string so I created a WKT and used that instead:

gdalwarp -t_srs lcc.wkt input.grb output.tif

lcc.wkt contains:

PROJCS["Alaska Lambert Conic Conformal (2SP)", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4326"]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["standard_parallel_2",73.075], PARAMETER["standard_parallel_1",60.925], PARAMETER["latitude_of_origin",67.0], PARAMETER["central_meridian",-152.45], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]]]

I added this same WKT to the geoserver epsg.properties, gave it a unique number, and registered my GeoTiff image in Geoserver with my new projection.

Geoserver had no complaints and I can request the image in any projection geoserver supports and at first blush, it looks generally OK.

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.