Bringing Internet Technology Innovations to Market since 1991
  News Products Outsourcing About Us Contact Us
what's new?what's new? featuresfeatures samplessamples manualmanual downloaddownload buybuy
  Tonec Homepage
ProductsActive Imagesamples

Please view complete list of samples

Sample 12

World Map v1.1

The map of the world holds coordinate pairs to generate map images from database. This data can be used to draw maps on server side in PNG, JPEG, GIF, WBMP formats and to build click areas (image maps) for processing on client side.

Italy, Mauritania, Mexico, Venezuela, North Korea and Philippines have been removed from the free version of the map. Full version is available in Active Image commercial version. Active Image v 5.0

Platform: Windows 95/98/ME/NT/2000/XP.

Can be used in all programs that can call ActiveX components. It includes ASP, IIS, MS Word, Access, Excel and many others. Coordinate data can also be used separately in your development projects.

 Sample 1. Client-side image maps (europe.asp)

The downloadable distribution package includes:

Download demo version World Map v1.1 (it demands installed demo or full version of Active Image).


Features (for developer):

Quick start instruction to use World Map

Quick start instruction for ASP developers

Sample 2. Drawing World Map


Dim im

'Create component to draw the image 
Set im = CreateObject("ActiveImage.Images.1")

'Declare array for coordinate pairs
Dim coord(6000)

'Declare database access objects
Dim AdoConnDim rs

'Connect to database
Set AdoConn = CreateObject ("ADODB.Connection")
AdoConn.Provider = "Microsoft.Jet.OLEDB.4.0"
AdoConn.ConnectionString = "Data Source=dbw.mdb"
Set rs = CreateObject("adodb.recordset")

'Open the table with coordinates
rs.Open "worlddata", AdoConn, 2, 3

w = 2168
h = 1115

'Create image
im.CreateImage w,h

'Select blue color and fill the image
im.SetColor 127,127,255
im.DrawFilledRectangle 0,0,w,h

ipixel = 0
ireg = -1
icountry = -1

'Pass through all points

do  while not rs.eof

x = rs(1)
y = rs(2)
c = rs(3)
r = rs(4)

'If encountered another country, would draw the previous one
if (ireg <> r ) or (icountry <> c) then
  if (ipixel > 2 and ipixel < 9000) then
    'Draw the country in gray with black borders
    im.SetColor 127,127,127
    im.DrawFilledPolygon coord, 2*(ipixel)
    im.SetColor 0,0,0
    im.DrawPolygon coord, 2*(ipixel)
     for ii = 0 to ipixel
      if coord(2*ii) <> "" and coord(2*ii+1) <> "" then
        im.SetPixel Cint(coord(2*ii)), CInt(coord(2*ii+1))
      end if
  end if
  ipixel = 0
  icountry = c
  ireg = r
end if

ipixel = ipixel + 1

'Set coordinates in array
coord((ipixel-1)*2) = xcoord((ipixel-1)*2+1) = y


'Draw the last country
if (ipixel > 2 and ipixel < 9000) then
  'Draw the country in grey with black borders
  im.SetColor 127,127,127
  im.DrawFilledPolygon coord, 2*(ipixel)
  im.SetColor 0,0,0
  im.DrawPolygon coord, 2*(ipixel)
  for ii = 0 to ipixel
    if coord(2*ii) <> "" and coord(2*ii+1) <> "" then
      im.SetPixel Cint(coord(2*ii)), CInt(coord(2*ii+1))
   end if
end if

'Close data access
Set rs = Nothing
Set AdoConn = Nothing
'Save the image into file
im.WriteToFile "worldgray.png"
'Free memory and delete object
Set im = Nothing

Picture 2. World Map. One color coloring. The fragment of the full map. Large

Sample 3-4 . Random.vbs Gradient.vbs

Picture 3. Random coloring. Large Picture 4. Gradient coloring. Large

Possible application areas:

The following countries are represented on the map:

Abidjan, Afghanistan, Albania, Algeria, American Samoa, Andorra, Angola, Anguilla, Antarctica, Antigua and Barbuda, Argentina, Armenia, Australia, Austria, Azerbaijan, Bahrain, Bangladesh, Barbados, Belarus, Belgium, Belize, Benin, Bermuda, Bhutan, Bolivia, Botswana, Brazil, British Virgin Islands, Brunei, Bulgaria, Burkina Faso, Burundi, Cambodia, Cameroon, Canada, Cape Verde, Cayman Islands, Central African Republic, Chad, Chile, China, Colombia, Comoros, Congo, Cook Islands, Costa Rica, Cuba, Cyprus, Czech Republic, Denmark, Djibouti, Dominica, Dominican Republic, Ecuador, Egypt, El Salvador, Equatorial Guinea, Eritrea, Estonia, Ethiopia, Falkland Islands (Islas Malvinas), Fiji, Finland, France, French Guiana, French Polynesia, Gabon, Georgia, Germany, Ghana, Greece, Greenland, Grenada, Guadeloupe, Guam, Guatemala, Guinea, Guinea-Bissau, Guyana, Haiti, Honduras, Hungary, Iceland, India, Indonesia, Iran, Iraq, Ireland, Israel, Italy, Jamaica, Japan, Jordan, Kanar Islands, Kazakstan, Kenya, Kiribati, Korea, North, Korea, South, Krait, Kuwait, Kyrgyzstan, Laos, Latvia, Lebanon, Lesotho, Liberia, Libya, Liechtenstein, Lithuania, Luxembourg, Madagascar, Malawi, Malaysia, Malazia, Maldives, Mali, Malta, Martinique, Mauritania, Mauritius, Mexico, Micronesia, Miena, Moldova, Monaco, Mongolia, Morocco, Mozambique, Namibia, Nauru, Nepal, Netherlands, New Caledonia, New Zealand, Nicaragua, Niger, Nigeria, Northern Mariana Islands, Norway, Oman, Pakistan, Palau, Panama, Papua New Guinea, Paraguay, Peru, Philippines, Poland, Portugal, Qatar, Reunion, Romania, Russia, Rwanda, Saint Kitts and Nevis, Saint Lucia, Saint Vincent and the Grenadines, San Chuan, Sao Tome and Principe, Saudi Arabia, Senegal, Seychelles, Sierra Leone, Singapore, Slovakia, Slovenia, Solomon Islands, Somalia, South Africa, Spain, Sri Lanka, Sudan, Suriname, Swaziland, Sweden, Switzerland, Syria, Taiwan, Tajikistan, Tanzania, Thailand, The Bahamas, The Gambia, Togo, Tokelau, Tonga, Trinidad and Tobago, Tunisia, Turkey, Turkmenistan, Turks and Caicos Islands, Tuvalu, Uganda, Ukraine, United Arab Emirates, United Kingdom, United States, Uruguay, Uzbekistan, Vanuatu, Venezuela, Verging Island, Vietnam, Western Sahara, Yemen, Yugoslavia, Zaire, Zambia, Zimbabwe.

Note that Tonec Inc. also provides custom programming and cost-effective offshore software development services.

Next sample >> 

If you have any questions or bug reports, write to for technical support.

  TonecPrivacy Policy
  1999-2005. Tonec, Inc. All rights reserved.