Alternate to use for Mssql

Topics: SharpMap v2.0
Mar 11, 2010 at 5:33 PM

Hello,

I am new to using SharpMap. We used SharpMap v1 and now updating our systems to SharpMap v2. We used SharpMap.Data.Providers.MsSql to retrieve data but this is not available in SharpMap v2 and I cannot use MsSqlSpatial as the data is not in spatial format. So I would like to know if there is any alternative or in any way I can use the MsSql Data Provider.

MHV

Coordinator
Mar 11, 2010 at 6:49 PM

Hello MHV,

what prevents you from using spatial capabilities of sqlserver 2008, after all, there is a free express version available that can handle spatial data?
You might consider MsSqlSpatial extension for SqlServer 2005 if that is not an option for you. As far as I know there is no provider that does not
require spatial capabilities for the datasources.

Hth FObermaier

 

Coordinator
Mar 11, 2010 at 7:16 PM

Hi MHV, if you can use sql 2008 it would be trivial to add geometry columns. You can run an alter statement on your table to add the geometry column then run an update to create the geometries. It might look like:

ALTER TABLE MyTable
ADD COLUMN Geom geometry

.....

UPDATE TABLE MyTable
SET Geom = geometry::Point(XColumn, YColumn, 4326 /*srid of the data*/)

hth jd

Mar 11, 2010 at 7:24 PM

Hello Fobermaier,

Cannot use sqlserver 2008 as all our systems use sqlserver 2005. Also I was wrong in saying that we are not using spatial data as our data is in shape files in the Well Known Binary Format. Also the problem is that I cannot use extensions. Is there any way I can take data from sql server 2005 in the WKB Format and convert it to spatial data and then process it as an input for layer providers.

MHV

 

Mar 12, 2010 at 4:03 PM

Hello Everyone,

I have many shape files.... So is there anyone who has written a code to convert these shapefiles to MSSQL Server 2008 Spatial data format?

MHV

Coordinator
Mar 12, 2010 at 4:34 PM

Hi MHV , you could try the Demo.FormatConverter project in the v2 source tree.. Make sure you build the solution a couple of times before running it as it needs to copy binaries after the first build.

Also Morten has a tool at http://www.sharpgis.net/post/2007/12/23/Shapefile-to-SqlServer-2008-to-WPF.aspx 

 

hth jd

Mar 15, 2010 at 1:34 PM

Hey JD,

Thankyou. This worked for me.

MHV