[fdo-internals] How to get the four corners from a (raster data type) Feature
Alfredo Muela-Romero
alfredo.muela at pds.nl
Thu Apr 11 08:00:46 PDT 2013
Hi everyone again,
As an update to this topic, I am trying to solve this problem from a
different angle: getting through a command the FdoIGetSpatialContexts, and
accessing the FdoIEnvelope from FdoISpatialContextReader -> GetExtent and
converting the FdoByteArray to a FdoIGeometry.
By doing this, I can easily access to the extents of all the features.
However, if I cannot find the minX, minY, maxX and maxY values that are
expected.
A snippet of the code (based on SpatialContextTests::test_create_delete and
ArcSDETests::get_extent):
FdoPtr < FdoIGetSpatialContexts > cmdGetSpatialContexts =
provider->createCommand< FdoIGetSpatialContexts >(
FdoCommandType_GetSpatialContexts );
if (cmdGetSpatialContexts)
{
cmdGetSpatialContexts->SetActiveOnly( false );
FdoPtr < FdoISpatialContextReader > scReader =
cmdGetSpatialContexts->Execute();
while (scReader->ReadNext())
{
FdoStringP name = scReader->GetName();
std::string str = std::string(static_cast<const char *> (name));
// Get extent:
FdoPtr<FdoByteArray> fgfArray = scReader->GetExtent();
// Convert spatial context's extent to a FdoIEnvelope:
FdoPtr<FdoFgfGeometryFactory> fgfFactory =
FdoFgfGeometryFactory::GetInstance();
FdoPtr<FdoIGeometry> geom =
fgfFactory->CreateGeometryFromFgf(fgfArray);
FdoPtr<FdoIEnvelope> geomEnvelope = geom->GetEnvelope();
// Convert envelope to minx/miny/maxx/maxy:
double minx = geomEnvelope->GetMinX();
double miny = geomEnvelope->GetMinY();
double maxx = geomEnvelope->GetMaxX();
double maxy = geomEnvelope->GetMaxY();
}
}
Thanks in advance,
Alfredo.
On Wed, Apr 10, 2013 at 12:20 PM, Alfredo Muela-Romero <alfredo.muela at pds.nl
> wrote:
> Hi everyone,
>
> Given a Feature class (in particular a raster data one, although I guess
> it can be generalized), I am trying to figure out the four corners
> (assuming same "z"-dimension).
>
> The approach is to execute a SQL command to retrieve MINX, MINY, MIZ,
> MAXX, MAXY, MAXZ from SDE.LAYERS with the appropriate owner and table. From
> those two coordinates that the z-dimension equality can be checked and the
> 4 corners defined.
>
> With that approach I get the expected values... usually. In other words,
> there are some features when the values from the query are hugely
> different. In order to validate the results, I use ArcCatalog to compare
> the Top, Left, Right and Bottom values from the Extent property.
>
> My questions are:
> - can anyone shed some light on why is that happening?
> - should I use a different approach to get this information?
>
>
> Many thanks,
> Alfredo.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/fdo-internals/attachments/20130411/41125638/attachment.html>
More information about the fdo-internals
mailing list