How can I use free libraries to transform spatial data?

For example, I want to change the projection of a Shapefile within the code of my C# web application. How do I do that?

  • Converted to CW because this is really a "list of X" question.
    – whuber
    Aug 11, 2011 at 14:56
  • 2
    at bit late now as the CW horse is out the gate already, but if answerers paid more attention to the "how do I do that?" part of the Q it wouldn't be just a "list of X". Aug 30, 2011 at 22:02
  • Let's try to make this a great question with great answers.
    – underdark
    Aug 30, 2011 at 22:18

4 Answers 4


You can try the DotSpatial.Projections library.

The website lists an example "Converting from a Geographic Coordinate System to a Projected Coordinate System":

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DotSpatial.Projections;

namespace WindowsFormsApplication1
  public partial class Form1 : Form
    public Form1()

    private void button1_Click(object sender, EventArgs e)
        //Sets up a array to contain the x and y coordinates
        double[] xy = new double[2];
        xy[0] = 0;
        xy[1] = 0;
        //An array for the z coordinate
        double[] z = new double[1];
        z[0] = 1;
        //Defines the starting coordiante system
        ProjectionInfo pStart = KnownCoordinateSystems.Geographic.World.WGS1984;
        //Defines the ending coordiante system
        ProjectionInfo pEnd = KnownCoordinateSystems.Projected.NorthAmerica.USAContiguousLambertConformalConic;
        //Calls the reproject function that will transform the input location to the output locaiton
        Reproject.ReprojectPoints(xy, z, pStart, pEnd, 0, 1);
        Interaction.MsgBox("The points have been reporjected.");

Another alternative is http://projnet.codeplex.com/


There is also GDAL/OGR: http://trac.osgeo.org/gdal/wiki/GdalOgrInCsharp The page looks quite old, I'm not sure if the bindings are up to date.


I was a bit surprised nobody mentioned proj.4 and shapelib. Although both are C projects, C# bindings have been made (or you could just p/invoke them).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.