[postgis-users] raster2pgsql

Robert Burgholzer rburghol at vt.edu
Sat Feb 20 03:34:58 PST 2016


I have converted NetCDF to postgres recently, and I recall the same error
message,I was able to overcome it by specifying the Band in the import
statement.  There may be other aceptable syntaxes, but for my dataset, I
successfully used the following (relative humidity band):

File Name: rtma2p5.2015120411.2dvaranl_ndfd.nc
Band (see below for ogrinfo list of bands): RELH_2maboveground
Target PG Table: rh_tmp
raster2pgsql cmd:  raster2pgsql
NETCDF:"rtma2p5.2015120411.2dvaranl_ndfd.nc":RELH_2maboveground
rh_tmp > rh_tmp.sql

The function gdalinfo will tell you your band names.   As to your other
question, it is true that it can handle only one Band at a time, and
therefore only one "variable".  A note however, you listed lat/lon as one
of your variables, and that is implicit in the raster cell, in essense, so
you can derive lat/lon of the cell centroid if you like in
PostgreSQL/PostGIS.    I did a blog on extracting raster cell data as
vector point here :
https://robertwb.wordpress.com/2016/02/20/netcdf-data-and-postgis/


HTH
/r/b


On Fri, Feb 19, 2016 at 1:47 PM, Severin Thaler <sev.thaler at gmail.com>
wrote:

> Dear all,
>
> i have been trying to use raster2pgsql to ingest a netcdf with multiple
> variables through:
>
> raster2pgsql -s 4326 -a -C -M -t 10x10 my_netcdf my_table
>
> but i get:
>
> Processing 1/1: my_netcdf
> ERROR: convert_raster: No bands found in raster: my_netcdf
> ERROR: process_rasters: Could not process raster: my_netcdf
> ERROR: Unable to process rasters
>
> i then extracted a single variable from the netcdf through ‘ncks’ and then
> tried to ingest
> the single variable netcdf with raster2pgsql and it worked. it also worked
> with another single variable,
> but as soon as i tried with 2 vars it again didn’t work with the same
> error.
>
> so it really seems to be that raster2pgsql can only handle a single
> variable is that true?
>
> to be precise, the variables i have are:
> lat(lat), lon(lon), time(time), and only one ‘real’ variable, e.g.
> temperature(time, lat, lon)
>
> also, does the dimensions the variable depends on need to be in a certain
> order, i.e.
> would e.g. temperature(time, lat, lon) not work? and are there any other
> possible conventions
> that the netcdf has to follow in order for raster2pgsql to work, thanks.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users




-- 
--
Robert W. Burgholzer
 'Making the simple complicated is commonplace; making the complicated
simple, awesomely simple, that's creativity.'  - Charles Mingus
Athletics: http://athleticalgorithm.wordpress.com/
Science: http://robertwb.wordpress.com/
Wine: http://reesvineyard.wordpress.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160220/5949bd9b/attachment.html>


More information about the postgis-users mailing list