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


7 Questions to Understand Your Customer Better

Customer service questionnaires can help your clients better understand their... Read More

Building a Great Intranet Taxonomy

While it may seem like a "quick and easy" task,... Read More

Database Driven Web Site - Do You Need It?

Many of site owners still don't realize all advantages of... Read More

10 Tips For Running A Profitable Web Site

1. Address your targeted audience on your business site. Example:... Read More

4 Steps to Selling More With Your Web Site

Most web sites are more like stage sets than real... Read More

Creating Compelling Content , Write It and They Will Come

In a previous ezinearticles.com article,"I Need real visitors, Not Search... Read More

Introductory PHP For Non-Programmers

When you started reading this sentence you assumed lo acabarķa... Read More

PIM Team Case Study: Creating Text Effects With PHP and GD

See how you can create graphic effects on text with... Read More

I Did It: Six Months to a Successful Website

For years now I've been looking to start my own... Read More

Your Biggest Mistake When You Create a Website?

--------------------------------Why Should You Create a website?--------------------------------A. What do you want... Read More

What Does An Ex-Basketball Coach Know About Pulling Web Metrics?

In my previous life.....Actually, my previous JOB life, I was... Read More

Making Your Website Shine! Attract and Keep Visitors at Your Site!

When you consider the billions of individuals and companies on... Read More

Tips to Protect Your Downloads or Products

1. Upload robots.txt file in to your root directory and... Read More

Beyond Web Usability: Web Credibility

If you've been developing websites on Mars for the past... Read More

Why Should Your Business Go O.N.L.I.N.E.

Optimize your time. How much time each day must you... Read More

Website Strategy!

A website lets you put your products in front of... Read More

The Most Important Aspect of Writing Web Copy

There is an ongoing debate about web copy. Some say... Read More

Website Success is Key

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

Increase Your Affiliate Earnings with a Smart Webmaster Plan

Affiliate programs are a great way to earn an income... Read More

Do This One Thing to Create a Powerful Product-Selling Web Site

Spend time planning your Web site. Before you design a... Read More

Developing State-enabled Applications With PHP

Installment 1Developing State-enabled Applications With PHPWhen a user is browsing... Read More

Why You Need a Website

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

You Don?t Have to be Amazon.com to Achieve 12% Conversion Rates!

That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More

Where?s Your Web Site?

This simple question can take on several different forms, but... Read More

Do Dancers Need A Website?

Dance is how you pamper your soul and satiate your... Read More

Wheres Your Focus, Money or Customer?

Is your website Really useful?I had a 'rep' in yesterday... Read More

Do You And Your Website Have Credibility?

I recently received an unsolicited e-mail from some company offering... Read More

Find the Purpose of Your New / Proposed Website

Absolutely everything stems from the purpose of your website -... Read More

7 Ways to Gain a Professional Online Reputation

A professional online reputation is essential to the flourishing of... Read More

The Problem with Automated Accessibility Testing Tools

An automated accessibility tool is a piece of software which... Read More

Earning From Your Website

Before you start building your site, ask yourself "WHY?". Why... Read More

Do Authors Need a Website?

"I am a writer, not a business-person. I don't want... Read More

7 Profit Producing Reasons Why Every Successful Service Professional Needs A Web Presence

Your business website is a critical aspect of being able... Read More