You can center a map to highlight a particular geographic feature: an event, your corporate office, or simply a point of interest. Like panning and zooming, GeoStream makes it easy to center a map - you can do it with a single line of code.

Use the setCenter() function to center a map on a given latitude-longitude coordinate. You can use the setCenter() function at any time.

// this could be triggered by clicking on a ‘home’ button
map.setCenter(new Telogis.GeoBase.LatLon(33.581218, -117.72681));

You can also specify a center when creating a map, but remember, you can only do this once.

// center map on construction, using the ‘center’ property
var map = new Telogis.GeoBase.Widgets.Map({ 
       id: 'main_map', 
       center: new Telogis.GeoBase.LatLon(33.581218, -117.72681) 
});

Published, Jun 28th 2010, 15:35

Tagged under: javascript maps