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


Getting a Web Site Can Be Fast, Easy, and Inexpensive When You Know Your Options

So what do you do if need to get a... Read More

Six Basic Reasons Why Visitors Stay On Your Web Site

1. The first page appears quickly.It's a good way to... Read More

From Concept to Website

You've decided to create a website to market your products... Read More

Frequent Business Question: How Do You Start a Web Business?

Today it seems everyone is jumping on the entrepreneur bandwagon,... Read More

MySQL Database Handling in PHP

Most interactive websites nowadays require data to be presented dynamically... Read More

Wheres Your Focus, Money or Customer?

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

5 Tips For A Better Website

Having an eye catching website is great, but are you... Read More

Non-Profits: Successful Online Strategies

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

7 Killer Ways To Increase Your Online Sales

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

How To Write More Powerful Online Text

Although there are significant differences among the various types of... Read More

Find the Purpose of Your New / Proposed Website

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

Bring Your Visitors Back Clamoring for More! Maintain and Improve Your Web Site Weekly - Part 1

80% of your Web site is Maintenance!Once your Web site... Read More

5 Ways to Build a Website

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

4 Marketing Tips for Resourceful Webmasters!

The internet is a sea of knowledge. Getting your information... Read More

Five Steps to Create Your Software Product with Outsourcing

Many executives and investors are skeptical that software products can... Read More

Web Site Optimization: How To Speed Up Your Web Site By Minimizing Your GIF and PNG Image Bit-Depth

Are bloated images slowing down your web site and causing... Read More

Tips for Building a Great Business Website

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

New Years Resolutions: Is Improving Your Website One of Them?

With the New Year upon us yet again, it's time... Read More

Seven Daft Things Not To Do To Your Website

1. Splash pagesMost of the time splash pages are uncalled... Read More

Be Creative Before You Purchase Or Create A Website

Before you jump into spending coutnless hours on designing and... Read More

Website Globalization

Globalize Your WebsiteThe Internet has unlocked a wide array of... Read More

Earning From Your Website

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

Build or Buy a CMS?

Creating a content management system either from scratch,... Read More

Improve Conversion Rates ? Effective Content

Your site is fast and getting traffic, but conversion rates... 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

5 Essential Traits Of A Home Business Website

So you've decided to start an online work at home... Read More

7 Questions to Understand Your Customer Better

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

Effective Webdesign

D.zigns dzignerwebs The Basics Before starting on... Read More

You Need a Website!

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

17 Tips to Plan a Website

Everyone wants one.Everyone wishes they knew how to make one.SOME... Read More

What Your Customers Say About YOUR Site! Part 1

The following is a list of patterns that many visitors... Read More

CPanel Fantastico - Features and Benefits

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

Enhance Your Website With A Yahoo-Style Directory

Does your website have a links/resources page?Do you exchange reciprocal... Read More