I'm using SharpMap 0.9 to read various MapInfo (.tab) files.
I have used a number of files without any problem and been able to perform intersection queries on them like so:
var interesectionResults = provider.ExecuteIntersectionQuery(geometry);
where the provider is created like so:
var layerLocation = new FileInfo(_layerDirectory.FullName + "\\" + layerName +FileExtension);
if (!layerLocation.Exists)
throw new Exception(string.Format("Could not locate the layer data file, {0}", layerLocation));
return new Ogr(layerLocation.FullName);
The geometry used in ExecuteIntersectionQuery is defined as follows:
var cadastreProvider = GetLayerProvider(Settings.Default.PropertyLayerName);
//Query cadastre to get property bounding box
var query = String.Format("SELECT * FROM {0} WHERE {1} = {2}", cadastreProvider.LayerName, Settings.Default.PropertyKeyField, propertyID);
var propertyResults = cadastreProvider.ExecuteQuery(query);
var resultsTable = propertyResults.Tables.First();
var propertyFeatureRow = resultsTable.Rows[0] as FeatureDataRow
var geometry = propertyFeatureRow.Geometry
For a particular set of new MapInfo files I have recevied for a client everytime I do the intersection query the following error is thrown
System.ApplicationException was caught
Message=TopologyException: side location conflict 402348 6.9506e+006 1.7e-308
Source=ogr_csharp
StackTrace:
at OSGeo.OGR.Layer.GetNextFeature()
at SharpMap.Data.Providers.Ogr.ExecuteIntersectionQuery(FeatureDataSet ds) in E:\Investigation\GIS\Sharpmap\Sharpmap src\Trunk\SharpMap.Extensions\Data\Providers\OgrProvider.cs:line 483
at SharpMap.Data.Providers.Ogr.ExecuteIntersectionQuery(Geometry geom, FeatureDataSet ds) in E:\Investigation\GIS\Sharpmap\Sharpmap src\Trunk\SharpMap.Extensions\Data\Providers\OgrProvider.cs:line 465
at SharpMap.Data.Providers.Ogr.ExecuteIntersectionQuery(Geometry geom) in E:\Investigation\GIS\Sharpmap\Sharpmap src\Trunk\SharpMap.Extensions\Data\Providers\OgrProvider.cs:line 735
at IFMA.Common.GIS.MapInfo.Implementation.GetLandAttributesForLayerByPropertyID(String propertyID, String layerName, Boolean displayLayerDetails, String layerIdentifierField, String layerDescriptionField, Int32 queryType) in E:\Common\Current\01- Trunk\GIS\Implementations\IFMA.Common.GIS.MapInfo\Implementation.cs:line 145
at IFMA.MasterPlan.BusinessLogic.PropertySystemManager.GetApplicationPropertiesLandAttributes(Application application, Nullable`1 systemVersion) in E:\MP\Current\03- Working\IFMA.MasterPlan.BusinessLogic\PropertySystemManager.cs:line 211
InnerException:
I can't seem to find much information about this error but I gather its at least being thrown by the underlying provider (OGR) that Sharpmap uses to read MapInfo files.
Has anyone got an idea what might be causing this?