[OpenLayers-Users] zoomToExtent based on a postgre table

Hugo hfpmartins at gmail.com
Mon Apr 13 13:47:49 EDT 2009


Thanks Eric,

I had solved this problem by making a column to each bounding coordinate
(xmin, ymin, ...). After selection on the combobox i'm able to access
different columns in the postgres. This was my solution and it is working.
Nevertheless, thanks a lot for your answers which are, no doubt, pretty much
helpfull.
Cheers,

Hugo


On Mon, Apr 13, 2009 at 3:21 PM, Eric Lemoine
<eric.lemoine at camptocamp.com>wrote:

> On Thu, Apr 9, 2009 at 5:21 PM, Hugo <hfpmartins at gmail.com> wrote:
> > 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,
>
> Try this:
>
> var bounds = OpenLayers.Bounds.fromString("-8.341552734375,
> 40.4988288879395, -8.24995231628418, 40.5880279541016");
>
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090413/e907ace9/attachment.html


More information about the Users mailing list