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)
Coordinator
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.

++++++++++MsSqlSpatial++++++++++++

You can create an MsSqlSpatial database using the command line tool msscmd (download and build MsSqlSpatial from http://www.codeplex.com/MsSqlSpatial ) 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 http://www.codeplex.com/sqlspatialtools 

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

[$columnName]_Envelope_MinX,
[$columnName]_Envelope_MinY
(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):

CREATE

 

TABLE [dbo].[Cities](

 

 

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

 

 

 

 

 

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

 [POPULATION] [float] 

NULL,

 [CAPITAL] [char]

(1) NULL,

 [Geom_Envelope_MinX] 

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

 [Geom_Envelope_MinY]

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

 [Geom_Envelope_MaxX]

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

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

PRIMARY

 

KEY CLUSTERED

(

[oid] ASC )

 

 

 

 

WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] )

 

 

 

ON [PRIMARY]

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

see http://msdn.microsoft.com/en-us/library/bb934196.aspx 

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> 

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