[fdo-internals] [fdo-users] Shape file Extents

Donald Cameron donald.cameron at autodesk.com
Wed Oct 15 11:31:14 EDT 2008


Am I missing anything Dan?


using OSGeo.FDO.Connections;
using OSGeo.FDO.Commands.SpatialContext;
using OSGeo.FDO.Geometry;

IGetSpatialContexts getSpatialContexts = connection.CreateCommand(CommandType.CommandType_GetSpatialContexts) as IGetSpatialContexts;
ISpatialContextReader reader = getSpatialContexts.Execute();
IGeometry geom = null;
byte[] extentAsByteArr = null;
string extentAsText = null;
FgfGeometryFactory geomFactory =  = new FgfGeometryFactory();
while (reader.ReadNext())
{
        extentAsByteArr = reader.GetExtent();
      // if extent type is dynamic and no geometries have been added
      // the extent can be null
      if (extentAsByteArr != null)
      {
        geom = geomFactory.CreateGeometryFromFgf(extentAsByteArr);
        extentAsText = geom.Text;
      }
      else
      {
        extentAsText = "No extent found";
      }
}

-----Original Message-----
From: fdo-internals-bounces at lists.osgeo.org [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Dan Stoica
Sent: Wednesday, October 15, 2008 11:02 AM
To: FDO Internals Mail List
Subject: RE: [fdo-internals] [fdo-users] Shape file Extents

As a reminder, the spatial context extents are dynamic in the SHP provider case.

Therefore you can get the extents by using GetSpatialContexts command.

Don, do you volunteer to write a snippet?

Thanks,
Dan.

-----Original Message-----
From: fdo-internals-bounces at lists.osgeo.org [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Jackie Ng
Sent: Tuesday, October 14, 2008 11:31 PM
To: fdo-internals at lists.osgeo.org
Subject: RE: [fdo-internals] [fdo-users] Shape file Extents


That would be wonderful. I'm sure I can pull many useful snippets out of the
FDO Toolbox code that may be of great use.

- Jackie


Jason Birch wrote:
>
> Hey, that's cool...
>
> I wonder if we should have a "Code Snippets" page on the wiki for things
> like this.
>
> Anyone have any objections?  If not, I'll set one up.
>
> Jason
>
> -----Original Message-----
> From: Shaik Esu
> Subject: RE: [fdo-users] Shape file Extents
>
> 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_S
> elec
> 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;
>
>         }
>
> _______________________________________________
> fdo-internals mailing list
> fdo-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-internals
>
>

--
View this message in context: http://n2.nabble.com/RE%3A--fdo-users--Shape-file-Extents-tp1333271p1335485.html
Sent from the FDO Internals mailing list archive at Nabble.com.

_______________________________________________
fdo-internals mailing list
fdo-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-internals
_______________________________________________
fdo-internals mailing list
fdo-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-internals


More information about the fdo-internals mailing list