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


MORE RESOURCES:
RELATED ARTICLES
Building a Great Intranet Taxonomy
While it may seem like a "quick and easy" task, defining the navigation structure and organization of your intranet site will be one of the most challenging tasks you will face in the course of your project. It is also one of the most critical success factors.
The Topic Of Your Website
The first thing you will have to deal building your website has nothing to do with the web design itself, it's me related to content writing but it must be defined and will effect the rest of your actions. So first of all you need to decide what the topic of your future website is.
7 Tips to Make Your Order Page Work Harder
So your prospect, Mary, is sitting at the computer reading your compelling sales letter. She's convinced she needs your product.
Lead Generation How to -- 10 Tips On Generating More Internet Sales Leads
Many millions of dollars are being wasted on promoting and sending traffic to ineffective lead generation websites. Here are my top 10 tips to make your site generate more leads for you and your company.
The Power Is In The Pipes: How To Get Maximum Leverage From Your Website
What is the most important part of your online business?Many people would say: "my website". And that'sunderstandable - it's the most visible part of an internetbusiness.
What and How to choose the Right Keywords for Mega Traffic
Keywords in Search Engine Optimizing and Search Engine Marketing are the building blocks and foundation of your website on the search engines. If your foundation is weak or poorly put together your webpages won't have much to be based upon for the engines to rank with.
Trust Us! Sending Credible Messages
A company must earn and keep trust or sales don't happen. Imagine that last Sunday, while you were reading the paper, you saw an ad for a great deal on a digital camera.
Revealing the Firefox Secret Used by Top Web Developers and Power-Browsers
Profiles are one of the best kept secrets around regarding Mozilla Firefox (my browser of choice).In the role of web site designer, I find it useful to have Firefox set up with various Extensions for helping test compliance, keep track of Google Adsense earnings, checking PageRank and Alexa rating, etc.
Why A Simple Counter is Never Enough for Your Website
A simple website stats counter is not enough if you are really interested in finding out information about your traffic. Certainly, a simple web counter will tell you how many people have visited your site, but that is it.
How To Get Profits From Your 404 Page Not Found File
"'Page Not Found' on this Server. Check the URL and try again.
4 Marketing Tips for Resourceful Webmasters!
The internet is a sea of knowledge. Getting your information to 'float' by the right audience can be like finding that one special grain of sand on the seashore.
How Does Your Website Make Me Feel?
When people think about the Internet, they think about technology. When people hear that I am a Website strategy expert, they see me as a "techy type".
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 small business owners build a web site that is considered complete once the final copy is placed.
Top 5 Webmaster Tools You Can Pick Up For Pennies
1. SiteSpinner V2 - On Sale www.
How to Maximize the Value of Every Visitor to Your Website
While most marketers are beginning to understand the critical importance of maximizing conversion rates, few are tracking or working to maximize another critical measurement of website effectiveness.Visitor value?Visitor value is simply a representation of how much money you make per visitor to your website.
Frequent Business Question: How Do You Start a Web Business?
Today it seems everyone is jumping on the entrepreneur bandwagon, and who could blame them? Setting your own schedule, working from the comfort of your own home, and never having to deal with a horrible commute or office politics again, this option is quite popular among all ages. With the advent of the technology age, it seems more individuals are looking to the internet to provide them with goods or services.
Why You Need a Website
You hear a great deal about the Internet these days -- that it's revolutionised communication ..
Beware the Software Siren
I've heard several prominent web marketers mention in their classes and public forums how easy it is to create your own software. Why, all you have to do is run over to Elance.
10 Tips For Running A Profitable Web Site
1. Address your targeted audience on your business site.
Dreamweaver 8 Preview
August 8 2005, Macromedia announced a release of Studio 8. Based on the feedback of previous users, Macromedia made it's already very powerful software even better.