Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm currently trying the new raster functionalities of PostGIS 2.0 and I successfully imported some GeoTIFF file into PostGIS (although it only find one band so it's all black and white for some reason). I used raster2pgsql.exe bundled with PostGIS 2 to store it.

Most of the raster data i have is in ECW format and I would like to import them directly with raster2pgsql. I know i can convert my ECW to GeoTIFF but i would like to do it without conversion.

When i list the supported input format of raster2pgsql (raster2pgsql -G), it does not list ECW as it can not be distributed with the install. So i downloaded the ERDAS SDK following these instructions: http://trac.osgeo.org/osgeo4w/wiki/pkg-gdal-ecw

And copied the DLL in my SysWOW64 system folder (i'm using Windows 7 64-bits). But it still won't list ECW as an input format. When looking up online, i found that PostGIS uses a bundled GDAL found in

C:\Program Files (x86)\PostgreSQL\8.4\bin\libgdal-1.dll

I don't know where to copy the DLLs so that the GDAL bundled with PostGIS will grab them and accept ECWs rasters. Or if anyone know how to tell PostGIS to use the GDAL install that comes with FWTools (C:\Program Files (x86)\FWTools2.4.7\bin) which is directly compatible with ECWs (path variables?)

Thanks a lot for your help!

Fabien

share|improve this question
    
I was hoping that it would be ask simple as swapping out the libgdal-1.dll (with gdal_fw.dll) or the other one I commonly use. The issue is we compile under mingw and the underlying function name are completely different. e.gVC calls _GDALOpenShared and mingw calls it GDALOpenShared –  LR1234567 Aug 16 '12 at 16:05
    
If you want to put in a ticket -- trac.osgeo.org/postgis . Just say to make the libgdal-1.dll swappable with VC built ones. I'll see if there is something I can do about this incompatibility. I don't plan to build ECW just because then peole will be asking for SID and everything else under the sun. –  LR1234567 Aug 16 '12 at 16:10
    
Hey, thanks for investigating. Is there any way i can simply change some env variables to make gdal point somewhere else? I know PostGIS install already change the GDAL_DATA env variable –  fnicollet Aug 17 '12 at 9:32
    
You can but it won't help you in this case. The GDAL_DATA just tells it where to look for the epsg files. If you look in Windows --> System you'll see where GDAL_DATA is pointing to. The fundamental problem I see though is all the drivers that GDAL is compiled with the links are embedded in the dll itself, so the libgdal1.dll we package has absolutely no knowledge that it should even be able to work with ECW. I've talked this over with PostGIS raster dev folks how much effort to build the write logic in GDAL. It's not trivial but not a ton of work either, but not high on priority –  LR1234567 Aug 17 '12 at 11:53
    
I forgot to add you can't just have it point at another version of GDAL if that is what you are asking. In theory all you need to do that is copy raster2pgsql.exe into your GDAL folder and make a copy of gdal19.dll to libgdal-1.dll. That's what I was trying to do. The issue is the raster2pgsql.exe we package is expecting to find a dll hook called GDALOpenShared (which I checked with others is what Linux seems to also call it) and the VC and MacOSX compiled ones for some ungoddly reason call the internal name _GDALOpenShared. –  LR1234567 Aug 17 '12 at 11:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.