[fdo-trac] #15: Missing Raster Extents
FDO
trac_fdo at osgeo.org
Wed Feb 21 00:27:52 EST 2007
#15: Missing Raster Extents
---------------------------+------------------------------------------------
Reporter: warmerdam | Owner: warmerdam
Type: defect | Status: new
Priority: major | Milestone: 3.3.0
Component: GDAL Provider | Version: 3.2.0
Severity: 2 | Resolution:
Keywords: | External_id:
---------------------------+------------------------------------------------
Old description:
> MapGuide does not know the default extents for raster data coming from
> the GDAL raster
> provider.
>
> Traian reports:
> {{{
> You need to make sure that your FdoISpatialContextReader::GetExtent()
> returns correct extents for the rasters you are connected to. If it
> already does that, then we would have to dig deeper, but I think that
> should be sufficient.
>
> Fyi, this is what I am using in the OGR provider, and it works most of
> the time:
>
> FdoByteArray* OgrSpatialContextReader::GetExtent()
> {
> OGREnvelope e;
> /*OGRErr err =*/
> m_connection->GetOGRDataSource()->GetLayer(m_nIndex)->GetExtent(&e,
> TRUE);
>
> //generate FGF polygon and return as refcounted byte array
> double coords[10];
> coords[0] = e.MinX;
> coords[1] = e.MinY;
> coords[2] = e.MaxX;
> coords[3] = e.MinY;
> coords[4] = e.MaxX;
> coords[5] = e.MaxY;
> coords[6] = e.MinX;
> coords[7] = e.MaxY;
> coords[8] = e.MinX;
> coords[9] = e.MinY;
> FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
> FdoPtr<FdoILinearRing> lr = gf->CreateLinearRing(FdoDimensionality_XY,
> 10, coords);
> FdoPtr<FdoIPolygon> fgfgeom = gf->CreatePolygon(lr, NULL);
> return gf->GetFgf(fgfgeom);
> }
> }}}
New description:
MapGuide does not know the default extents for raster data coming from the
GDAL raster
provider.
Traian reports:
You need to make sure that your FdoISpatialContextReader::GetExtent()
returns correct extents for the rasters you are connected to. If it
already does that, then we would have to dig deeper, but I think that
should be sufficient.
Fyi, this is what I am using in the OGR provider, and it works most of the
time:
{{{
FdoByteArray* OgrSpatialContextReader::GetExtent()
{
OGREnvelope e;
/*OGRErr err =*/
m_connection->GetOGRDataSource()->GetLayer(m_nIndex)->GetExtent(&e, TRUE);
//generate FGF polygon and return as refcounted byte array
double coords[10];
coords[0] = e.MinX;
coords[1] = e.MinY;
coords[2] = e.MaxX;
coords[3] = e.MinY;
coords[4] = e.MaxX;
coords[5] = e.MaxY;
coords[6] = e.MinX;
coords[7] = e.MaxY;
coords[8] = e.MinX;
coords[9] = e.MinY;
FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
FdoPtr<FdoILinearRing> lr = gf->CreateLinearRing(FdoDimensionality_XY, 10,
coords);
FdoPtr<FdoIPolygon> fgfgeom = gf->CreatePolygon(lr, NULL);
return gf->GetFgf(fgfgeom);
}
}}}
--
Ticket URL: <http://trac.osgeo.org/fdo/ticket/15#comment:1>
FDO <http://fdo.osgeo.org/>
Feature Data Objects
More information about the fdo-trac
mailing list