My friend Diego Guidi is the smartest GIS/.NET developer I personally know here in Italy. He is the developer of NetTopologySuite, the port in the .NET world of the popular Java's JTS Topology Suite from VIVID Solutions. I wanted, sooner or later, write some stuff here about WMS and TMS, and now I am very happy that Diego asked me to publish this brilliant article about this topic.

First of all, let me thanks Paolo for hosting this post! I hope that this article can be interesting and useful like other stuff that you can find here

Introduction

There are a lot of discussions out there about how to define Google Earth, Google Maps, and related apps… are they GIS? Viewers? Video games? Even a neologism was created: Neogeography. I think that all the folks out there have the same idea in mind: maybe Google don't make the same business as ESRI, but Google Earth is cool, and it's funny to play with it!

Read more

…well, this is the solution to your problems (at least I hope so).

I am continuing receiving emails from people in despair that cannot successfully use this tutorial. I am sorry but I cannot answer to all this emails, so I thought to write this post in order to allow people to configure it correctly.

BTW, this demo is still working since 2 years without any problems, and the code there is just the same you can download from this blog. So it must work also for you ;-)

So if you just cannot use it, this is a check list:

If you receive the "Unable to load dll (mapscript)" error, look at this article from Tamas Szekeres (the mapscript c# mantainer).

Read more

Installing MapServer on Ubuntu

Filed on January 10th, 2008 at 11:51 am under , , , , | 10 Comments 

With this post I will show hot to install MapServer 4.10.3 in Ubuntu 7.10 (but this procedure should work also for previous Ubuntu versions) from repositories.

1) set Ubuntu sources needed for this software

Add universe ( http://archive.ubuntu.com/gutsy/universe ) and multiverse repositories to your sources (by default are not in Ubuntu)

sudo gedit /etc/apt/sources.list

and uncomment this two lines:

deb http://archive.ubuntu.com/ubuntu/ gutsy-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ gutsy-security main restricted universe multiverse

save the sources.list file and then then update your sources:

sudo apt-get update

Read more

MapFlashViewer Framework: ASP .NET Implementation (C#)

Filed on October 27th, 2006 at 8:50 pm under , , , , | 1 Comment 

It is very easy to get started with the MapFlashViewer Framework in the ASP .NET Implementation (C#) I talked about in this post.

This implementation was written using ActiveX Connector for ArcIMS 9.0 and C# MapScript for MapServer 4.10.0. You can easily adapt the code for previous or next versions.

Open the solution

You will find several files in the C# ASP .NET project included with the solution you downloaded:

  • A simple default.aspx web form with the MapControl user control over it
  • A form test.aspx for debugging purpose (you don’t need unleass you are in troubles)
  • the Controller (responsable for translating XML request/response to the Flash UI): the xml.aspx page
  • the FlashViewer.ImageMapServer namespace with the classes needed for the .NET implementation (particullary impourtant are MapServerFactory.cs, MapServer.cs and ArcIMS.cs)
  • the MapControl user control

You should easily follow how it works the implementation, for simplicity you can take a look at the UML Class Diagram (that should be the same for each environment implementation):

Read more

MapFlashViewer Framework

Filed on October 26th, 2006 at 4:23 pm under , , , , | 13 Comments 

MapFlashViewer Framework is a simple Flash viewer for several (even any, if someone intends to write an implementation) internet map server (at the moment I wrote an implementation for Esri ArcIMS and MapServer).

You can view a working demo of MapFlashViewer for Esri ArcIMS here and the same working demo (with same data) for MapServer here.

Why using Flash?

It has always been a pain writing web user interface for web mapping. The most common approach is to write javascript client code to perform the main GIS actions (zooming, panning, etc etc).
There is also some example of java applet GIS web interface, but the problems with applet are performances, generally very slow.
IMHO the best way to write Rich UI for the web, like a GIS web interface is, is by using Flash: quick, rich OO programming environment (ActionScript), compatible for every browser (not like javascript) and a couple of other reasons.

Read more

MapServer Tutorial for C# mapscript (ASP .NET)

Filed on September 20th, 2006 at 5:34 pm under , , , , , | 71 Comments 

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), within the .NET Framework.

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 and Python, and other languages.

The whole tutorial is downloadable at this address, where you can find the data (shapefiles) necessary to complete the tutorial (but you can easily adapt your data), and a complete working Visual Studio 2003 solution with this tutorial's code.

You can take a look at a working online demo of this tutorial here.

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.

Index of Tutorial
Introduction
1. Introduction to MapServer Web GIS development environment
2. Installing MapServer
3. Creating the MapFile and data configuration
4. Designing the tutorial user interface
5. Implementing the C# mapscript code
6. Migrating shapefiles to PostGIS
7. Connection MapFile layer to PostGIS
8. Adapting C# code to work indifferently with shapefile or PostGIS layers

And if the tutorial is not working for you (you get compilation errors, maps are not displayed, editing is not working…), please take a look here

In this section we will adapt the ASP .Net Tutorial to work both with shapefiles or with PostGIS layers.

The only c# code that needs to be modified is only the code that updates the point layer.

The tutorial is composed of basically 2 methods that update a point layer:

  • the first method adds a point and its attributes to the point layer (AddPoint method)
  • the second method delete all the points from the point layer (butClear_Click)

After you will terminate this step the tutorial will work both with shapefiles and PostGIS layers.

Read more

First I am going to show the difference between connecting the MapFile to a shapefile layer and to a PostGIS layer, then I will show how to adapt your MapFile to work with PostGIS.

Shapefile Connection

Here is a sample connection from MapFile to a shapefile called "compfun".

First you need to declare the path to the shape data (SHAPEPATH).

Then for each shapefile layer you have to set the shapefile's data source (DATA) that is the name of the shapefile.
Here the shapefile is named compfun.shp so DATA is set to "compfun".

Note that NAME can be anything, it means how in your MapFile want to call the shapefile layer.

Read more

What is PostGIS

PostGIS is an extension for PostgreSQL RDBMS that spatially enables it for storing GIS content.

It could be considered something similiar to Esri ArcSDE or Oracle Spatial.
In fact PostGIS is for PostgreSQL what is Esri ArcSDE for Oracle, MS SQL Server, Informix, DB2.

PostGIS is OGC compliant and is Open Source, released under the GNU General Public License.

For more info about PostGIS you can take a look here.

PostGIS Installation

First, if it is not on your RDBMS Server, you have to download and install PostgreSQL. Refer to the PostgreSQL's Web Site for doing so.

After you have succesfully installed PostgreSQL, you can add the PostGIS module. For doing so refer to the PostGIS's Web Site.

Read more

Add reference to mapscript

Add the reference to mapscript_csharp.dll (browse to the mapscrip installation folder, for example C:\ms4w\Apache\cgi-bin\mapscript\csharp):

{{:mapserver:tutorial:add_reference.jpg|:mapserver:tutorial:add_reference.jpg}}

Remember that if you didn't set PATH environment variable to the MapServer dlls you will need to manually copy them under the bin folder of this ASP .NET application.

Read more

Next Page →