Opened 18 years ago

Closed 14 years ago

#1856 closed defect (fixed)

wcs with postgis TIME filter not working

Reported by: dnadeau@… Owned by: sdlime
Priority: high Milestone:
Component: WCS Server Version: unspecified
Severity: major Keywords:
Cc: dnadeau@…

Description (last modified by hobu)

Time filter is not set correctly with tileindex.

mapwcs.c R1.71 line 1159 should read something like 

   if(params->time) {
.....
    /* finally set the filter */
   msLayerSetTimeFilter(&tlp, params->time, tlp->filteritem);
}
and not
    msLoadExpressionString(&tlp->filter, params->time);

Right now filter is set to (2003-01-10) 
and postgis does not work
.... WHERE (2001-03-01) and (the_geom && setSRID( 'BOX3D(-180 -90,180....

WHERE (2001-03-01) should be replace by
WHERE date_trunc('day', time) = '2001-03-01' ... (from mappostgis.c) 

Regards,
Denis


MAPFILE 

LAYER
	STATUS ON
	NAME        "AIRX3STD_TD_IDX"
	TYPE POLYGON
	CONNECTIONTYPE POSTGIS
	CONNECTION  "dbname=mapserver password=xxxxx user=dnadeau port=5432"
	DATA        "the_geom from airx3std_temperature_a"  
	METADATA
		"wms_title"    "TIME  INDEX"
	END
END

...
LAYER
    NAME 'AIRX3STD_TEMP_D'
    TYPE RASTER
    STATUS ON
    DEBUG ON
    DUMP  TRUE

    TRANSPARENCY 100
    PROJECTION
        "init=epsg:4326"
    END
    METADATA
		ows_title       "AIRXSTD Temperature descendant"
		wcs_label       "AIRXSTD Temperature descendant"
		wcs_resolution  "1.0 1.0"
		wcs_formats     'GEOTIFF_FLOAT'
		wcs_nativeformat 'HDF4'
		wcs_bandcount    '24'
		wcs_rangeset_axes 'bands'
		wcs_rangeset_label 'test'
		wcs_rangeset_name 'bands'
		wcs_rangeset_description 'test levels'
		wcs_timeposition
'2001-01-01T06:00:00,2001-03-01T12:00:00,2001-01-01T18:00:00,2001-01-02T00:00:00'
#		wcs_timeposition '2000-01-01/2006-12-31'
		wcs_timeitem     'time'

		ows_timeextent  "2002-08-31/2006-08-06"
		ows_bandcount   "24"
		ows_srs         "EPSG:4326"
  		ows_timeitem    "time"
		ows_timedefault "2006-06-28"
		ows_extent      "-180.0 -90.0 180.0 102.96" # 102.96 for the banner!!
	END  

	OFFSITE 0 0 0  #make black tramparent

	TILEITEM             "location" #filepath is a column in postgis table with
varchar of the filepath to each image
	TILEINDEX            "AIRX3STD_TD_IDX" 
	
END

Change History (12)

comment:1 by fwarmerdam, 18 years ago

Cc: warmerdam@… added

comment:2 by sdlime, 18 years ago

Status: newassigned
WCS doesn't (or hasn't) use the same time mechanism the WMS does, and things 
are generally untested with non-shapefile tile indexes (until now). Will have 
to check this out before committing to a quick fix...

Steve

comment:3 by dnadeau@…, 18 years ago

I made it works for POSTGIS only.

People using WCS only with Postgis tileindex might want to change line 1157 and
line 1157 in mapwcs.c rev. 1.71.  I did not bother to make a case for shapefile
tileindex for I do not use it, and I don't know how to find out the tileindex type.

Change line 1157 and 1558 in mapwcs.c rev. 1.71
From:
    freeExpression(&tlp->filter);
    msLoadExpressionString(&tlp->filter, params->time);
 
To:
    freeExpression(&tlp->filter);
    msPOSTGISLayerSetTimeFilter(tlp, params->time, value);

    /*    msLoadExpressionString(&tlp->filter, params->time); */

comment:4 by sdlime, 18 years ago

The tileindex type is the layer type, since in these cases the tileindex is 
another layer. We'll get this straightend out for the upcoming release.

Steve

comment:5 by sdlime, 18 years ago

Denis: Did you try the fix you mention in the first note in this bug? That is,
using msLayerSetTimeFilter(&tlp, params->time, tlp->filteritem);?

Steve

comment:6 by dnadeau@…, 18 years ago

Yes I did, but it core dumps because LayerSetTimeFilter vitual table does not
seem to be initialized correctly.   I am not sure but I don't think that
msInitializeVirtualTable was called from maplayer.c

As well, this was a bad fix I wrote for tlp is already a pointer and
tlp->filteritem was freed by msPOSTGISLayerSetTimeFilter which was not
initialized.  

So that line did not work. 

comment:7 by sdlime, 18 years ago

I have a message into the authors of that function to get an idea of readiness. 
To be clear, you do have it working for PostGIS correct?

Steve

comment:8 by dnadeau@…, 18 years ago

Yes I got it working with PostGIS.

comment:9 by hobu, 17 years ago

Description: modified (diff)

Can this bug be closed?

comment:10 by sdlime, 17 years ago

I don't think so. Driver-specific filters are probably still an issue. Will check the source...

Steve

comment:11 by sdlime, 15 years ago

A patch that should fix this was supplied with #2487 and has been applied in r8628. If folks would test 5.4-beta3 when available then we can close this one...

Steve

comment:12 by pramsey, 14 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.