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

William Hudspeth bhudspeth at edac.unm.edu
Tue Jan 6 08:01:34 PST 2015


I have not yet tried a TEMPLATE....ideally, I am looking for a method to 
script a series of calls to mapserver to return a list of pixel values 
for a time series of rasters for a given geographic coordinate. In this 
case, imagine a time series of air pollution rasters where I want to 
collect a sequence of values for a given city or location. I want to be 
able to use these data points to build a time series graph....Any ideas 
would be appreciated...

Thanks!



On 01/06/2015 08:44 AM, Lime, Steve D (MNIT) wrote:
> Ok, so this just a PostGIS-based tiled layer to access GeoTIFF's. You should just be able to do a normal MapServer query.
>
>    e.g. http://your.server/cgi-bin/mapserv?map=your.map&mapxy=x+y&qlayer=pm25_monthly&mode=query
>
> You'd need to set a TEMPLATE for the pm25_monthly layer. Have you tried that? WMS should work then too but it's simpler to debug using a basic MapServer query.
>
> Steve
>
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Bill Hudspeth
> Sent: Tuesday, January 06, 2015 8:59 AM
> To: mapserver-users at lists.osgeo.org
> Subject: [mapserver-users] Return pixel values from raster layers served by mapserver
>
> 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
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the MapServer-users mailing list