[fdo-users] How to retrieve the Oracle Spatial Data

Shaik Esu ShaikEsu at infotechsw.com
Fri Oct 31 00:03:42 EDT 2008


Hi All,

 

I want to retrieve the Geometry stored in oracle spatial.

 

I have written the below code 

 

        private IProviderRegistry FDORegistry =
FeatureAccessManager.GetProviderRegistry();

        private IConnectionManager FDOManager =
FeatureAccessManager.GetConnectionManager();

        private IConnection FDOConnection =
FeatureAccessManager.GetConnectionManager().CreateConnection("OSGeo.KingOrac
le.3.3");

        public ConnectionState Constate;

        string featureclsname;

      

        public FDOKingOracleClass(string username,string password,string
servicename,string featureclassname)

        {

 

 
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("Username",
username);

 
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("Password",
password);

 
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("Service",
servicename);

 
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("OracleSchema"
, servicename);

 
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("KingFdoClass"
, featureclassname);

            featureclsname = featureclassname;

 

           Constate =  FDOConnection.Open();

        }

 

 

I am able to open the connection without any error. but I could not able to
retrieve the geometry collection.

 

I am getting the error in below code..

 

 

      public GeometryCollection SelectAllQuery()

        {

            GeometryCollection Geo_Collection = new GeometryCollection();

            try

            {

                ISelect sel =
(ISelect)FDOConnection.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandT
ype_Select);

                sel.SetFeatureClassName(featureclsname);

                //  sel.LockType =
OSGeo.FDO.Commands.Locking.LockType.LockType_Unsupported;

 

 

                IFeatureReader FDOReader = sel.Execute();

                 FgfGeometryFactory gFac = new FgfGeometryFactory();

                while (FDOReader.ReadNext())

                {

                    Byte[] Tmppts = FDOReader.GetGeometry("Geometry");

                    Geo_Collection.Add(gFac.CreateGeometryFromFgf(Tmppts));

                }

 

            

            }

            catch(OSGeo.FDO.Common.Exception ex)

            {

                MessageBox.Show(ex.Message.ToString());

                

            }

            return Geo_Collection;

        }

 

 

 

 

If anybody has the code to retrieve the spatial data, please help me.

 

 Thank You,

 

 

 

Regards,

Shaik Esu,

Sr Software Engineer,

Infotech Enterprises Ltd,

Extn: 740.

Mobile +91 9849538712.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fdo-users/attachments/20081031/a9b2e0d0/attachment-0001.html


More information about the fdo-users mailing list