It’s Khayer, Bangladesh


BDMapper for OSGEO Mapserver

OSGeo Mapserver (Previous UNM Mapserver) is a very strong opensource tools for web based GIS mapping. It is support all of the server side language like PHP, Perl and JSP. It can render map from ESRI Shape file, Wms, Spitial Database, Raster and others popular format.

For a begainer, it is very easy to display a hello world map. But for industry use, programmers need to use framework like GMap, Kmap, Openlayer and so on. The Gmap map is a nice tool which is written in PHP. Unfortunately, there is no regular update for GMAP. Besides, OpenLayer is a javaScript API for using Mapser server. But all of available framework are little bit complex to work. They require major changes for minor modification.

I have got chances to work with .NET component of mapping like ASP Map, Map Object (Desktop Application), SharpMap (Opensource) and MapWindowGIS (Opensource). They need small number of line code for creating mapping tool. All the time I am waiting for a Mapserver framework to work like .NET component. Unfortunately most of the Mapserver developer are very high skill, so they can not realize my simple requirement. At last I decided to write a viewer using phpMapscript only for use myself. I gave the viewer name BDMapper.

BdMapper_Home2

-Live Demo of BDMapper
-Source Code of BDMapper

BDMapper has developed using PHPMapscript, Mysql and Java Script. Some functions of GMAP are exteded here. User can create a mapping tool with writing some lines of code. But the main objective of BDMapper development is to easy enhancement with other application and easy modification.

BdMapper_Zoom

BdMapper_Ident

If you want to use BDMapper, the first thing you need to install the BDMapper demo in your local machine. You should follow below steps to run the demo in your local machine,

Installing Mapserver
Download mapserver form mapserver.org. To install the OSGeo mapserver, follow the installation guide. For BD mapper some extra configuration is recommended.

Apache Configuration (httpd.conf):
- Add temp director alias. Here is my local machine setting for temp directory

## Alias for MapServer tmp directory
##
Alias /ms_tmp/ “c:\OSGeo4w/tmp/ms_tmp/”

- Create a folder named ms_tmp in “c:\OSGeo4w/tmp/” directory.
####

** PHP Configuration (php.ini):
- Load PHP MapScript Extension
extension=php_mapscript.dll
- Load PHP_dbase Extension
extension=php_dbase.dll

Restart Apache service.

BD Mapper Demo Installation
- Download Source from here
- Unzip Source and copy in Apache hottdocs root directory
- Dirrctory Descrioption

/classes Main              Class Modules
/data_files                    Map Shape Files
/Documentation       Help and Documentation
/images                         Default Images
/JS                                  JS API

- Change tha MySQL Connection Paramere in Class/clsUmnMapDB.php
if(!($dbCon=mysql_connect(“localhost”,”root”,”cegis”)))
- Check the default map file (testMap.map) parameters. Extends parameter set a dummy value. Please keep extends value unchanged.

Mysql Database Creation
- Install Mysql 5 or higher
- Restore mysql dump using Mysql GUI Administration tools from Doccumentation\bdmapper 20090616 1619.sql file.

- Make sure that the Connection paramert in class/clsUmnMapDB.php is updated.

Description of the Main pages:

bdmapper.php:
This the main page of the viewer. There the MapID is hard coded to 102. Currently two map date created as example in Mysql database. You should assign this value dynamically. Program use a default map testMap.map. In every post back program store its view state crating temporary (tmp123.map) map in current directory.

testMap.map:
Default Map for the BDMapper.

clsUmnMap.php:
Main Mapping module.

clsUmnMapDB.php:
Data Access Layer of the program

clsGenFunc.php:
Collection of general use functions.

Please read the Doccumentation/Doccumentation.pdf carefully before any modification of the code.

I have published this script without any restriction. You are free to use this script in your product. You just need to acknowledge me.

Sample GIS Data (/data_files) are not available with the source code. You can mail me for the sample data.

Please give your feedback if this post is helpful.

Thanks,
Md. Abul Khayer
GIS Programmer,
CEGIS, Bangladesh.
Khayer.wordpress.com
Khayer117@yahoo.com