This page is an FDO Code Snippet. Visit the CodeSnippets page to view more!

Calculating Dynamic Extents

The easiest and most efficient way of determining extents from a provider that supports dynamic extents is to use the GetSpatialContext command.

C# Example

  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;
      extentAsText = "No extent found";

C++ Example

  Please add here!


  • Donald Cameron
Last modified 14 years ago Last modified on Oct 15, 2008, 10:01:17 AM
Note: See TracWiki for help on using the wiki.