Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
       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

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?

share|improve this question

This -probably- is pretty easy to fix. One or more of your polygons must have self-intersecting rings. This can usually be fixed performing a buffer operation on the dataset with a buffer distance of 0.

Hth FObermaier

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.