Extending Sahana GIS module with Map Serving Capabilities

This page is for documenting the work done in GSoC 2008 on the GIS Map Editor & MapServer modules.

Proposal

This is the proposal done by Hasitha Anjana Naimana Liyanage for the GSOC 2008 to provide Sahana with map serving capabilities. Please feel free to give feedback on the approach and edit this page relevantly.

Abstract

Disasters and Geographic Information are highly coupled in every perspective. Thus a powerful GIS component should be a necessary part of any Disaster Management System.

This proposal is to aim at enabling map serving support in Sahana, thus Sahana will not depend only on Google Maps by taking the advantage of its own map serving capabilities and available geographic data.

UMN Map Server is targeted at this phase and front end for creating map files will be given to the GIS administrator. WMS capabilities are also a part of the administration done via the specific map file. Module developers are armed with a API to use powerful mapping capabilities of the map server.

Extending Sahana GIS module with map serving capabilities

Disasters, geographic location and geographic information cannot be separated from a broader perspective. Thus the effect of the disaster is dependent on the geographic location it happened. On the other hand for the disaster management it is an important aspect from initial planning to the actions. Top level people who are supposed to take strategic decisions regarding disaster management are supposed to be provided with relevant data, thus on the GIS perspective, a powerful mapping application with customizable and detailed maps is well suited for give geographic related information. Once it is combined with the other relevant data about the disaster it will become a precious tool.

While Sahana is a world class Free and Open Source (FOSS) project within the humanitarian domain it will become a more significant tool with the development of the Sahana GIS frame work itself combined into it.

Current sahana GIS capabilities

