I have the following very simple code:

@map_center = [-32.951106, -60.669952]
@map = new ol.Map({
        target: 'map-canvas',
        layers: [new ol.layer.Tile({source: new ol.source.OSM()})],
        view: new ol.View({
          center: @map_center,
          zoom: 5

It's in coffeescript, but you will get the idea. The problem is, the map does not center at all. It gets stuck in [0, 0] Am I doing something wrong?

1 Answer 1


Try with something like [-4000000,-7000000] (using coordinate in epsg:3857).

With your coordinates:

center: ol.proj.transform([-32.951106, -60.669952], 'EPSG:4326', 'EPSG:3857')
  • Great..! It moves! Could you clarify a little on epsg? I used the same coordinates in google maps and they worked ...
    – Alvaro
    Nov 15, 2014 at 19:48
  • As I understand it, the coordinates I used are in degrees
    – Alvaro
    Nov 15, 2014 at 19:49
  • Updated my answer to use EPSG:4326
    – doktoreas
    Nov 15, 2014 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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