I wan't to use setCenter method in a javascript to interact with a listbox.
At first this code is working fine :

    var ol = jQuery('.openlayers-map').data('openlayers');//assuming there is just one map on the page
    ol.openlayers.zoomTo(9);

But this code isn't working :

    var ol = jQuery('.openlayers-map').data('openlayers');//assuming there is just one map on the page
    var lonLat = new OpenLayers.LonLat(47.678334,-2.590485).transform(new OpenLayers.Projection("EPSG:4326"), ol.openlayers.getProjectionObject());
    ol.openlayers.setCenter(lonLat, 11);

if you search 47.678334,-2.590485 in google maps, you arrive somwhere in the west of france, but my openlayer map is showing a point somewhere near Somalia ;)
Thanks for helping !

Comments

cyprien2’s picture

My fault, it was not :
var lonLat = new OpenLayers.LonLat(47.678334,-2.590485).transform(new OpenLayers.Projection("EPSG:4326"), ol.openlayers.getProjectionObject());
but
var lonLat = new OpenLayers.LonLat(-2.590485, 47.678334).transform(new OpenLayers.Projection("EPSG:4326"), ol.openlayers.getProjectionObject());
i've inverted Lontitude and Latitude :(

cyprien2’s picture

Issue summary: View changes
Status: Active » Closed (fixed)