This project has moved. For the latest updates, please go here.

Sharpmap library references in C#

Topics: SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0
Feb 28, 2011 at 3:14 PM

Hello all,

I am trying to convert albers coordinates into Lat and Long coordinates so that I can display mapping information on Bing maps.  I see a great conversion routine here that does what I want (seemingly), but I am at a quandary as to what to do about the "using" reference line near the top.  For instance, when I hover on one of these lines in the page described above, I get a href to which contains many .cs source code modules.

What I would like to do is download a sharpmap dll that I can link to and will resolve all these references.  Failing that, I think that will have to download the appropriate cs file sources one by one into my project (and any that they refer to - recursively) and then compile all these in turn.  This seems like a lot of work that should be unnecessary.   I see no bundle for said download, so I am thinking that this is the wrong way to do this.

Is there a dll somewhere that will spare me this exercise?  These are the references that I need to resolve:

using SharpMap.Geometries;
using SharpMap.CoordinateSystems;
using SharpMap.CoordinateSystems.Transformations;

Thanks - Steve Tufty




Feb 28, 2011 at 3:32 PM

If it is just for the sake of coordinate transformation try using

Hth FObermaier

Feb 28, 2011 at 4:47 PM
Edited Feb 28, 2011 at 5:29 PM

Thanks Hth, I found the using SharpMap.Geometries reference at but I am still lacking the

using SharpMap.CoordinateSystems;
using SharpMap.CoordinateSystems.Transformations;



Feb 28, 2011 at 5:29 PM

In case anyone else is having this issue, it looks like the SharpMap.CoordinateSystems.dll isn't used any longer - it was replaced with the Proj.Net library, as Hth implied.  Here is a link expalining this. Indeed, the ProjNET.dll is part of this code bundle referenced in my previous post, and the references in my source are resolved when they get replaced with these:

using ProjNet.CoordinateSystems;
using ProjNet.CoordinateSystems.Transformations;

Now I get to find out how many of the methods have changed :)

Feb 28, 2011 at 10:26 PM

Hello all, I am really close, but now I need to get the values for this._semiMinor and this._semiMajor, which I am assuming to be the major and minor axes of the earth elliptiod.

It looks like these are used to compensate for the eccentricity of the earth.  Does anyone have any pointers on how to get these?  I see that from a Google/Wii search, the EarthEccentricity = 0.01671123. but that seems to be a little too far from 1.0, but I am not an expert here.

Thanks - Steve



Mar 1, 2011 at 7:50 AM

If the coordinate systems you need to use have a valid wkt representation, use that for setting up your coordinate systems via CoordinateSystemFactory class.

For wkt (Well known text) look at

Hth (Hope that helps)


Mar 3, 2011 at 11:36 PM
Edited Mar 3, 2011 at 11:38 PM

After looking into FObermaier's replies a little more, I found what I needed in DotSpatial's site.  Thank you for your time in assisting me

I am posting the contents of the class that I am using in case anyone else is having a similar issue.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotSpatial.Projections;

namespace FarSite.Web
    public class AlbersClass
        static ProjectionInfo MyAlbersProj =
        static ProjectionInfo MyLonLatProj =
        static double[] z = new double[1];

        public static double[] LonLattoAlbers(double[] Input)
            z[0] = 180.0;   // just a stab at the height here - does it matter?
            Reproject.ReprojectPoints(Input, z, MyLonLatProj, MyAlbersProj, 0, 1);
            return Input;

        public static double[] AlbersToLonLat(double[] Input)
            z[0] = 180.0;
            Reproject.ReprojectPoints(Input, z, MyAlbersProj, MyLonLatProj, 0, 1);
            return Input;

Called like this:

            double[] MyCoordinatePoints = new double[2];
            MyCoordinatePoints[0] = lon; // in degrees
            MyCoordinatePoints[1] = lat;  // in degrees

Thanks again to all - the web is a beautiful place (when it works) - Steve