[fdo-users] OSGeo.PostgreSQL.3.5 Provider Create Schema
Haris Kurtagic
haris at sl-king.com
Wed Jun 9 05:26:05 EDT 2010
oh, sorry I see now that you already wrote that it is missing geometry
Haris
On Wed, Jun 9, 2010 at 11:24 AM, Haris Kurtagic <haris at sl-king.com> wrote:
> haven't used Postgre provider, but from error desc perhaps issue is in
> missing geometry column in class def.
>
> Haris
>
> On Wed, Jun 9, 2010 at 11:19 AM, hanko
> <hana.jaborova at spatialtechnology.se> wrote:
>>
>>
>>
>> Hi all,
>> I'm using the FDO to connect to PostGIS 1.5 ("OSGeo.PostgreSQL.3.5")
>> I have created a new postgis database 'gisdb' with ICreateDataStore command
>> .
>>
>> When I'm trying to create a new simple Feature Schema without geometry I get
>> an exception
>>
>> Message "ShipSysSchema has errors; cannot apply it "
>> InnerException {"Error in Column
>> gisdb.public.geography_columns.f_geography_column: length or precision 0 is
>> less than minimum allowed (1) "} System.Exception
>> {OSGeo.FDO.Common.Exception}
>>
>> This problem is solved if I delete 'geography_columns' view in database.
>>
>> Function:
>>
>> public void CreateSchema()
>> {
>> IConnectionPropertyDictionary connProperties =
>> FDOConnection.ConnectionInfo.ConnectionProperties;
>> connProperties.SetProperty("Username", _userPostGIS);
>> connProperties.SetProperty("Password", _passwordPostGIS);
>> connProperties.SetProperty("Service", _servicePostGIS);
>> connProperties.SetProperty("DataStore", _dataStore);
>> FDOConnection.Open();
>> if (FDOConnection.ConnectionState ==
>> OSGeo.FDO.Connections.ConnectionState.ConnectionState_Open)
>> {
>> try
>> {
>> // Create a feature class for Ship
>> FeatureClass shipFeatureClass = new FeatureClass("Ship", "Description of
>> ship");
>>
>> // Create the ID
>> // Create ID Value - identity property
>> DataPropertyDefinition idProperty = new DataPropertyDefinition("ID",
>> "This is the identity property");
>> idProperty.DataType = DataType.DataType_Int64;
>> idProperty.IsAutoGenerated = true;
>> idProperty.Nullable = false;
>> idProperty.ReadOnly = true;
>> shipFeatureClass.Properties.Add(idProperty);
>> shipFeatureClass.IdentityProperties.Add(idProperty);
>>
>> // The name property
>> DataPropertyDefinition nameProperty1 = new DataPropertyDefinition("Name",
>> "the name of the ship");
>> nameProperty1.DataType = DataType.DataType_String;
>> nameProperty1.Length = 255;//
>> nameProperty1.Nullable = false;//null
>> shipFeatureClass.Properties.Add(nameProperty1);
>>
>> // The velocityProperty property
>> DataPropertyDefinition velocityProperty = new
>> DataPropertyDefinition("Velocity", "the Velocity of the ship");
>> velocityProperty.DataType = DataType.DataType_Double;
>> velocityProperty.Nullable = false;//null
>> shipFeatureClass.Properties.Add(velocityProperty);
>>
>> // construct the instance of FeatureSchema
>> FeatureSchema schema = new FeatureSchema("ShipSysSchema", "");
>> //
>> schema.Classes.Add(shipFeatureClass);
>> //
>> IApplySchema applySchema =
>> (IApplySchema)FDOConnection.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_ApplySchema);
>>
>> // set the schema to IApplySchema's feature schema
>> applySchema.FeatureSchema = schema;
>> //Execute the command
>> applySchema.Execute();
>> }
>> catch (System.Exception ex )
>> {
>> Console.WriteLine(ex.Message + " " + ex.InnerException);
>> }
>> }
>> }
>>
>> ny ideas?
>>
>> Thank in advance
>> Hanko
>> --
>> View this message in context: http://osgeo-org.1803224.n2.nabble.com/OSGeo-PostgreSQL-3-5-Provider-Create-Schema-tp5157464p5157464.html
>> Sent from the FDO Users mailing list archive at Nabble.com.
>> _______________________________________________
>> fdo-users mailing list
>> fdo-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/fdo-users
>>
>
More information about the fdo-users
mailing list