[fdo-users] Shape file Extents
Shaik Esu
ShaikEsu at infotechsw.com
Tue Oct 14 01:12:14 EDT 2008
Hi All,
Here is the c#.net code to get the extents of the featureclass.
This code might help the new programmers to FDO like me.
public IPolygon GetExtents()
{
IPolygon retpolygon;
ISelectAggregates pselagree =
(ISelectAggregates)FDOConnection.CreateCommand(CommandType.CommandType_Selec
tAggregates);
pselagree.SetFeatureClassName(System.IO.Path.GetFileNameWithoutExtension(Ope
nedFile));
IFeatureReader FDOReader = pselagree.Execute();
FgfGeometryFactory GeoFac = new FgfGeometryFactory();
Byte[] Tmppts = FDOReader.GetGeometry("Geometry");
IGeometry Geo = GeoFac.CreateGeometryFromFgf(Tmppts);
retpolygon = (IPolygon)Geo;
return retpolygon;
}
Regards,
Shaik Esu,
Sr Software Engineer,
Infotech Enterprises Ltd,
Extn: 740.
Mobile +91 9849538712.
-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org
[mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Traian Stanev
Sent: Tuesday, October 14, 2008 9:25 AM
To: 'FDO Users Mail List'
Subject: RE: [fdo-users] Shape file Extents
Are you using the C++ API or C# or? Generally you would use a
SelectAggregates command with the SpatialExtents() function added to its
list of properties to compute. In C++, it's something like this:
FdoPtr<FdoISelectAggregates> agg =
(FdoISelectAggregates*)con->CreateCommand(FdoCommandType_SelectAggregates);
agg->SetFeatureClassName(L"MyFeatureClass");
FdoPtr<FdoIdentifierCollection> props = agg->GetPropertyNames();
FdoPtr<FdoExpression> exp =
FdoExpression::Parse(L"SpatialExtents(GEOMETRY)");
FdoPtr<FdoComputedIdentifier> se =
FdoComputedIdentifier::Create(L"Extents", exp);
props->Add(se);
FdoPtr<FdoIDataReader> extrdr = agg->Execute();
extrdr->ReadNext();
FdoPtr<FdoByteArray> ba = extrdr->GetGeometry(L"Extents");
//ba contains the extents polygon, in FGF array form, use FdoIGeometry
APIs to get the numbers out of it.
In C# it's similar, but I don't have a code snippet lying around.
Traian
From: fdo-users-bounces at lists.osgeo.org
[mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Shaik Esu
Sent: Monday, October 13, 2008 11:46 PM
To: 'FDO Users Mail List'
Subject: [fdo-users] Shape file Extents
Hi all,
I am using FDO technology to work on Shape file.
I want to get the Extents (bounds) of a particular shape file. Please help
me in this regards
Thank You,
Regards,
Shaik Esu,
Sr Software Engineer,
Infotech Enterprises Ltd,
Extn: 740.
Mobile +91 9849538712.
_______________________________________________
fdo-users mailing list
fdo-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-users
More information about the fdo-users
mailing list