通过raster2pgsql导入栅格,但得到sql语法错误

时间:2012-06-22 21:38:44

标签: sql postgresql import postgis raster

按照本教程[http://www.postgis.org/documentation/manual-svn/using_raster.xml.html] [1]

尝试将光栅文件导入我的postgres数据库

环境: windows7,Postgres 8.4,postgis 2.0。

我的命令行是:

cd C:\Program Files (x86)\PostgreSQL\8.4\bin
raster2pgsql -s 4236 -I -G -M kiwi.jpg -F -t 100x100 public.gis > out.sql
psql -U postgres -d mydb2 -f out.sql

名为“kiwi”的图片位于“C:\ Program Files(x86)\ PostgreSQL \ 8.4 \ bin”文件夹中。 out.sql可以成功生成。但输入“psql -U postgres -d mydb2 -f out.sql”后,出现错误。

  

psql:out.sql:98:错误:“可用”或附近的语法错误

     

第1行:可用的GDAL栅格格式:

谢谢! 这是查询的内容:(我对postgis很新,所以我不知道这里有什么问题。因为我只是按照教程,它应该工作)

    Available GDAL raster formats:
      Virtual Raster
      GeoTIFF
      National Imagery Transmission Format
      Raster Product Format TOC format
      ECRG TOC format
      Erdas Imagine Images (.img)
      CEOS SAR Image
      CEOS Image
      JAXA PALSAR Product Reader (Level 1.1/1.5)
      Ground-based SAR Applications Testbed File Format (.gff)
      ELAS
      Arc/Info Binary Grid
      Arc/Info ASCII Grid
      GRASS ASCII Grid
      SDTS Raster
      DTED Elevation Raster
      Portable Network Graphics
      JPEG JFIF
      In Memory Raster
      Japanese DEM (.mem)
      Graphics Interchange Format (.gif)
      Graphics Interchange Format (.gif)
      Envisat Image Format
      Maptech BSB Nautical Charts
      X11 PixMap Format
      MS Windows Device Independent Bitmap
      SPOT DIMAP
      AirSAR Polarimetric Image
      RadarSat 2 XML Product
      PCIDSK Database File
      PCRaster Raster File
      ILWIS Raster Map
      SGI Image File Format 1.0
      SRTMHGT File Format
      Leveller heightfield
      Terragen heightfield
      USGS Astrogeology ISIS cube (Version 3)
      USGS Astrogeology ISIS cube (Version 2)
      NASA Planetary Data System
      EarthWatch .TIL
      ERMapper .ers Labelled
      NOAA Polar Orbiter Level 1b Data Set
      FIT Image
      GRIdded Binary (.grb)
      Raster Matrix Format
      EUMETSAT Archive native (.nat)
      Idrisi Raster A.1
      Intergraph Raster
      Golden Software ASCII Grid (.grd)
      Golden Software Binary Grid (.grd)
      Golden Software 7 Binary Grid (.grd)
      COSAR Annotated Binary Matrix (TerraSAR-X)
      TerraSAR-X Product
      DRDC COASP SAR Processor Raster
      R Object Data Store
      Portable Pixmap Format (netpbm)
      USGS DOQ (Old Style)
      USGS DOQ (New Style)
      ENVI .hdr Labelled
      ESRI .hdr Labelled
      Generic Binary (.hdr Labelled)
      PCI .aux Labelled
      Vexcel MFF Raster
      Vexcel MFF2 (HKV) Raster
      Fuji BAS Scanner Image
      GSC Geogrid
      EOSAT FAST Format
      VTP .bt (Binary Terrain) 1.3 Format
      Erdas .LAN/.GIS
      Convair PolGASP
      Image Data and Analysis
      NLAPS Data Format
      Erdas Imagine Raw
      DIPEx
      FARSITE v.4 Landscape File (.lcp)
      NOAA Vertical Datum .GTX
      NADCON .los/.las Datum Grid Shift
      NTv2 Datum Grid Shift
      ACE2
      Snow Data Assimilation System
      Swedish Grid RIK (.rik)
      USGS Optional ASCII DEM (and CDED)
      GeoSoft Grid Exchange Format
      Northwood Numeric Grid Format .grd/.tab
      Northwood Classified Grid Format .grc/.tab
      ARC Digitized Raster Graphics
      Standard Raster Product (ASRP/USRP)
      Magellan topo (.blx)
      SAGA GIS Binary Grid (.sdat)
      Kml Super Overlay
      ASCII Gridded XYZ
      HF2/HFZ heightfield raster
      OziExplorer Image File
      USGS LULC Composite Theme Grid
      Arc/Info Export E00 GRID
      ZMap Plus Grid
      NOAA NGS Geoid Height Grids

I have no idea about this error after searching a lot. I really appreciate that if you can give me some suggestions.


  [1]: http://www.postgis.org/documentation/manual-svn/using_raster.xml.html
  [2]: http://i.stack.imgur.com/YxjNJ.png

1 个答案:

答案 0 :(得分:5)

PostgreSQL中的psql实用程序用于处理SQL命令。您显示的文件不包含SQL命令,它似乎包含帮助某人为raster2pgsql程序选择选项的信息。这里有一个快速的网络搜索文档:

http://www.postgis.org/documentation/manual-svn/using_raster.xml.html

请注意-G选项用于"打印支持的栅格格式。"用于运行程序的命令行包括该开关。如果您的目标是生成SQL语句,那么您应该包含这些选项。我不知道是否需要对你的命令进行任何其他调整,但你可以先放弃它并看看你得到了什么。