[fdo-dev] Raster SetBounds()
Frank Warmerdam
warmerdam at pobox.com
Thu Oct 5 12:35:22 EDT 2006
Traian Stanev wrote:
>
> Hi Frank,
>
> MapGuide shouldn't be expecting the extent of the FdoIRaster to match
> the queried extent. I looked at the sources again, and here is what
> MapGuide does:
>
> 1. Execute a Select query of a computed identifier which contains a
> RESAMPLE function, like this (StylizationUtil.cpp):
>
> //Set up RESAMPLE command
> FdoPtr<FdoExpressionCollection> funcParams =
> FdoExpressionCollection::Create();
> FdoPtr<FdoIdentifier> rasterProp =
> FdoIdentifier::Create(geom.c_str());
> funcParams->Add(rasterProp);
> FdoPtr<FdoDataValue> minX = FdoDataValue::Create(extent.minx,
> FdoDataType_Double);
> funcParams->Add(minX);
> FdoPtr<FdoDataValue> minY = FdoDataValue::Create(extent.miny,
> FdoDataType_Double);
> funcParams->Add(minY);
> FdoPtr<FdoDataValue> maxX = FdoDataValue::Create(extent.maxx,
> FdoDataType_Double);
> funcParams->Add(maxX);
> FdoPtr<FdoDataValue> maxY = FdoDataValue::Create(extent.maxy,
> FdoDataType_Double);
> funcParams->Add(maxY);
> FdoPtr<FdoDataValue> height = FdoDataValue::Create(devHeight);
> funcParams->Add(height);
> FdoPtr<FdoDataValue> width = FdoDataValue::Create(devWidth);
> funcParams->Add(width);
>
> FdoPtr<FdoFunction> clipFunc = FdoFunction::Create(L"RESAMPLE",
> funcParams);
>
> STRING func = clipFunc->ToString();
> options->AddComputedProperty(L"clipped_raster", func);
>
>
> The RESAMPLE function is set up to request the full visible extent at a
> certain window size. So far so good.
>
> 2. Later, when reading the FdoRaster, the RasterAdapter.cpp code in
> MapGuide does not actually expect the raster extent to equal the visible
> extent. Here is what it does:
>
> //first get the map data extent
> RS_Bounds mapExt = renderer->GetBounds();
>
> //get the map extent of the image
> //TODO: need to transform to destination coordinate system
> RS_Bounds imgExt = raster->GetExtent();
>
> //intersect the image extent with the requested map extent
> RS_Bounds intExt = RS_Bounds::Intersect(mapExt, imgExt);
>
> //if raster bounds outside map extent, don't stylize
> if (intExt.IsValid())
> {
> .....
>
>
>
> As long as your RESAMPLE is implemented correctly, I don't see why there
> would be a problem. Note that MapGuide reads the raster that comes out
> of the computed property (i.e. the resampled raster).
Traian,
OK, this gives me something to dig into.
Thanks!
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
More information about the Fdo_dev
mailing list