[fdo-users] OSGeo.PostgreSQL.3.5 Provider IGetSpatialContexts

Brent Robinson brent.robinson at autodesk.com
Wed Jun 9 08:44:10 EDT 2010


Hi Hanko,

You will need to create a spatial context for the coordinate system before creating the feature schema. This can be done with the ICreateSpatialContext command. The Spatial Context Name for the command can be set to anything, and CoordinateSystem to "3007". 

When creating the FeatureSchema, geom.SpatialContextAssociation would be set to the Spatial Context Name.

Brent. 



-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of hanko
Sent: Wednesday, June 09, 2010 3:50 AM
To: fdo-users at lists.osgeo.org
Subject: [fdo-users] OSGeo.PostgreSQL.3.5 Provider IGetSpatialContexts


Hi all, 

I'm using the FDO to connect to PostGIS  ("OSGeo.PostgreSQL.3.5")
I have created a new postgis database 'gisdb' with  ICreateDataStore command
. 
I n pgAdmin III I can see that it was created with schema 'public' that
contains two tables geometry_columns and spatial_ref_sys. 

Then I tryed to create a new FeatureSchema. For GeometricPropertyDefinition 
geom I defined 
geom.SpatialContextAssociation = "3007"; 	//Srid
When I tryed to apply a new created  FeatureSchema I gott an exception:

Message:	"Schema MySchema has errors; cannot apply it "
InnerException = {"The spatial context name associated with geometry
property 'GEOMETRY' of the feature class 'Water' not found "}

I used a  function GetSpatialContexts() that should list all spatial context
but it returned nothinhg.

       
public ReadOnlyCollection<SpatialContextInfo> GetSpatialContexts()
{
	List<SpatialContextInfo> contexts = new List<SpatialContextInfo>();
	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 == ConnectionState.ConnectionState_Open)
	{
		using (IGetSpatialContexts get =
FDOConnection.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_GetSpatialContexts)
as IGetSpatialContexts)
		{
			get.ActiveOnly = false;
			using (ISpatialContextReader reader = get.Execute())
			{
				while (reader.ReadNext())	//nothing returned
				{
					SpatialContextInfo info = new SpatialContextInfo(reader);
					contexts.Add(info);
				}
			}
		} 
	}
	return contexts.AsReadOnly();
}

Any ideas?

Thank in advance
Hanko
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/OSGeo-PostgreSQL-3-5-Provider-IGetSpatialContexts-tp5157165p5157165.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