I have a grib2 file which I'm trying to import into PostGIS 2.0 Raster and process. Trouble is, I can't figure out what the SRID is supposed to be, or one close enough for government work. Running gdalinfo on the file gives me the output below. I've tried 3785 just as a shot in the dark, but when I transform the coordinates back to 4326 they don't match up. I really would like to work with 4326 in my code, especially since that's how people will be signing up for subscriptions and the like.

If I do something like

select st_value(rast, st_makepoint(-277757.789, 4547961.333)) from test_grib_table;

I get a result. (Note that that's the center point specified below.) But I can't figure out how to transform 4326 lat/long degree coords into this (unknown to me) SRS.

Gdalinfo output:

Driver: GRIB/GRIdded Binary (.grb)
Files: 130-2013.050614_000_TMPK.grib2
Size is 451, 337
Coordinate System is:
    GEOGCS["Coordinate System imported from GRIB file",
Origin = (-3332155.288903323933482,6830293.833488883450627)
Pixel Size = (13545.000000000000000,-13545.000000000000000)
Corner Coordinates:
Upper Left  (-3332155.289, 6830293.833) (139d51'22.04"W, 54d10'20.71"N)
Lower Left  (-3332155.289, 2265628.833) (126d 6'34.06"W, 16d 9'49.48"N)
Upper Right ( 2776639.711, 6830293.833) ( 57d12'21.76"W, 55d27'10.73"N)
Lower Right ( 2776639.711, 2265628.833) ( 68d56'16.73"W, 17d11'55.33"N)
Center      ( -277757.789, 4547961.333) ( 98d 8'30.73"W, 39d54'5.40"N)
Band 1 Block=451x1 Type=Float64, ColorInterp=Undefined
  Description = 2[m] HTGL="Specified height level above ground"
    GRIB_COMMENT=Temperature [K]
    GRIB_REF_TIME=  1367848800 sec UTC
    GRIB_VALID_TIME=  1367848800 sec UTC
  • your projection has "central_meridian",265. This is impossible. Are you sure that the text is correct? – Devdatta Tengshe May 7 '13 at 11:20
  • Well, it's copied and pasted from the gdalinfo output, so it's a faithful representation. Gdalinfo could be fooled or lying, I suppose. – Rick Wayne May 8 '13 at 14:11
  • Where did you get the GRIB? If appears that either the SRS isn't included or GDAL doesn't know how to get it. So you're back to finding source metadata. – BradHards Nov 5 '13 at 4:48

If there is an EPSG code for this projection, you should find it on spatialreference.org. Search for Lambert_Conformal_Conic_2SP.

Otherwise you'll have to define a custom Proj.4 projection string and add it to the spatial_ref_sys table in your PostGIS database. The Proj.4 string would probably look like the following (not tested!):

+proj=lcc +lat_1=25 +lat_2=25 +lat_0=0 +lon_0=-95 +x_0=0 +y_0=0 +ellps=sphere +a=6371229 +b=6371229

Still the reprojection won't work unless the sphere's origin matches the origin of the WGS84 ellipsoid (used in EPSG:4326) by chance. The translation vector can be specified in the Proj.4 string with the +towgs parameter.

  • Looking at the extent of the file (that is the whole USA), the towgs datum shift should be a minor issue. – AndreJ Jan 9 '14 at 12:23

If it says it's Lambert Conic Conformal 2SP then its EPSG Code should be 9802. You can check for remotesensing.org for more details.


The documents from remotesensing.org have been moved to http://geotiff.maptools.org/proj_list/lambert_conic_conformal_2sp.html

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.