[mapserver-users] [EXTERNAL] Re: Postgis Tile Index

Dave Barter dave.barter at gmail.com
Wed Aug 20 04:21:02 PDT 2014


I have this working now:-

CREATE MATERIALIZED VIEW mapping_raster.streetview_tileindex AS 
SELECT 'PG:host=localhost port=5432 …. schema=''mapping__raster'' table=''streetview'' mode=''1'' where=rid='||rid as location, 
ST_ConvexHull(rast) as shape from mapping_raster.streetview 

Thanks for the help, I will update the wiki shortly

On 20 August 2014 at 12:15:48, Smith, Michael ERDC-RDE-CRREL-NH (michael.smith at erdc.dren.mil) wrote:

Note that the current Wiki entry is here: https://github.com/mapserver/mapserver/wiki/MapServer-TILEINDEXes-with-Database-RASTERS

And when you do get this working, please update this for the other PostGIS users.

Mike

-- 
Michael Smith
US Army Corps
Remote Sensing GIS/Center

From: "Rahkonen Jukka (Tike)" <jukka.rahkonen at mmmtike.fi>
Date: Wednesday, August 20, 2014 at 6:56 AM
To: Dave Barter <dave.barter at gmail.com>, "mapserver-users at lists.osgeo.org" <mapserver-users at lists.osgeo.org>
Subject: [EXTERNAL] Re: [mapserver-users] Postgis Tile Index
Resent-From: Michael Smith <michael.smith at usace.army.mil>

Perhaps it is something like this (from http://trac.osgeo.org/gdal/wiki/frmts_wtkraster.html)

 

“Reading raster data from the database

If you want to use the GDAL WKT Raster driver, you must provide a connection string as Dataset's name. The syntax of this connection string is (the quotes may be ommitted):

PG:"host='<host>' port:'<port>' dbname='<dbname>' user='<user>' password='<password>' [schema='<schema>'] [table='<raster_table>'] [where='<sql_where>'] [mode='<working_mode>']"

 

I would test first by using the string for one image as  DATA of your raster layer before to continue towards TILEINDEX+TILEITEM.

 

-Jukka Rahkonen-

 

Dave Barter wrote:

 

I’ve figured this out,

 

CREATE MATERIALIZED VIEW mapping_os_opendata_raster.streetview_tileindex AS SELECT rid as location, ST_ConvexHull(rast) as shape from mapping_os_opendata_raster.streetview 

 

“location" needs to be a path to the database/table/raster currently it is just returning an ID, but I cannot find any documentation as to how to construct this for postgres

So nearly there?

 

On 20 August 2014 at 11:34:03, Dave Barter (dave.barter at gmail.com) wrote:

Final question. How should my map file look in order to get the raster tile from the database not the file system?

 

LAYER

            # CREATE MATERIALIZED VIEW mapping_os_opendata_raster.streetview_tileindex AS SELECT rid as location, ST_ConvexHull(rast) as shape from mapping_os_opendata_raster.streetview 

            NAME streetview_tileindex

            TYPE polygon

            PROJECTION

                "init=epsg:27700"

            END

            CONNECTIONTYPE postgis

            CONNECTION “********"

            DATA "shape from (SELECT shape,location FROM mapping_os_opendata_raster.streetview_tileindex) AS FOO USING UNIQUE location using srid=27700"

 

        END

 

        LAYER

            #RASTER TILE LAYERS MUST RUN FROM A TILEINDEX

            NAME streetview

            TYPE RASTER

            STATUS ON

            TILEINDEX "streetview_tileindex"

            TILEITEM "location"

            OFFSITE 0 0 0 

            PROJECTION

                "init=epsg:27700"

            END

            DEBUG 5

            EXTENT 0 0 3000000 1000000

 

        END

 

This is not working as the layer street view returns an error:- 

 

msDrawMap(): Image handling error. Failed to draw layer named 'streetview'. msDrawRasterLayerLow(): Unable to access file. Corrupt, empty or missing file '654016' for layer 'street view’.

 

I set SHAPEFILE “” at the top of the file, but am unclear as to how the streetview layer will retrieve the tile ?

 

 

 

-- 
Dave Barter

Web: http://www.phased.co.uk
Email:dave at phased.co.uk
Twitter:@Citizenfishy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140820/cf715551/attachment.html>


More information about the mapserver-users mailing list