[fdo-dev] Raster SetBounds()

Traian Stanev traian.stanev at autodesk.com
Thu Oct 5 12:04:48 EDT 2006

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 =
        FdoPtr<FdoIdentifier> rasterProp =
        FdoPtr<FdoDataValue> minX = FdoDataValue::Create(extent.minx,
        FdoPtr<FdoDataValue> minY = FdoDataValue::Create(extent.miny,
        FdoPtr<FdoDataValue> maxX = FdoDataValue::Create(extent.maxx,
        FdoPtr<FdoDataValue> maxY = FdoDataValue::Create(extent.maxy,
        FdoPtr<FdoDataValue> height = FdoDataValue::Create(devHeight);
        FdoPtr<FdoDataValue> width = FdoDataValue::Create(devWidth);

        FdoPtr<FdoFunction> clipFunc = FdoFunction::Create(L"RESAMPLE",

        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).



-----Original Message-----
From: Frank Warmerdam (External) 
Sent: Thursday, October 05, 2006 11:51 AM
To: FDO Developers
Subject: [fdo-dev] Raster SetBounds()

Folks (especially Greg and Bob),

When I started the fdogdal provider I came to understand that it was
legitimate for an FdoIRaster to modify the passed in bounds in a
SetBounds() call.  I think one case Greg and I discussed was modifying
the bounds to match a pixel boundary.

Based on that I thought it was acceptable for me to "snap to image
in the SetBounds() call.  That is, when an application calls SetBounds()
with a bounds that falls outside the bounds of the represented image, I
just trim the limits to the available image data.  I did this assuming
that the caller would be expected to call GetBounds() to learn the
actual detailed extents of the image that would be returned.

Last night I successfully tested fdogdal support in MapGuide (yipee!)
but I discovered that MapGuide is really expecting to get back the area
it asked for, which it does not when zoomed out such that part of the
map area is not covered by image.

Do I just need to buckle down and support any bounds in my provider?  Or
is this something that MapGuide is doing wrong?

Best regards,
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,

To unsubscribe, e-mail: dev-unsubscribe at fdo.osgeo.org For additional
commands, e-mail: dev-help at fdo.osgeo.org

More information about the Fdo-internals mailing list