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


Top 5 Webmaster Tools You Can Pick Up For Pennies

1. SiteSpinner V2 - On Sale www.deprice.com/sitespinner.htmSiteSpinner is a user-friendly... Read More

HTML Editors - How to Choose the Right One for Building Your Websites

There are lots of HTML editors on the market, however,... Read More

Ever Wondered What Challenges Other People With Their Web Site?

Have you ever wondered what challenges are faced by other... Read More

The Web: Your Window of Opportunity

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

Why do I Need a Website?

Cost Effective Advertising. Online selling. Increased geopgraphic range. Wider... Read More

Do You Really Need A Website To Succeed

Rosalind wants to share her inspirational poetry with a wider... Read More

Guidelines for Web Page Optimization

Below, I have listed 8 simple steps that you can... Read More

7 Reasons Why Your Small Business Needs A Web Site

Many small businesses have the misconception that their business can... 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

I Did It: Six Months to a Successful Website

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

Disability Discrimination Act (DDA) & Web Accessibility

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

Trinkets, Lockets And Empty Pockets

It never ceases to amaze me how many people set-up... Read More

How to Maximize the Value of Every Visitor to Your Website

While most marketers are beginning to understand the critical importance... Read More

Stop Losing Precious Web Site Traffic to the Dreaded World Wide Web Black Hole

You work hard to build traffic to your web page.... Read More

What is SQL?

What is SQL? SQL stands for Structured Query Language and... Read More

Using Mini Websites - Powerful Way to Direct Marketing

Mini Websites are the most powerful and cost effective solution... Read More

3 Rules of Website Designing and Layout

Now that you have got your domain name registered, your... Read More

Benefits Of An Accessible Website: Part 2 - The Business Case

The DDA (Disability Discrimination Act) states that service providers must... Read More

Website Value - Whats Your Business Website Worth?

If you were asked to put a value on your... Read More

7 Killer Ways To Increase Your Online Sales

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

Developing A Login System With PHP And MySQL

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

Are You Losing Sales Because of These 4 Simple Website Mistakes?

Losing website sales and traffic is sometimes simply a case... Read More

Search Engines and Customers Want Focused Web Site Content

How do you decide on the content, products and or... Read More

Ecommerce for Beginners

Like most average persons, I wanted some extra money to... Read More

Writing Effective ALT Text For Images

Anyone who knows anything about web accessibility knows that images... Read More

You Cant Just Build A Website And Hope It Works!

Like any area of business your website needs some effort... Read More

Making The Business Case For Web Standards

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

What is Blogger.com?

In the late 1990's three San Francisco based web developers... Read More

Top 10 Webmaster Challenges

Webmasters deal with a myriad of complex design challenges every... Read More

Let Marketing Manage Your Website Content

The definition of the phrase "Content Management" depends on what... Read More

If Its Done Its Done for: Make Your Website Part of Your Business before You Build

Web sites are an Ongoing Part of Business.All too many... Read More

4 Rock Solid Reasons For Building Your Own Website

What is the point of having a website, you may... 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