Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just started to learn Open Map and I am having some difficulty working with the API. This may look trivial, but please bear with me. I am trying to get Open Map to display a region of the map bounded by the bounds variable. Having specified the unit as degrees, I would expect that the bounds shown would also be in degrees. But it seems to me that it is in a different unit which is much smaller than degrees:

var options = {
 projection: 'EPSG:4326'
 ,units: 'degrees'
var map = new OpenLayers.Map('map',options);
var bounds = new OpenLayers.Bounds(-100, -90, 100, 90);
var osm = new OpenLayers.Layer.OSM();            
var gmap = new OpenLayers.Layer.Google("Google Streets");
map.addLayers([osm, gmap]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToExtent(bounds, true);

My question is, how do I get open map to parse the input bounds as degrees?

share|improve this question
up vote 1 down vote accepted

You should use transform method of OpenLayers.Bounds object:

epsg4326 = new OpenLayers.Projection('EPSG:4326');
epsg900913 = new OpenLayers.Projection('EPSG:900913');
bbox = new OpenLayers.Bounds(-100, -80, 100, 80);
bounds = bbox.transform(epsg4326,epsg900913);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.