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:

Game on  Midland Daily News

Website Strategy!

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

How to Draw Icons or Images on a Mapserver Generated Map

In this example I have used the map of the... Read More

CPanel Fantastico - Features and Benefits

Fantastico is a 3rd-party cPanel add-on and can be purchased... Read More

Flash Deadly Sins (That Can Kill Your Web Business)

Looks like every client wants a Flash site these days... Read More

Top 10 Webmaster Challenges

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

Marketing Your Business Online

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

3 Rules of Website Designing and Layout

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

What ROI You Should Expect From Your Web Site

Is Your Web Site an Expense or an Investment?Why don't... Read More

The Cost Of A Web Site

Just starting out, you can start with a simple informational... Read More

How Improving Your Sites Usability Can Increase Your Buyers by 40% and Boost Each Order By 10%!

With all of the factors involved in designing and building... Read More

How To Keep Your Website Sticky

Developing a website with content that entices visitors to return... Read More

10 Tips For Running A Profitable Web Site

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

Three Things Every Website Should Do

When I started my company in 2002, I knew I... Read More

You May Be Losing Valuable Traffic - And Not Even Know It!

Here's something you may never have thought of before:If I... Read More

How Does Your Website Make Me Feel?

When people think about the Internet, they think about technology.... Read More

Developing State-enabled Applications With PHP

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

How To Get Your Customers To Trust Your Website

Research reveals three important facts:1) The Internet is one of... Read More

Improve Web Sales Figures Forever And Ever Amen!

"How do I improve web site sales figures?" The CEO... Read More

Study Your Sites Performance Via Hit Tracking

Knowledge is power.And undoubtedly, it is the key to making... Read More

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

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

Profitable Websites for Exclusive Industries

In the region where my company is located, South Bend,... Read More

I Want To Be A Freelancer

So you have decided that you want to do freelance... Read More

7 Reasons Why Your Small Business Needs A Web Site

Many small businesses have the misconception that their business can... Read More

Ten Major Tips to Develop a Multilingual Web Site to Work

If you are living in a country that its native... Read More

Beautiful Web Sites Seldom Make More Sales

Designing an E-commerce Web site is not as simple as... Read More