Hello I am using OpenLayers, and I would like make zoom map to show all USA territory I have added next code to my JS file
zoomMapTo: function (x1, y1, x2, y2) {
var bounds = new OpenLayers.Bounds(x1, y1, x1, y2);
map.zoomToExtent(bounds,4);
}
But I don't know that coordenate should I use I tring to call it like
zoomMapTo(-19838714.3168264, 2146075.00656018, 19971050.5931969, 11542768.518094);
or
zoomMapTo(-120, 20, -70, 50);
But I go to some please in ocean That coordinate I must use ?
Thanks for help.
I find out soulution i need just convert it to EPSG:4326
:
var bounds = new OpenLayers.Bounds();
bounds.extend(new OpenLayers.LonLat(x1, y1).transform(new OpenLayers.Projection("EPSG:4326"), appOL.mapobj.map.getProjectionObject()));
bounds.extend(new OpenLayers.LonLat(x2, y2).transform(new OpenLayers.Projection("EPSG:4326"), appOL.mapobj.map.getProjectionObject()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.