Hello,
I've come across an issue when I am using a SpatialCondition Filter on my SelectFeature Command towards my oracle database.
If I dont add the filter everything runs great, but when I add a SpatailCondition I get the error message "Spatial Context '' not found ".
Here is how my code works in VB.net
Dim connManager as OSGeo.FDO.IConnectionManager = OSGeo.FDO.ClientServices.FeatureAccessManager.GetConnectionManager() Dim conn As OSGeo.FDO.Connections.IConnection = connManager.CreateConnection("Autodesk.Oracle.3.9") conn.ConnectionString = "Service=Database;Username=Username;Password=Password;Datastore=Data" conn.Open() Dim selCmdLine As OSGeo.FDO.Commands.Feature.ISelect = conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Select) selCmdLine.FeatureClassName = New OSGeo.FDO.Expression.Identifier("VIEW") Dim geometryFactory As New OSGeo.FDO.Geometry.FgfGeometryFactory() Dim polystring As String = "POLYGON ((148697.589 6585101.768, 148697.589 6585091.695, 148722.198 6585091.695, 148722.198 6585101.768, 148697.589 6585101.768))" Dim poly As OSGeo.FDO.Geometry.IPolygon = CType(geometryFactory.CreateGeometry(polystring), OSGeo.FDO.Geometry.IPolygon) Dim byteArray As Byte() = geometryFactory.GetFgf(poly) Dim qryGeomVal As OSGeo.FDO.Expression.GeometryValue = New OSGeo.FDO.Expression.GeometryValue(byteArray) selCmdLine.Filter = New OSGeo.FDO.Filter.SpatialCondition("SHAPE", OSGeo.FDO.Filter.SpatialOperations.SpatialOperations_Intersects, qryGeomVal) Dim ftrRdr As OSGeo.FDO.Commands.Feature.IFeatureReader = selCmd.Execute()
At the selCmdline.Execute() the exception occures.
I think it has something to do with that the geometry used in the spatialcondition does not have a specifed SRID as the other geometries in the database.
How can I specify the spatial context for the command?
Thankful for any help.
// Per
Hi Per,
did you look at the the Map developer samples which are shipped with the Map SDK?
I think there is one example regarding spatial queries,
Rob
I am trying to replicate this code but I am getting an error >>"The property "SHAPE" is not in the reader's selected property set"<<.
I can connect to my shp file and obtain all of the features but I need to filter by a user selected rectangle.
Does anyone have working code for using a polygon for "OSGeo.FDO.Filter.SpatialCondition("SHAPE", OSGeo.FDO.Filter.SpatialOperations.SpatialOperations_Inside, gv);
There are some samples in the DevBlog but those are using "layers" attached to the current map - that's not what I want.
Can't find what you're looking for? Ask the community or share your knowledge.