[GIS] Accessing PostGIS raster data using Query Layer in ArcGIS Desktop

arcgis-10.0arcgis-desktoppostgisquery-layerraster

I tried to load raster file (jpg) into post gis using the syntax provided here "C:\Program Files (x86)\PostgreSQL\9.1\bin>raster2pgsql -I -C -e -Y -F -s 102003 -t 300×300 ras_test.tif ras_test1 | psql .exe -U postgres -d raster_analysis -h localhost -p 5434"

I could see a raster table created in the database. It has three columns (rid,rast, filename), where you do not see any thing under "rast raster" column unless you click on a particular cell.

Here is my actual problem. How to view the raster layer from ArcGIS using sql query layer. When I tried adding this layer and validate it, it says "rast raster" column has invalid data type. How can I view the raster layer in ArcGIS?

I could however, able to see the raster layer in QGIS using a plugin. However, my work needs access from arcGIS 10.

It is mentioned in this link, http://trac.osgeo.org/postgis/wiki/WKTRaster, that
You can not display rasters directly but a vectorization of them (in ArcGIS 10). How to do this?

Best Answer

To do this, you'll want to create a separate table containing the vectorized raster or a view. If your raster table is big (lots of rows), you're better using a separate table instead of a view do to the computation occurring every time the view is accessed. The SQL for creating the view could be...

CREATE VIEW myview AS
SELECT
    rid,
    (ST_DumpAsPolygons(rast)).*
FROM ras_test1

You should be able to view that in ArcGIS. It might complain about lacking an primary key, which you could always add if needed.

Related Question