| 1 | To deal with multiple rasters loaded to a table in a database (can be PostGIS or Oracle, example is Oracle), you can use a TILEINDEX in MapServer. |
| 2 | |
| 3 | Database TILEINDEXes are a little odd in MapServer, they require 2 separate layers, a TILEINDEX layer and a RASTER layer that refers to the TILEINDEX layer. |
| 4 | |
| 5 | In Oracle, you'll want to create the TILEINDEX as a view to the GEORASTER table of interest. |
| 6 | |
| 7 | {{{create or replace view my_raster_tindex as select some_attribute, 'geor: user/pass@tns, raster_table_DATA,'||r.raster.rasterid location, R.RASTER.spatialextent shape from rasters_table r;}}} |
| 8 | |
| 9 | This view will then be used for the TILEINDEX layer |
| 10 | |
| 11 | {{{ |
| 12 | LAYER |
| 13 | name raster_tindex |
| 14 | TYPE polygon |
| 15 | PROJECTION |
| 16 | "init=epsg:xxxx" |
| 17 | END |
| 18 | CONNECTIONTYPE ORACLESPATIAL |
| 19 | CONNECTION user/pass@tns' |
| 20 | DATA "shape from my_raster_tindex using srid xxxx" |
| 21 | END |
| 22 | }}} |
| 23 | |
| 24 | Then you add a second layer that is the actual RASTER layer |
| 25 | |
| 26 | {{{ |
| 27 | LAYER |
| 28 | name db_raster_layer |
| 29 | TYPE RASTER |
| 30 | PROJECTION |
| 31 | "init=epsg:xxxx" |
| 32 | END |
| 33 | TILEINDEX "raster_tindex" #THIS NAME MUST MATCH THE TILEINDEX LAYER NAME |
| 34 | TILEITEM "location" #not actually needed if column is named location |
| 35 | STATUS OFF |
| 36 | OFFSITE 0 0 0 |
| 37 | END |
| 38 | }}} |
| 39 | |
| 40 | One last piece that is needed is to set the SHAPEPATH to null so that the paths to the raster files are treated as database connections and not files. |
| 41 | |
| 42 | Add |
| 43 | {{{ |
| 44 | SHAPEPATH "" |
| 45 | }}} |