This is a techie post. You have been warned.. :P
On the past few weeks, I have been engaged to a GIS project. The requirement is to develop a web-based GIS system using full open-source technology, namely PostGIS (database), PHP (language) and Apache HTTP (server). Although the system comes with several other modules (management and business processes), I was in-charge to handle the GIS module (yay!!). This is indeed a blessing to me as I had been trying to jump into the GIS field for quite some time with no success. As such, I will keep on posting my progress on the project. Apologize on the non-frequent update as I was (and will be) very busy from now on :)
Tools/Things needed:
1) Apache HTTP server. Google it and get the latest version.
2) PHP 5.2 specifically. Explained below why this version is needed.
3) PostGIS
4) MapServer (get from www.mapserver.org)
5) Quantum GIS
6) Shapefile(s)
I don't think a tutorial of how to install Apache and PHP is needed to be drawn here. Google has plenty of this tutorial and I find it more than enough. Once you've done installing the server and PHP (and PostGIS), install MapServer. Ensure to set the mapserv binary file as CGI in your Apache environment. There are sets of required files with the CGI. Not sure which is which, so I just chuck the whole thing in the folder. You may use Dependency Walker to check the required library files though if you have plenty of free time.
Once done installing, test the CGI by going to http://your-CGI-path/mapserv.exe. This should return some error message stating no query string set or something similar. If this message is returned, then you have successfully installed MapServer.
For mapserv to display a map, it requires 2 things, namely shapefile(s) and map file. What it does is the map file acts as the gate between a shapefile and the mapserv, which will control how the map is presented (color, label and so on). The map file also tells the mapserv where the shapefile is (in our case, the PostGIS database). Plenty of tutorial available on the Net on how to configure a map file. To view a map, simply browse to http://your-CGI-path/mapserv.exe?map=map-file-path&mode=map. If all things are correctly defined, a map will be drawn based on the shapefile (or database) specified in the map file.
Below is a sample of map that I generated.
![]() |
| Majlis Bandaraya Petaling Jaya :) |

No comments:
Post a Comment