Basic class of OpenLayers is the OpenLayers.Map. It is the main view at your map application.
It has one mandatory parameter - div id, where the map is to be rendered.
Have a look in the documentation, how to initialize the map.
Several methods are available, among others:
addLayer (OpenLayers.Layer) – add layer to the map
- setLayerIndex (OpenLayers.Layer, Integer) – set index of the layer in
- layer stack
- addControl (OpenLayers.Control) && addControls([OpenLayers.Control]) –
- add control feature to the map (layerswitcher, scalebar, overview map, ...)
addPopup (OpenLayers.Popup) – add popup to the map
- setCenter (OpenLayers.LonLat, Integer, ...) – set new center of the
- map
getExtent () – returns OpenLayers.Bounds – current map extent
getResolution, getUnits, getScale,... – self explaining
- getZoomForExtent (OpenLayers.Bounds) – get zoom level for given
- extent
getResolutionForZoom (Integer) – get resolution for given zoom level
getZoomForResolution (Float) – get zoom for given resolution
zoomTo, zoomIn, zoomOut, zoomToExtent, zoomToMaxExtent, zoomToScale, ...
getLonLatFromPixel, getPixelFromLonLat, ...
And several attributes:
layers – list of layers
scales, resolutions,...
projection, units, ...
You will probably need most of selected attributes and methods, and possibly several others.
Example of creating map object the easiest way:
var map = new OpenLayers.Map("map1");
Example of creating map object in more complicated way:
var map = new OpenLayers.Map("map", {
scales: [2000000,1000000,500000,200000,100000,50000,20000,10000,5000],
units: "m",
projection: "epsg:102067",
maxExtent: new OpenLayers.Bounds(-905000,-1230000,-400000,-900000)
});