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

SharpMap website demo? (2.0 beta)

Topics: Data Access
Nov 7, 2008 at 11:03 PM
Hi does anybody know where can i get MS SQL Server DB Backup to test SharpMap website demo? (2.0 beta)
Nov 8, 2008 at 7:18 PM
Edited Nov 9, 2008 at 2:30 PM
Unfortunately the db's I use for testing contain non public domain data and cannot be distributed.


You can create an MsSqlSpatial database using the command line tool msscmd (download and build MsSqlSpatial from ) you can also import shapefiles using msscmd. 
Note MsSqlSpatial primary keys are always of type Int64

+++++++++Sql Server 2008+++++++++++

You do not *need* any extra functionality to be depolyed with sql server 2008 however some options require SqlSpatialTools from 

the only requirement for a spatial table is that it has a geometry column and a primary key (of any valid datatype)
extra options require envelope columns for the Geometry column in the form

(repeat for MaxX and MaxY) where [$columnName] is the name of your Geometry column

so for example a 'Cities' table with primary key called 'oid' of type bigint and with a geometry column called 'Geom' and with the *optional* envelope columns may look like (I wish codeplex didnt unformat everything so badly):



TABLE [dbo].[Cities](



[oid] [bigint] IDENTITY(1,1) NOT NULL,






[Geom] [geometry] NULL,
[NAME] [varchar] (25) NULL,

 [POPULATION] [float] 


 [CAPITAL] [char]

(1) NULL,


AS ([Geom].[STPointN]((1)).STX) PERSISTED


AS ([Geom].[STPointN]((1)).STY) PERSISTED


AS ([Geom].[STPointN]((3)).STX) PERSISTED, 

AS ([Geom].[STPointN]((3)).STY) PERSISTED,





[oid] ASC )










once you have the table you will probably want to add a spatial index to it - Sql Management Studio always baulks when I try and do this through the wizard so I always do it via sql


then you use an  MsSqlServer2008Provider<TPrimaryKey> where TPrimaryKey is the Clr equivalent type for the datatype of the tables' primary key

so for our table ablove it would be  MsSqlServer2008Provider<Int64> 

In the demo code you will notice that all the real providers are wrapped in a AppStateMonitoringFeatureProvider
the purpose of which is to prevent processing of a map when the browser has stopped waiting (useful for large datasets / maps) 

So in short you need to create some data and then modify the DemoMapSetupUtility to create layers using your new data.
Notice that the Srid of the IGeometryFactory must match the srid of the data in the db

I have got to go.. I will try and update this soon, perhaps even to the point of legibility! hth jd

Nov 8, 2008 at 8:02 PM
Thks for reply
I will try to make it work locally
I need to make a decision whatever to use this product before Monday