[mapserver-users] Return pixel values from raster layers served by mapserver

Bill Hudspeth bhudspeth at edac.unm.edu
Tue Jan 6 06:58:31 PST 2015


Hello,

I previously wrote about this issue, but have not found a solution yet. I am running Mapserver 6.4.1, and am using Postgres/Postgis to display a time series of geotiff images. I would like to know the best way for a user to submit a given x,y coordinate pair and return the pixel value for a given image. Is this possible using only the mapserver api? or must I absolutely use mapscript?

Currently, I use a PostgreSQL/PostGIS time-enabled table to store the information about the location of the geotiffs and the timestamp associated with them:

pm25_monthly=# \d pm25_monthly_global

  Table
"public.pm25_monthly_global"

   Column  |            Type             |
Modifiers

----------+-----------------------------+-----------------------------------------------

oid | integer | default nextval('pm25_monthly_seq'::regclass)
  rundate | timestamp with time zone |
  datetime    | timestamp with time zone    |
  location    | text                        |
  timezone    | timestamp without time zone |
  the_geom     | geometry(MultiPolygon,4326) |

Indexes:
     "pm25_monthly_global_oid_key"
UNIQUE CONSTRAINT, btree (oid)

The 'location' field simply gives the full path to the relevant geotiff on the file system. And, I define the index in the mapfile:

#**********LAYER - TILE INDEX FOR PM2.5 RASTERS
(Time sensitive)**** 
LAYER
   STATUS ON
   NAME "pm25_time_index"
   TYPE POLYGON
   DATA "the_geom from pm25_monthly_global using unique oid using SRID=4326"
   METADATA
     "ows_title" "PM25 TIME INDEX"
     "ows_srs" "EPSG:4326"
     "ows_extent" "-180 -90 180 90" #[minx][miny][maxx][maxy]
     "wms_timeformat" "YYYY-MM-DDTHH:MM:SS"
     "wms_timeextent" "2011-01-01T00:00:00/2012-12-01T00:00:00"
     "wms_timeitem" "timezone"
     "wms_timedefault" "2011-01-01T00:00:00"
     wcs_resolution '0:10 0:10'
   END

   #CONNECTION "user=wilbur dbname=pm25_monthly host=localhost password=iiiiiiiiii"
   #CONNECTIONTYPE postgis
   CONNECTIONTYPE POSTGIS
   CONNECTION "host=127.0.0.1 dbname=pm25_monthly user=wilbur password=EUR2_live port=5432"

   DATA "the_geom from pm25_monthly_global using unique oid using srid=4326"
END

#*******LAYER - MONTHLY PM2.5 (Time Sensitive)*********************************

LAYER
     NAME 'pm25_monthly'
     TYPE RASTER
     STATUS ON
     DEBUG OFF
     DUMP TRUE
     #TRANSPARENCY 50
     #FILTER ""

     METADATA
         "ows_keywordlist" 'PM2.5 (ug/m3), Global' #wms_keywordlist (Keywordlist)
         "ows_description" "Global monthly mean PM 2.5 (ug/m3)concentration"
         "ows_name" "Global monthly mean PM2.5 - Concentration Values (ug/m3)"
         "ows_label" "Global PM 2.5 (ug/m3)"
         "ows_srs" "EPSG:4326 EPSG:900913"
         "ows_extent" "-180 -90 180 90" #[minx][miny][maxx][maxy]
         "ows_formats" "GEOTIFF"
         "ows_nativeformat" "8-bit GeoTIF"
         "ows_timeitem" "timezone"
         "wms_onlineresource" "http://localhost/cgi-bin/mapserv?map=/var/www/pm25_mapserver/public_html/pm25_ogc_services.map"
         "wms_abstract" 'Global monthly mean PM 2.5 (ug/m3)concentration'  #wms_abstract(Abstract)
         "wms_opaque" '0' #wms_opaque(layer)
         "wms_title" "Global monthly mean PM 2.5 (ug/m3)concentration"
         "ows_timeformat" "YYYY-MM-DDTHH:MM:SSZ"
         "ows_timeextent" "2011-01-01T00:00:00Z/2012-12-01T00:00:00Z"
         "ows_timedefault" "2011-01-01T00:00:00Z"
         "wms_enable_request" "*"
         "wcs_resolution" "0:10 0:10"
         "wcs_bandcount" "1"
         "wcs_size" "3600 1800"
         layer_name pm25_monthly

     END   #METADATA
     PROJECTION
         "init=epsg:4326"     #WGS84 Decimal Degrees
     END  #PROJECTION

     TILEITEM "location"
     TILEINDEX "pm25_time_index"

END  #LAYER



Thanks



More information about the MapServer-users mailing list