Using the demo Sharpmap project with DotSpatial

Topics: SharpMap Project
Nov 28, 2011 at 5:02 AM
Edited Nov 28, 2011 at 5:49 AM

Hi there.

I downloaded SharpMap to see if I could get it to work as a WMS for some South Pole imagery. I have a few questions and I am hoping that someone could help.

I'd like to specify that SharpMap uses the DotSpatial library for projections. I see that the downloaded SharpMap project is missing the DotSpatial dlls. I re-compiled the DotSpatial dlls, and referenced them in the respective projects, but I see pre-compiler tags all over the place for #if !DotSpatialProjections.

1. Is there a quick way to specify a #Define globally so that the compiler will assume I always want to use dotspatial? I tried something that is supposed to work in the config file... but that doesn't.

2. I placed "#define DotSpatialProjections" tags in all the relevant pages, and then noticed that the project does not compile. For example, in ShapeFile.cs, line 819 in the SharpMap.VS2010 project, I get the error "'DotSpatial.Projections.ProjectionInfo' does not contain a definition for 'ReadEsriString' and no extension method 'ReadEsriString' accepting a first argument of type 'DotSpatial.Projections.ProjectionInfo' could be found".

I can load the image I am looking for using the DotSpatials UI, but I don't think that comes with WMS functionality.

Am I missing something? Any assistance would be greatly appreciated.

Nov 28, 2011 at 7:51 AM


The published assemblys are built against Proj.NET as you realized. Probably the next release will be built against DotSpatial.

You can change all the conditions by right-clicking the project and from  properties/Build add a a Conditional compilation symbol 

Default: MaxBox
Change to: MapBox DotSpatialProjections



Nov 28, 2011 at 8:08 AM

Hi petlof


Thanks for the reply.

1. I assume that would be for the SharpMap project, as you can't set conditional compilation symbols on the web project?

2. Assuming I have set the conditional compilation correctly (I am doing this using #define statements at the moment), how do I resolve the build errors? Or is this not possible, and I need to look at another solution altogether?


Nov 28, 2011 at 8:24 AM

Alternatively, is there a way to get Proj.Net to work with Polar Stererographic projection? At the moment it doesn't from what I experienced. If it did, then I suppose I could leave it using Proj.Net.