MapScript C# Tutorial - Programming MapServer in the ASP .NET Framework

Posted by on July 1, 2006

In the next stops I will write a tutorial about programming MapServer with .NET c#.

This tutorial will try to guide you step by step in implementing a GIS (Geographic Information Systems) web solution, based on Open Source software (MapServer and PostGIS), within the .NET Framework.

How to download the tutorial

The tutorial’s data needed to complete this tutorial are downloadable here.
In any case the tutorial is made in a way that you can easily adapt to use your own data (shapefiles).

Here you can find a complete working Visual Studio 2003 solution (ASP .NET 1.1) with the whole tutorial’s solution.

Take a look at a working online demo of the tutorial

Before beginning following the tutorial’s steps you can take a look at a working online demo of it: try to navigate the map (zoom in, zoom out), identify features on the active layer, add features (and attributes) to a point layer (POI), restore (clear) the point layer where you have added the features, switch on/off layers visibility.

Tutorial’s audience

The tutorial is designed to work with Visual Studio 2003 and .NET 1.1, but you will easily be able to perform all the necessary steps to complete it using another version of Visual Studio (ie: Visual Studio 2005) or other IDEs (like Visual Web Developer 2005 Express Edition or even the notepad). It will work also using .NET 2 as c# mapscript is .NET 2 compatible.

The tutorial is focused to people with knowledge of C# (but can be easily implemented with .NET Visual Basic) and the .NET framework, and with some background in GIS. If you are new to GIS, a good place to start is here.

This tutorial could be easily adapted for other languages and frameworks rather than C# (or VB) and Microsoft .NET Framewok. In fact the Open Source component we are going to use (MapServer) is also available for PHP, Java, Ruby, Python and other languages.

As we will implement a C# ASP .NET Application, take care about this issue (that should be solved in the future): MapServer thread safety and about plans to solve this issue.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • LinkedIn
  • Reddit
  • StumbleUpon
6 Comments on MapScript C# Tutorial - Programming MapServer in the ASP .NET Framework

Closed

  1. Marc says:

    Can you write the link in order to learn the How To?…
    I think Im going to do same as you did. I think Im going to follow your steps… Lot of work to do !!!!
    Best regards.

  2. Paolo Corti says:

    Hey Mark
    the index of tutorial is here:
    http://www.paolocorti.net/public/wordpress/index.php/2006/09/20/mapserver-tutorial-for-c-mapscript-asp-net/
    In the last days I reorganized the stuff it was on the wiki site, that i am going to remove for administrative reasons
    Paolo

  3. jmp says:

    how to deal this error
    msGetLabelSize(): TrueType Font error. Could not find/open font

  4. Paolo Corti says:

    According to map file, fonts are stored in this folder:
    FONTSET “fonts\fonts.list”
    do you have the font you are using for your label in that folder?
    If you are doing the tutorial, the font we are using for same of the layer, still according to map file, are:
    FONT verdana (in the LABEL section)
    do you have the verdana.ttf (true type font) file in the fonts folder?
    let me know.

  5. Horia says:

    Hi Paolo,
    I am a beginner in Map servers But i am a fluent in C#,I have an project graduated is to develop a map server package so can you help me?,
    i want an free open source to work on that i wont begin from scratch,and this server should have the following criteria:
    1.Well designed.
    2.Well documented.
    3.Availability of contact persons/original authors.
    4.Compatible with(C#.Net) tool.
    5.Open Source.
    PLS if you can help,contact me.

  6. Paolo Corti says:

    For .NET the best choices are MapServer and SharpMap.
    MapServer it is still not optimized for working with .NET (look at the issues I have pointed in the tutorial), but has a very good documentation and community.
    SharpMap is specifically designed for .NET (so it is very optimized) but less docs and community.
    They are both OS, but with different licenses (GNU GPL SharpMap and a specific license MapServer)