Shape file Extents

7 messages Options
Embed this post
Permalink
Shaik Esu

Shape file Extents

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Traian Stanev

RE: Shape file Extents

Reply Threaded More More options
Print post
Permalink

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: [hidden email] [mailto:[hidden email]] 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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Shaik Esu

RE: Shape file Extents

Reply Threaded More More options
Print post
Permalink
Hi Traian,

Thank You very much for your quick reply,

I am using C#.net. I know c++ also. I can convert this code to c#..

Thank You once again...


 

Regards,

Shaik Esu,

Sr Software Engineer,

Infotech Enterprises Ltd,

Extn: 740.

Mobile +91 9849538712.


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] 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: [hidden email]
[mailto:[hidden email]] 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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users

_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Shaik Esu

RE: Shape file Extents

Reply Threaded More More options
Print post
Permalink
In reply to this post by Traian Stanev
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: [hidden email]
[mailto:[hidden email]] 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: [hidden email]
[mailto:[hidden email]] 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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users

_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Jason Birch

RE: Shape file Extents

Reply Threaded More More options
Print post
Permalink
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-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Donald Cameron

RE: Shape file Extents

Reply Threaded More More options
Print post
Permalink
Hi Jason,

I have created a chapter called FDO Cookbook in the FDO Developers Guide. It contains C# snippets for a lot of things. I gave Greg Boone a copy of it for posting to the osgeo site. I would attach it to this email except that it is 1MB, which exceeds the limit of 256KB.

Don

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Jason Birch
Sent: Tuesday, October 14, 2008 12:28 PM
To: FDO Users Mail List; FDO Internals Mail List
Subject: RE: [fdo-users] Shape file Extents

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-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
sathishpsk9

Re: Shape file Extents

Reply Threaded More More options
Print post
Permalink
In reply to this post by Shaik Esu
Hi Shaik Esu ,

I am using Mapguide 2.0 and .net environment .......... i need to work shape file ..... i have seen your code for getting extents ..........but i do know how to use FDO api in my application to work with shape file can you please guide me in right direction

Thanks & Regards,
Satish Kumar Pambala