How to Draw Icons or Images on a Mapserver Generated Map

In this example I have used the map of the Itasca demo of the Mapserver. I have done only small changes to the map file. The Itasca demo has (into the html file) the parameters of the path where to store the images:

IMAGEPATH "set in index.html" IMAGEURL "set in index.html"

I have changed them as fixed path

IMAGEPATH "/tmp/ms_tmp/" IMAGEURL "/ms_tmp/"

Than I have set as STATUS ON several layers for a better map.

The Database

The positions and the images paths that have to be shown on the map are stored into a table of a database in MySql. I have created a new database named "mapexample" and a new table "weather":

CREATE TABLE weather (

id bigint(20) NOT NULL auto_increment,

imagepath varchar(255) default NULL,

x double(16,4) default NULL,

y double(16,4) default NULL,



and than I have inserted into the table the positions of the weather images and the path of every icon:

INSERT INTO `weather` VALUES (1, '/data/weather/icons/sunny.gif', 478107.0000, 5250301.0000); INSERT INTO `weather` VALUES (2, ''/data/weather/icons/cloudy.gif', 408107.0000, 5220301.0000); INSERT INTO `weather` VALUES (3, ''/data/weather/icons/storm.gif', 468107.0000, 5270301.0000); INSERT INTO `weather` VALUES (4, ''/data/weather/icons/variable.gif', 408107.0000, 5310301.0000);

It is not necessary for the images to be stored into a directory visible from the web, because are taken directly by the script and then merged with the map.

The PHPMapscript code Here is the code I have used for generating the map: ">

More info:

Roberto Colonello owns and operates and

In The News:

KPS3 Hires Vivek Bhardwaj as Web Developer  Nevada Business Magazine

Business Website Building Do?s and Don?ts

First, using a lot of web graphics, flash, banners and... Read More

Beware the Software Siren

I've heard several prominent web marketers mention in their classes... Read More

Five Steps to Create Your Software Product with Outsourcing

Many executives and investors are skeptical that software products can... Read More

Linking Out is Good

Many websites I come across don't have a single link... Read More

Have You Got Your Ear To The Ground Or Your Head In The Sand?

What happened on your website yesterday? What about last week... Read More

Revealing the Firefox Secret Used by Top Web Developers and Power-Browsers

Profiles are one of the best kept secrets around regarding... Read More

Content Management

More and more businesses are recognizing the importance of content... Read More

Getting One-way Inbound Links: the 5 Major Strategies

With search engines putting a damper on direct reciprocal links,... Read More

7 Tips to Make Your Order Page Work Harder

So your prospect, Mary, is sitting at the computer reading... Read More

Are You Being Scammed By Your Web Design Company?

This is a growing concern amongst many business owners. Does... Read More

9 Keys to an Effective Website

Many small companies choose not to invest in a professionally... Read More

The Web: Your Window of Opportunity

Thinking about starting up a business? The web is the... Read More

How to Get a Knock Out Website!

The first step in setting up an online business...Starting an... Read More

Three Way Linking - Webmaster Strategy

Three way linking and concerns.For many years SEO experts were... Read More

Optimal Website Design

Optimal website design is the art of logical navigation.It will... Read More

Enhance Your Website With A Yahoo-Style Directory

Does your website have a links/resources page?Do you exchange reciprocal... Read More

Website Development: Become Your Own Expert

Starting and maintaining a business is challenging enough without the... Read More

Track Your Visitors, Using PHP

There are many different traffic analysis tools, ranging from simple... Read More

CSS - Maximum Benefits

What is CSS?CSS is a simple file which controls the... Read More

Traffic for Webmasters

"If you build it, they will come"; is an age... Read More

Making The Business Case For Web Standards

Through the explosive growth of the Web, companies have realized... Read More

The Power Of CPanel

cPanel is a control panel for your website and allows... Read More

Developing A Website: 10 Tips For Getting Started

1. Be clear on your purpose.Building a website can be... Read More

The Problem with Paypal On Your Web Page

When I set up my website I felt paypal was... Read More

Free Isnt Always Good - 5 Reasons Why You Need Your Own Website

Often time I've browsed sites and seen the same thing... Read More