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


How to Create a Professional Web Site in 24 Hours

While creating a Web site may seem like... Read More

Websites: You Get What You Pay For!

So you finally decided to invest in a web presence... Read More

How To Evaluate Your Web Sites Performance

Setting up a website is the very first step of... Read More

3 Essential Tools Every Website Designer and Marketer Needs

Appealing to others is really important when you have a... Read More

5 Ways to Build a Website

If you are like me you have wanted to build... Read More

The Importance of Website Stats to You

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

Beware the Software Siren

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

What Business Owners MUST Know BEFORE They Commit To Having A Web Site

Q1.Why would I need a web site? A1.- Improve my... Read More

What and How to choose the Right Keywords for Mega Traffic

Keywords in Search Engine Optimizing and Search Engine Marketing are... Read More

Three Way Linking - Webmaster Strategy

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

The Secret Benefit Of Accessibility: Part 1 - Increased Usability

Web accessibility has so many benefits that I really do... Read More

Using Mini Websites - Powerful Way to Direct Marketing

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

Writing Effective ALT Text For Images

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

12 Tips To Great Websites

Why do some sites succeed while the vast majority of... Read More

Website Survival Guide

In the big, wide online world there are millions of... Read More

You Need a Website!

No matter the size of your business, having a web... Read More

Having a Domain Name And Web Site Gives Your Business The Key To The Door

Just like all things in life, the ways to run... Read More

9 Simple Steps to Create a Background Tiled Image Branded with Your Name

You have seen those web pages where they have the... Read More

Growing Your Meetings In CyberSpace

As increasing numbers of people search for information on the... Read More

Three Things Every Website Should Do

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

Learn What 98% of Targeted Visitors Do On Your Website

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

Running An Effective Website

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

10 Things You Should Be Monitoring On Your Website

Every business needs to know how it is doing. That's... Read More

Why to Have a Website for Your Company

After having decided to start a business, the next thing... Read More

Tips for Building a Great Business Website

A website is lifeline of internet home business. In order... Read More

7 Reasons Why Your Small Business Needs A Web Site

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

Creating Dynamic Website Content with PHP - MySQL

Fresh website content for your visitors can be of real... Read More

Website Success is Key

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

Preventing Repeat Form Submission Using PHP Sessions

We've all seen those messages on some websites warning not... 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

The 2 Most Common Web Site Mistakes

When we review the sites of potential clients, there are... 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

What YOU Should Know Before Getting A Web Site!

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