[OpenLayers-Users] zoomToExtent based on a postgre table

Hugo hfpmartins at gmail.com
Thu Apr 9 11:21:34 EDT 2009


Hello,

I'm trying to make a zoomToExtent based on a postgres table which has in the
same column the values for defining a bounding box. So, for each record
there i have one field with minx, miny, maxx and maxy (example of a record:
"010101", "-8.341552734375, 40.4988288879395, -8.24995231628418,
40.5880279541016"). On my application i have 3 combos which leads the user
to select one record from that table and to parse a variable (called freg)
with the bounding box exactly as shown before. Finally, i have a button with
the following handler:

console.log(freg);

var bbounds = new OpenLayers.Bounds(freg);
console.log('bbounds: ' + bbounds);
var centrarBB = bbounds.transform(wgs, mercator);
console.log('centrarBB:' + centrarBB);
map.zoomToExtent(centrarBB, {closest: true});

I think this code is working. The problem happens just in the beginning when
defining openlayers bounds (it is just accepting the first coordinate from
the variable freg. Here is the output form firebug:

freg: -6.94578313827515, 41.2489624023438, -6.88994789123535,
41.317310333252
bbounds: left-bottom=(-6.94578313827515,null) right-top=(null,null)
centrarBB:left-bottom=(-773201.0421132954,-7.081154551613622e-10)
right-top=(0,-7.081154551613622e-10)

Do you have any suggestions??
Thanks in advance,

Hugo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090409/e82e5441/attachment.html


More information about the Users mailing list