This project has moved and is read-only. For the latest updates, please go here.

Attempt with SpatiaLite 64 bit failing.

Topics: Data Access, SharpMap v0.9 / v1.x
Feb 27, 2013 at 8:29 PM
vs2010; The current trunk as of this AM;Windows 7

I cannot seem to load the 64 bit spatailite dll. SQLite seems to load just fine for 64 bit. I am using: spatialite-3.0.1-DLL-win-amd64 downloaded today.

Output Window:
Trying to load native SQLite library "C:\aSrc\CampusMapperV1\bin\x64\SQLite.Interop.dll"...
.....this is what follows when I load the amd64 .... when I access the mapBox
var cm = new SQLiteCommand(String.Format("SELECT load_extension('{0}');", SpatiaLiteNativeDll), cn);
......crash and burn....

at System.Data.SQLite.UnsafeNativeMethods.sqlite3_step(IntPtr stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
at SharpMap.Data.Providers.SpatiaLite.SpatiaLiteConnection(String connectionString) in C:\Software\SVN_SharpMap\SharpMap.Extensions\Data\Providers\SpatiaLite.cs:line 122
at SharpMap.Data.Providers.SpatiaLite.GetGeometriesInView(Envelope bbox) in C:\Software\SVN_SharpMap\SharpMap.Extensions\Data\Providers\SpatiaLite.cs:line 313
at SharpMap.Layers.VectorLayer.RenderInternal(Graphics g, Map map, Envelope envelope) in C:\Software\SVN_SharpMap\SharpMap\Layers\VectorLayer.cs:line 382
at SharpMap.Layers.VectorLayer.Render(Graphics g, Map map) in C:\Software\SVN_SharpMap\SharpMap\Layers\VectorLayer.cs:line 240
at SharpMap.Map.RenderMap(Graphics g, LayerCollectionType layerCollectionType, Boolean drawMapDecorations) in C:\Software\SVN_SharpMap\SharpMap\Map\Map.cs:line 540
at SharpMap.Forms.MapBox.GetMap(Map map, LayerCollection layers, LayerCollectionType layerCollectionType, Envelope extent) in C:\Software\SVN_SharpMap\SharpMap.UI\Forms\MapBox.cs:line 894
at SharpMap.Forms.MapBox.GetImagesAsync(Envelope extent, Int32 imageGeneration) in C:\Software\SVN_SharpMap\SharpMap.UI\Forms\MapBox.cs:line 934
at SharpMap.Forms.MapBox.<>c__DisplayClass13.<UpdateImage>b__10(Object ) in C:\Software\SVN_SharpMap\SharpMap.UI\Forms\MapBox.cs:line 1126
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Looks like a SpatiaLite problem to me but maybe you can confirm.
Feb 28, 2013 at 7:35 AM
Although i have not tried it yet, I suspect that System.Data.SQLite.Interop does not play nicely with SpatiaLite.
The reason is probably that System.Data.SQLite(.Interop) is comiled using Microsoft's C-Compiler while SpatiaLite with MinSys/MinGW and even be linked against a different version of SQLite.

If you just need it for rendering purposes, try petlof's ManagedSpatiaLite provider.

Hth FObermaier
Feb 28, 2013 at 9:44 AM
Mar 1, 2013 at 6:12 AM

I used the new _ petlof's ManagedSpatiaLite provider_ and it seems to work just fine. Hopefully I will be able to use NetTopologySuite for those other methods I employed SpatiaLite for.
Would you be willing to share the plan for the OLD SpatiaLite provider? In reading some of the threads in the spatialite google group it would appear this particular DLL hell will eventually get resolved but....who knows when.

I am also curious as to when a new release of SharpMap should be expected. No pressure... I am just curious.