Thinking in GIS

a blog about GIS from a urban geogeek living at the countryside

Feed, Categories, Archives


MapFlashViewer Framework

Posted: October 26, 2006
Categories: devs, MapServer, .NET, GIS, ArcIMS
Feedback: View 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.

XML to support any internet map server and environment

Many GIS Web Viewers developed in the past are specific for a particular map server. I wanted to have a solution that could be easily implemented for any map server (ArcIMS, MapServer,...) and any programming envirnoment (Asp .NET, J2EE, PHP) without the need to write a specific UI for each map server and each environment.

Architecture

To do so I have decided to develop a Flash interface that comunicates with xml to a Controller class (written in C# .NET, Java, PHP,...). The controller class will then translate the XML request from Flash (a zoom in, a pan,...) in a specific method that will get a response from a concrete (ArcIMS, MapServer...) class. The response is then translated again in XML and sended back to the MapFlashViewer.

Let’s look at this sample:

MapFlashViewer

The user will perform a typical GIS action on the MapFlashViewer, for example a Zoom In Box. The MapFlashViewer will translate this GIS action in a XML request (x1,y1,x2,y2 are the image map coordinates at the GIS user interface):



This XML request is then sended to the Controller class. The Controller class and the other classes could be written in any environment supporting XML and the map server you are using (Asp .NET, Asp, J2EE, PHP, ...).

The Controller class will translate the XML request (and requested action) from MapFlashViewer into a call to the corresponding method at the MapServerFactory, in this case MapServerFactory.DoZoomBox(ZOOMMODE zoomMode, Double xmin, Double ymin, Double xmax, Double ymax).

The MapServerFactory is an abstract class following the rules of Abstract Factory Design Pattern: the client who is calling the DoZoomBox method doesn’t need to know the specific code implementation for a particular internet map server. He will just need to know the MapServerFactory API, as the variable code implementation for each internet map server will be implemented in the concrete class of the Abstract Factory.

This is also good if at one time you want to change the internet map server: you will not need to change any code, because you are just coding with the MapServerFactory API, not with the ArcIMS ActiveX or .NET or Java connector, neither with MapServer php, C#, java MapScript....

And the most important thing is that you will be able to use the MapFlashViewer framework at the same way with any internet map server and for any development environment.

How to start

With this first release of MapFlashViewer framework you get:

  • the MapFlashViewer UI with the first available GIS actions (ZoomIn, ZoomOut, ZoomInBox, ZoomOutBox, ZoomToPreviousExtent, ZoomToFullExtent, Pan)
  • the C# implementation for the framework

You can download the code:

Next releases

In my spare time and in the next iteration of this project (end of 2006) I plan to add:

  • Identify action
  • Table of contents
  • J2EE implementation of the framework

If someone is interested in writing:

  • Another internet map server implementation (ie: SharpMap), meaning at this time another concrete class for the MapServerFactory abstract class
  • Another environment implementation (php...)
  • Extending the FlashMapViewer UI with ActionScript
  • Some more documentation

you can contact me, I will be glad to assist you in your contribution development.

blog comments powered by Disqus