[[PageOutline]] This page is an FDO Code Snippet. Visit the CodeSnippets page to view more! = Calculating Static Extents = Some providers require that you perform a !SelectAggregates on a dataset to determine its extents, specifiying the !SpatialExtents function as one of the properties to calculate. == C++ Example == {{{ #!cpp FdoPtr agg = (FdoISelectAggregates*)con->CreateCommand(FdoCommandType_SelectAggregates); agg->SetFeatureClassName(L"MyFeatureClass"); FdoPtr props = agg->GetPropertyNames(); FdoPtr exp = FdoExpression::Parse(L"SpatialExtents(GEOMETRY)"); FdoPtr se = FdoComputedIdentifier::Create(L"Extents", exp); props->Add(se); FdoPtr extrdr = agg->Execute(); extrdr->ReadNext(); FdoPtr ba = extrdr->GetGeometry(L"Extents"); //ba contains the extents polygon, in FGF array form, use FdoIGeometry APIs to get the numbers out of it. }}} == C# Example == {{{ #!cpp public IPolygon GetExtents() { IPolygon retpolygon; ISelectAggregates pselagree = (ISelectAggregates)FDOConnection.CreateCommand(CommandType.CommandType_SelectAggregates); pselagree.SetFeatureClassName(System.IO.Path.GetFileNameWithoutExtension(OpenedFile)); // Path and name of the shape file.... IdentifierCollection props = pselagree.PropertyNames; Expression exp = Expression.Parse("SpatialExtents(Geometry)"); ComputedIdentifier se = new ComputedIdentifier("Extents", exp); props.Add(se); IDataReader FDOReader = pselagree.Execute(); FgfGeometryFactory GeoFac = new FgfGeometryFactory(); FDOReader.ReadNext(); Byte[] Tmppts = FDOReader.GetGeometry("Extents"); IGeometry Geo = GeoFac.CreateGeometryFromFgf(Tmppts); retpolygon = (IPolygon)Geo; return retpolygon; } }}} == Contributors == * Traian Stanev * Shaik Esu