map2vrml is a script designed to generate a simple VRML world from an NCSA style HTMP imagemap mapfile, such as that generated by mapedit.

Circles, rectangles and polygons in the map file are propagated in the Z direction into cylinders, cuboids and polygonal prisms. Meta-information may be provided in the form of "!" tagged comments in the mapfile to alter the default color, height, and base elevation of the objects. Cones or spheres may be created instead of cylinders.


Usage < > demo.wrl

Using Thomas Boutell's mapedit, one can include comments and meta-commands in the comment field, one per line. Mapedit adds a leading "#", so the metacommands are entered eg. !color LightSalmon2

IMAP rectangles (rect) are translated to VRML Cube, using the current base, height and color settings.

IMAP polygons (poly) are translated to a prism (IndexedFaceSet) in VRML, using the current base, height and color.

IMAP circles are translated to VRML Cylinder. If the cone or sphere metacommands are used, VRML Cone or Sphere is used instead.

IMAP comments (regular comments, not metacommands) are translated to VRML Info nodes.

If the anchor metacommand is used, the IMAP URL is translated to WWWAnchor. Note that URLs must be absolute for some browser/viewer combinations.


The following meta-commands are implemented:

Command Function
#!color xxx Changes default color to xxx
#!height nnn Changes default height to nnn
#!base nnn Changes default base to nnn
#!anchor Enables anchor for following object only
#!cone Creates cone from circle
#!sphere Creates sphere from circle
#!scale Scales IMAP x,y co-ordinates to VRML co-ordinates
#!offset X,Y offsets added after scaling
#!landscape Rotates Y axis vertical and adds "daylight"
#!rotation Rotates following element only


Color names are obtained from the X11 showrgb utility. If this is not available, the limited default set provided may be expanded.


If the resulting world is meant to represent buildings, for instance, it should be reoriented so that "Y" is up. This may be done using the "landscape" meta-tag at the beginning of the map file.

Scaling, offsets

THe VRML spec. defines the units as 1 metre. Using the "scale" meta-tag, IMAP pixel co-ordinates may be scaled into VRML units, e.g. #!scale 0.3. Only x,y are affected, not height.
X,Y Offsets may be defined e.g. #!offset 100 300. Offsets are added after scaling but before global rotation introduced by the landscape tag.
map2vrml.tar.gz map2vrml distribution

Other VRML tools/links

Vancouver Webpages