从Grib2到PostGIS栅格-有人可以使用它吗? [英] Grib2 to PostGIS raster -- anyone get this to work?

查看:295
本文介绍了从Grib2到PostGIS栅格-有人可以使用它吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要导入美国国家气象局地面分析的应用程序,该分析作为 grib2分发文件.我想将它们放入PostGIS 2.0栅格中,进行一些计算和建模,并在GeoServer中显示数据和模型结果.

I have an application for which I need to import U.S. National Weather Service surface analyses, which are distributed as grib2 files. I want to pull those into PostGIS 2.0 rasters, do some calculations and modeling, and display the data and model results in GeoServer.

由于grib2是GDAL支持的格式,因此提供的raster2pgsql实用程序应该能够将grib2插入到PostGIS兼容的SQL中,并且一旦存在,GeoServer就应该能够处理它.但是,我遇到了没有明显解决方案的问题-无论如何对我来说并不明显! Raster2pgsql运行时,显然没有错误,生成了SQL,然后运行SQL会创建看起来非常像栅格的东西.但是GeoServer无法显示它-尤其是边界看起来很奇怪(0,0 -1,-1),预览层"只是抛出了NullPointerException.

Since grib2 is a GDAL-supported format, the supplied raster2pgsql utility should be able to slurp a grib2 right into PostGIS-compatible SQL, and once it's there, GeoServer ought to be able to handle it. However, I'm running into problems which have no obvious solutions -- not obvious to me, at any rate! Raster2pgsql runs, apparently without errors, producing SQL, and running the SQL creates what looks very much like a raster. But GeoServer can't display it -- the bounds, in particular, come out looking weird (0,0 -1,-1) and "preview layer" just throws a NullPointerException.

有人走过这条路吗?我遇到了一些基本问题,就是不知道数据的SRID应该是什么(也许是4326).我不希望有人为我调试问题,但是如果有人已经或部分使用了此工具链,则可以插入已知的好东西,然后看看能发现什么.

Has anyone been down this road already? I've got issues as basic as not knowing what the SRID should be for the data (4326, perhaps?). I don't expect anyone to debug my problems for me but if someone has already got this toolchain working, or part of it, I can plug known-good things in and see what I can discover.

TIA,

rw

已更新:Per Mike,这是其中一个文件的坐标系素材;我从"gdalinfo"的输出中消除了其他749个频段.请注意,文件名是不同的-我在原始文件上运行"gdalinfo"后发现它出了点问题,gdalinfo无法读取它.新文件(35 MB!)文件此处.

Updated: Per Mike, here is the coordinate-system stuff from one of the files; I elided the other 749 bands in the output from "gdalinfo". Note that the filename is different -- I found out by running "gdalinfo" on my original file that something was wrong with it, gdalinfo couldn't read it. New (35MB!) file here.

Gdalinfo输出:

Gdalinfo output:

Driver: GRIB/GRIdded Binary (.grb)
Files: ruc2.t00z.bgrb13anl.grib2
Size is 451, 337
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["Coordinate System imported from GRIB file",
        DATUM["unknown",
            SPHEROID["Sphere",6371229,0]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",25],
    PARAMETER["standard_parallel_2",25],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",265],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0]]
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 = 1[-] HYBL="Hybrid level"
  Metadata:
    GRIB_UNIT=[Pa]
    GRIB_COMMENT=Pressure [Pa]
    GRIB_ELEMENT=PRES
[Etc., Etc., for all 750 bands]

推荐答案

为我的问题提供了一个很好的答案

Got an excellent answer to my problem here. Putting it in as a separate answer.

他建议使用gdalwarp将GRIB2文件拉入已知的SRID,因此:

He recommended using gdalwarp to pull the GRIB2 file into a known SRID, thus:

gdalwarp -t_srs EPSG:4326 original_file.grib2 4326_file.grib2

然后,raster2pgsql可以正常工作,例如

Then, raster2pgsql works just fine, e.g.

raster2pgsql -M -a 4326_file.grib2 some_sql.sql

这篇关于从Grib2到PostGIS栅格-有人可以使用它吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