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,

PRIMARY KEY (id)

)

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: http://www.parsec.it/tutorials/

Roberto Colonello owns and operates http://www.parsec.it and http://www.gmdir.com

In The News:


pen paper and inkwell


cat break through


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

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

Website Success is Key

The popular search engine Google indexes over 8 billion websites.... Read More

Are You Overlooking the Benefits of Using Sub-Domains within Your Web-hosting account?

One of the most useful features offered by some web... Read More

The Importance of Website Stats to You

One of the best tools you have as a webmaster... Read More

Setting Up Your First Website

Q. Hey, Cathy: I'm just setting up a website. What... Read More

Linking Out is Good

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

Direct Sales and Your Corporate Website - A Creative Marketing Plan that Works!

Creatively marketing your corporate site takes time in the set... Read More

How To Make Your Website More Successful? (Part I)

Building a website and getting it online is easy. Driving... Read More

Five Reasons You Have to Stop Your Web Site

That's right. Your method, behavior and strategy you are now... Read More

Learn What 98% of Targeted Visitors Do On Your Website

Getting a Targeted Visitor to a website is a waste... Read More

Maximizing ROI via Web Site Traffic Analysis

We are clearly well past the innocent "golden age" of... Read More

Are You Being Scammed By Your Web Design Company?

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

Disability Discrimination Act (DDA) & Web Accessibility

There's been widespread speculation about the new legislation being introduced... Read More

7 Killer Ways To Increase Your Online Sales

Every online entrepreneur I talk to is asking the same... Read More

For Newer Sites, Web Marketing Depends On Titles & Links!

We all start out the same. Some have budgets, some... Read More

Marketing Your Business Online

As a business you can't afford to ignore the Internet... Read More

The Web: Your Window of Opportunity

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

Developing A Login System With PHP And MySQL

Most interactive websites nowadays would require a user to log... Read More

Create Huge Income From Your Web Site - 10 Easy Ways

The cost of setting up a web site is dirt... Read More

Why You Need a Website

You hear a great deal about the Internet these days... Read More

Developing A Website: 10 Tips For Getting Started

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

Link Trades That Waste Your Time

Never has competition been so difficult in the Internet world.... Read More

A Beginners Guide to Server Side Includes

An Introduction to Server Side IncludesBeginner? That's OK!While much has... Read More

The 2 Most Common Web Site Mistakes

When we review the sites of potential clients, there are... Read More

Non-Profits: Successful Online Strategies

More and more non-profit organizations are developing websites to help... Read More

What YOU Should Know Before Getting A Web Site!

Everyday thousands of new businesses make the leap and take... Read More

Running An Effective Website

Running an effective website is a continuous process. I have... Read More

Your Content for Nothing and Your Clicks for Free

The first thing my business consultant (read brother-in-law) asked me,... Read More

Website Development: Become Your Own Expert

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

7 Tips to Make Your Order Page Work Harder

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

Thinking Of Taking Money Online? Whats Best For Merchants? PayPal, WorldPay or Something Else?

It's now easier than ever to take payments on the... Read More

Successful Web Development: 10 Key Elements

There are many elements that are key to successful web... Read More

What is The Google Toolbar?

No matter what browser you may want to use, you... Read More