Index | OAT homepage | OpenLink Software

map.js

map.js

Abstract API atop various mapping providers.

Objects

OAT.Map(something, provider, optionsObject, specificOptions)

Creates a map as a child of something.provider is one of TYPE_ constants. optionsObject may contain:

Methods

OAT.Map::addTypeControl()

Adds a 'map type' control to the map.

OAT.Map::addMapControl()

Adds a 'map navigation' control to the map.

OAT.Map::setMapType(type)

Sets map type to one of MAP_ constants.

OAT.Map::centerAndZoom(lat, long, zoom)

Pans the map to given lat and long coordinates and zooms.zoom ranges from 0 (far) to 16 (close).

OAT.Map::setZoom(zoom)

Changes current zoom level.

OAT.Map::getZoom()

Returns current zoom level.

OAT.Map::addMarker(group, lat, long, file, w, h, callback)

Adds a marker to the map. Marker belongs to marker group group(any internal value) and is located at coordinates specified in lat and long.file specifies an image file name (wandhare its dimensions), false when default image should be used. Finally, callback is a function to be executed when user clicks marker.

OAT.Map::removeMarker(marker)

Removes existing marker.

OAT.Map::removeMarkers(group)

Removes all markers which belong to group.

OAT.Map::openWindow(marker, something)

Opens window, anchored to marker.something is a DOM node to be appended into window.

OAT.Map::closeWindow()

Closes opened window.

OAT.Map::optimalPosition(pointArray)

Zooms map so all points specified in pointArray (array of 2-element arrays) can be visible simultaneously.

OAT.Map::geoCode(address, callback)

Performs a geocoding lookup of address. When result is returned, callback is executed. Its only argument is false when no result was found, or an array of[lat,long].

Constants

OAT.MapData.TYPE_

Constants specifying maps provider

OAT.MapData.MAP_

Constants specifying map types.

OAT.MapData.FIX_

Constants specifying how markers that are too close to each other will be handled.

Example


var obj = {
        fix:OAT.MapData.FIX_ROUND1,
        fixDistance:20,
        fixEpsilon:0.5
}
var map = new OAT.Map("myDiv",OAT.MapData.TYPE_G,obj);
map.centerAndZoom(0,0,8); /* africa, middle zoom */
map.addTypeControl();
map.addMapControl();
map.setMapType(OAT.MapData.MAP_ORTO); /* aerial */
Copyright (C) 2005-2009 OpenLink Software