[fdo-users] inserting data into a SDF file

vinay vinay.tikka at eaglepoint.com
Fri Feb 20 08:26:19 EST 2009


Hi Dan
 
Thanks for the information.
 
regards
Vinay

-----Original Message-----
From: Dan Stoica (via Nabble)
[mailto:ml-user+64177-1235426992 at n2.nabble.com]
Sent: Friday, February 20, 2009 7:21 AM
To: vinay
Subject: RE: [fdo-users] inserting data into a SDF file


HI Vinay, 

Regarding creating spatial contexts and in general when you need a working
example: have a look into the SDF unit tests. 


Regards, 
Dan. 

-----Original Message----- 
From: fdo-users-bounces at ...
<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2358773&i=0>
[mailto: fdo-users-bounces at ...
<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2358773&i=1> ] On
Behalf Of vinay 
Sent: Thursday, February 19, 2009 10:35 PM 
To: fdo-users at ...
<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2358773&i=2>  
Subject: Re: [fdo-users] inserting data into a SDF file 


Hi Jackie, 

Thanks for the tip. It worked. Also thanks for making fdotoolkit app open 
source. It is very helpful for me to learn and understand different things 
related to FDO seeing your source code. 

I am having very hard time to understand spatialcontext concepts. When 
creating the datastore for the sdf file i am want to create a default 
spatialcontext but i am having difficulty in creating a default wkt 
coordinate system. Do you have any suggestions. 

Thanks in advance. 

regards 
Vinay 


Jackie Ng wrote: 

> 
> If you look at the property value collection of the insert command in the 
> debugger, you will see the count will increase in increments of 4. 
> 
> As a result, the insert command will use the same first 4 property values 
> for every insert operation. 
> 
> To fix this, clear the property value collection of the insert command 
> before setting the property values. 
> 
> Hope that helps. 
> 
> - Jackie 
> 
> 
> vinay wrote: 
>> 
>> Hi All, 
>> 
>> I am using the FDO dlls from the MAP ObjectArx SDK 2009  in Visual studio

>> 2008. I am writing a small app to understand FDO API. I am able to create

>> a sdf file, describe schema for the sdf file, create feature class, etc. 
>> I created four datapropertydefinitions in which one is an 
>> identityProperty. I am inserting values into my properties in a for-loop.

>> When I open this sdf file in map 2009, all columns have the same values 
>> except the auto generated property column as shown below. 
>> 
>> Please take a look in case I am missing something simple here. 
>> 
>>   http://n2.nabble.com/file/n2349739/data.png
<http://n2.nabble.com/file/n2349739/data.png> 
>> 
>> Source code snippets for the sample app is below 
>> 
>> OSGeo.FDO.Schema.FeatureSchema Schema = new 
>> OSGeo.FDO.Schema.FeatureSchema("SchemaOne", "Sample Schema"); 
>>                         OSGeo.FDO.Schema.FeatureClass ClassOne = new 
>> OSGeo.FDO.Schema.FeatureClass("Class one", "Class one for Schema One"); 
>> 
>> 
>>                         OSGeo.FDO.Schema.DataPropertyDefinition DataProp1

>> = new OSGeo.FDO.Schema.DataPropertyDefinition("Prop1", "Property one"); 
>>                         OSGeo.FDO.Schema.DataPropertyDefinition DataProp2

>> = new OSGeo.FDO.Schema.DataPropertyDefinition("Prop2", "Property two"); 
>>                         OSGeo.FDO.Schema.DataPropertyDefinition DataProp3

>> = new OSGeo.FDO.Schema.DataPropertyDefinition("Prop3", "Property three");

>>                         OSGeo.FDO.Schema.DataPropertyDefinition DataProp4

