As of revision 63679 the SpatiaLite provider originally created by
and further developed by
is part of the SharpMap.Extensions project.
Advertised as a complete spatial DBMS in a nutshell, SpatiaLite is an extension to the popular SQLite database engine, developed and maintained by Alessandro Furieri.
In order to use the SpatiaLite provider for SharpMap you need to do the following:
- Get native SpatiaLite binaries from
SpatiaLite download page. You need at least
- libspatialite-win-x86 ... .zip-File *)
- proj-win-x86 ... .zip, geos-win-x86 ... .zip, libiconv-win-x86 ... .zip *) **)
- Extract the native DLL files to one directory.
Setup your Project
- Reference SharpMap and SharpMap.Extensions Assembly to your project.
- If not already present, add app.config / web.config file to your project. Add the following settings to it. Be sure to change the value for SpatiaLitePath to the folder you chose above.
<add key="SpatiaLitePath" value="D:\GIS\SpatiaLite\2.4.0"/>
The following key is needed, since SpatiaLite v2.3.1 library was
named 'libspatialite-1.dll' by accident whereas as v2.2, v2.3.0
and v2.4RC are named 'libspatialite-2.dll.
Perhaps there will even be a v3.x?
<add key="SpatiaLiteNativeDll" value="libspatialite-2.dll"/>
Construction of the provider
The constructor of the SpatiaLite provider takes four arguments
||Sample: Data Source=<path to spatialite database file>;[Password=<super secret password>;] For more information on connection strings to SQLite database files see
||Name of the spatially enabled table.
||Name of the column that holds the geometry information. It is necessary that the combination of TableName and GeometryColumn has a valid entry in the 'geometry_columns' table of the SpatiaLite database file, because from this information, the possible
usage of a spatial index is set up.
||Name of the unique feature identifier.
See WinFormsSample project for usage example.
*) If you need x64 binaries you are -at the moment- on your own, since they are currently not provided.
**) For SpatiaLite 2.4 proj, geos and libiconv have been put together into a dependency-win-x86 zip-File.