Currently Sahana GIS module relies upon the Google Maps as the major mapping source. GIS module provides a module independent API for other Sahana modules to build custom mapping functionalities. GIS framework and administration with Plugin architecture is implemented and evolving to date. (http://wiki.sahana.lk/doku.php?id=dev:gis_infra)

Not only that Map viewing client based on the open layers is almost complete and I found form the mailing lists that the map services catalogue is also on its way. Thus, Sahana GIS module can view maps from different sources, such that utilize Web Map Services (WMS), GeoRSS facilities as well as through commercial API's such as Google Maps, MS visual Earth, Yahoo maps. From the GIS Catalogue module it gets the capability to look for different Web Map Services (WMS), Web Feature Srvices(WFS), Geo RSS etc. to be used. But up to now Sahana GIS framework is lack of its own map serving capabilities.

Why map serving capabilities are important?

Requirement for its own map serving capabilities and its benefits has arisen in discussions on the Sahana mailing lists. Thus it would be another huge step taken towards the success of the project, if Sahana is armed with map serving capabilities as well.

In a disaster situation detailed maps are a great resource to manage the disaster in every aspect. Thus, Google maps do not provide that much of detailed maps publicly accessible on most of the regions of the world. On the other hand most of the countries cannot afford big amount of money to get mapping services from the popular commercial GIS application vendors. But most of the countries who are concerned with the importance of the geographic information have detailed maps either vector or raster formats in digital forms or paper form. Thus this situation is an ideal candidate to be addressed by collaborating FOSS GIS tools via Sahana GIS frame work.

Existing Geographic information can be published or served as maps to specific interested parties via a map server, which accepts the requests for maps, process the specification for the map (map file) , makes the requested map with the existing geographic data stored in a database and sends it to the client.

On the Sahana perspective this proposal will lead to serving detailed maps other than Google maps, to Sahana clients as well as to other parties who are interested on the maps published as WMS by the Sahana Map Server sub module.

How other modules are benefited in the long run?

All the modules which use mapping features will be able to work flexibly with the API given to the map server on their mapping applications. Situation mapping, Camp Registry, as well as the upcoming Disaster Surveillance and Social Networking modules will be greatly benefitted by this project by using powerful and flexible and easily customizable mapping capabilities of a mapping server.

What map server to use?

Of course as you think, developing a map server from the scratch is not a summer project. Its where the power of FOSS comes to save us. There are several potential projects as UMN Map Server, GeoServer, Deegree. (http://wiki.sahana.lk/doku.php?id=dev:gis_infra) Thus it is reasonable to rely upon an existing map server for our project.

I thought of UMN Map Server to the top, a map server developed by the University of Minnesota, because it is a very popular and robust map server and from the comments I have gone through. Not only that it’s with OGS standards and has cross platform support, supports multiple raster and vector data formats, wide variety of map projections support, advanced cartographic out put features and support for number of scripting languages including php, perl and java for development environments. More details can be obtained from http://mapserver.gis.umn.edu

What Am I Going to Do?

Once the map server is installed we have to communicate with it to get the required map done. It should be provided with the data as well as the specification for the map, where the story truly begins in our context.

Specification is the map file which we have to create according to our needs and situation where we are going to use it.

I am focused in creating this specification (map file) on behalf of the Sahana module developers who are eagerly anticipating the development of new mapping capabilities. This can be achieved with the use of the php map scripts to communicate with the UMN Map Server API.

Map file can be considered as a map object and you can access the specific underlying details and manipulate them with the map scripting support provided by the UMN Map Server via PHP Mapscript.

By that GIS administrator or the developers can have the freedom to create their own maps.

Map serving capabilities as WMS are also can be controlled via this method as WMS is also another object that can be manipulated inside the map file.

On this path, deliverables will be a front end to set up map server and create map files and to manipulate them for customized maps. This front end or the administration section includes enabling WMS features and further more WFS features for the map. By that Sahana administrator or the specific user need not to be a map server guru to create map files and eventually maps when the GIS data is available. Sahana map viewing client based on Open Layers will take the responsibility of showing the maps accordingly.

Optionally, I would like to give an API to be used by the module developers who are interested in using powerful map server generated highly customizable maps if a demand is there by the module developers for such an API.

GIS database integration is another step forward thus I hope to put that out of this scope, thus it will be a future improvement.

Potential projects

From the initial survey I have found some projects that seems to be useful in accomplishing this task. The most interested one is maplab which supports creation of mapping applications. (http://www.maptools.org/maplab) The other one is Chameleon. (http://chameleon.maptools.org)

So it's FOSS, hope to use the power of FOSS on my project with a clear idea of the licensing issues.

Progress, Plans, Ideas and Everything...

Todate Map Server Module is on its' way through Administration section and Map file creator section.

Brief overview

Administration for map server

Installation -

Checking whether the mapserv cgi program resides in the cgi-bin directory checking the dependancies and notifying the missing dependancies until all the dependancies are met.

Still not working under windows.

Creating the directory structure -

map directory will store the .map file created by the user. mapdata directory will store the shape files uploaded into the server. images directory will store the maps created by umn map server by blending the .map files and shape files

Map file generation

Initiated the topic by creating simple map file through the web interface.

Will lead to user friendly map file editing interface which gives the user the control over the maps to be served. Generated .map files will be stored under maps directory, which will act as the recipe for a particular map generated by the UMN map server.

Data manager (Looking to come forward)

Will provide the fascility to upload, remove shape files into the server.

Map Server Module - GSOC 2008

Functionalities Exposed

Administration

Administration function of the module will look into the set up perspectives of the UMN map server, the map server which we are using to generate and serve maps. Dependencies for the UMN map Server is also checked to guarantee the smooth operation of the module.

The directory structure is created when the suitable permission is granted. Folders named image, maps and mapdata will hold the user created images of maps, user created map configuration files, and the data to be used in the map generation.

data file in the module holds the template map file as well as the base back ground image and the conf file which is used to check whether the map server module is configured.

Map Editor

The main functionalities of the Map Server module is exposed via the Create map, Add layer, Edit layer, Manage maps and Search maps forms. With these, a user will be allowed to create maps by manipulating the map objects via PHP Map Scripts, through the form itself.

Create map

User will be able to create a map relevant to their need, thus the .map file created will be saved in maps directory, which is created through the administration section, with the purpose of holding user created files and files created by the system.

Add layer

After creating the map, user is allowed to add layers into his map accordingly. User is allowed to build the map from scratch with this data needs.

Edit layer

Added layers are customizable via the Edit layer form, thus giving the user the ability to easily customize the selected layers.

Manage maps

Manage maps section provides the edit, view and delete facilities within the same pane making it a stage to overview the created maps.

Search maps

User is allowed to quickly search for a particular map, with a preview of it and edit and delete facilities, near at hand.

API

API will allow the developers to use the generated maps within their modules by calling this API.

Guidelines

configuration values

You will have to edit your conf.ini file to get the configuration done for the map editor. Basically you will have to edit the shn_ms_URL variable according to your IP address and the path to the ms module.

How to upload data files

Edit php.ini to set the upload limits to an acceptable limit.

Zipped file should contain a folder named with the file name containing it. The folder should contain the .dbf, .shp and .shx files.

Dependencies

UMN map server is the major mapping engine used in this work. PHP Map Scripts were used to communicate with the UMN Map Server. As a result of that UMN map server and its dependencies as well as PHP Map Scripts will become prerequisites for this module. On the other hand it is not a problem thus all these dependencies are not bundled with Sahana.

Conclusion

By this endeavour Sahana is armed with off line mapping capabilities. Thus it will open a path for customized maps to be used in the Sahana. Thus it will be able to serve maps with the collaboration with the UMN map server, building the baseline for the dawn of a new powerful GIS analysis module.

Future Works

Under this project core of the map serving capabilities is developed. But still there are things to improve or changed. Usability of the system can be improved as well for better user satisfaction.

Map Editor for the GIS module

Since we now have a decent Map viewer available, we need to simplify the setup of a MapServer to provide the back-end to allow a quick & easy setup of an a fully-offline GIS system.

As well as simplifying/integrating the install of MapServer itself (especially on a Windows PortableApp platform), the key deliverable is to create a front-end for creating the .map files. This will most-likely be done using PHP MapScript.

A simple, accessible UI is more important than trying to expose advanced features. For advanced features, professionals can easily set up a separate MapServer instance.

The initial version could start really simply by being able to upload .shp files & use these as overlays (it's often fairly easy to get this format available & doesn't require a database to be set up & maintained).

A 2nd key format for users would be to support using a Scanned Map which has been Georeferenced:

MapServer needs support for the sphericalMercator projection: EPSG 900913. This makes interoperability with the other base layers possible.

Possibly-useful projects

  • MapLab - no longer maintained, but an unrestricted license, so it seems that code can be stolen freely :)
  • MapStorer - doesn't yet support MapServer 5.x & GPL, so code can't be lifted directly
  • KML Map Server - allow data to be accessed via KML/KMZ
  • TileCache to increase performance
    • NB Need to gracefully restart Apache when modifying the layer definitions if using mod_python for scaleability
  • Rectifier - Online Georeferencing application (Whether to use this for ideas, simply a URL in Help or can steal code, I don't know)
  • VMap0 Data - including support for this by default could be a nice starter (as a separate optional download of 100-150Mb for the area of relevance to the deployment)

Navigation
QR Code
QR Code dev:gsoc2008_gis_map_edit (generated for current page)