>> = new OSGeo.FDO.Schema.DataPropertyDefinition("Prop4", "Property four"); 
>>                         DataProp1.DataType = 
>> OSGeo.FDO.Schema.DataType.DataType_Int32; 
>>                         DataProp1.IsAutoGenerated = true; 
>>                         DataProp1.Nullable = false; 
>> 
>>                         DataProp2.DataType = 
>> OSGeo.FDO.Schema.DataType.DataType_Decimal; 
>>                         DataProp2.IsAutoGenerated = false; 
>>                         DataProp2.Nullable = false; 
>>                         DataProp2.ReadOnly = false; 
>> 
>>                         DataProp3.DataType = 
>> OSGeo.FDO.Schema.DataType.DataType_Decimal; 
>>                         DataProp3.IsAutoGenerated = false; 
>>                         DataProp3.Nullable = false; 
>>                         DataProp3.ReadOnly = false; 
>> 
>>                         DataProp4.DataType = 
>> OSGeo.FDO.Schema.DataType.DataType_String; 
>>                         DataProp4.IsAutoGenerated = false; 
>>                         DataProp4.Nullable = false; 
>>                         DataProp4.ReadOnly = false; 
>>                         DataProp4.Length = 20; 
>> 
>>                         //Class one data props 
>>                         ClassOne.Properties.Add(DataProp1); 
>>                         ClassOne.IdentityProperties.Add(DataProp1); 
>>                         ClassOne.Properties.Add(DataProp2); 
>>                         ClassOne.Properties.Add(DataProp3); 
>>                         ClassOne.Properties.Add(DataProp4); 
>> 
>> 
>> 
>> OSGeo.FDO.Connections.Capabilities.IConnectionCapabilities connCap = 
>> conn.ConnectionCapabilities; 
>>                         ITransaction fdoTrans = null; 
>>                         if (connCap.SupportsTransactions()) 
>>                             fdoTrans = conn.BeginTransaction(); 
>> 
>>                         using (OSGeo.FDO.Commands.Feature.IInsert insert 
>> = conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Insert) 
>> as OSGeo.FDO.Commands.Feature.IInsert) 
>>                         { 
>> 
>>                             for (int nIndex = 1; nIndex < 5; nIndex++) 
>>                             { 
>> 
>>                                 OSGeo.FDO.Commands.PropertyValue 
>> PropValue1 = null; 
>>                                 PropValue1 = new 
>> OSGeo.FDO.Commands.PropertyValue(); 
>>                                 PropValue1.SetName(DataProp1.Name); 
>>                                 PropValue1.Value = new 
>> OSGeo.FDO.Expression.Int32Value(nIndex); 
>>                                 insert.PropertyValues.Add(PropValue1); 
>> 
>>                                 PropValue1 = null; 
>>                                 PropValue1 = new 
>> OSGeo.FDO.Commands.PropertyValue(); 
>>                                 PropValue1.SetName(DataProp2.Name); 
>>                                 PropValue1.Value = new 
>> OSGeo.FDO.Expression.DecimalValue(1000.50 + nIndex); 
>>                                 insert.PropertyValues.Add(PropValue1); 
>> 
>>                                 PropValue1 = null; 
>>                                 PropValue1 = new 
>> OSGeo.FDO.Commands.PropertyValue(); 
>>                                 PropValue1.SetName(DataProp3.Name); 
>>                                 PropValue1.Value = new 
>> OSGeo.FDO.Expression.DecimalValue(2000.50 + nIndex); 
>>                                 insert.PropertyValues.Add(PropValue1); 
>> 
>>                                 PropValue1 = null; 
>>                                 PropValue1 = new 
>> OSGeo.FDO.Commands.PropertyValue(); 
>>                                 PropValue1.SetName(DataProp4.Name); 
>>                                 PropValue1.Value = new 
>> OSGeo.FDO.Expression.StringValue("Note"+nIndex.ToString()); 
>>                                 insert.PropertyValues.Add(PropValue1); 
>> 
>>                                 try 
>>                                 { 
>>                                     using 
>> (OSGeo.FDO.Commands.Feature.IFeatureReader reader = insert.Execute()) 
>>                                     { 
>>                                         while (reader.ReadNext()) { } 
>>                                     } 
>>                                 } 
>>                                 catch (Exception ex) 
>>                                 { 
>>                                     //throw new 
>> FeatureServiceException("Error inserting new feature", ex); 
>>                                     MessageBox.Show(ex.Message); 
>>                                 } 
>>                             } 
>>                         } 
>>                         if (connCap.SupportsTransactions()) 
>>                             fdoTrans.Commit(); 
>>                         conn.Close(); 
>> 
>> 
>> 
> 
> 

-- 
View this message in context:
http://n2.nabble.com/inserting-data-into-a-SDF-file-tp2349739p2356982.html
<http://n2.nabble.com/inserting-data-into-a-SDF-file-tp2349739p2356982.html>

Sent from the FDO Users mailing list archive at Nabble.com. 

_______________________________________________ 
fdo-users mailing list 
fdo-users at ...
<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2358773&i=3>  
http://lists.osgeo.org/mailman/listinfo/fdo-users
<http://lists.osgeo.org/mailman/listinfo/fdo-users> 
_______________________________________________ 
fdo-users mailing list 
fdo-users at ...
<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2358773&i=4>  
http://lists.osgeo.org/mailman/listinfo/fdo-users
<http://lists.osgeo.org/mailman/listinfo/fdo-users> 



   _____  

This email is a reply to your post @
http://n2.nabble.com/inserting-data-into-a-SDF-file-tp2349739p2358773.html
<http://n2.nabble.com/inserting-data-into-a-SDF-file-tp2349739p2358773.html>

You can reply by email or by visting the link above.





The information contained in this message is intended only for the
recipient, and may be privileged and confidential and protected from
disclosure. If the reader of this message is not the intended recipient, or
an employee or agent responsible for delivering this message to the intended
recipient, please be aware that any dissemination or copying of this
communication is strictly prohibited. If you have received this
communication in error, please immediately notify us by replying to the
message and delete it from your system. Eagle Point reserves the right,
subject to applicable local law, to monitor and review the content of any
electronic message or information sent to or from Eagle Point employee
e-mail addresses without informing the sender or recipient of the message. 



-- 
View this message in context: http://n2.nabble.com/inserting-data-into-a-SDF-file-tp2349739p2358800.html
Sent from the FDO Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fdo-users/attachments/20090220/a048a282/attachment-0001.html


More information about the fdo-users mailing list