[OpenLayers-Users] RC 2.5-RC3 Problem with Boxes

Linda Rawson linda.rawson at gmail.com
Thu Sep 27 14:48:03 EDT 2007


That would be fine if I was only drawing one box.  My problem is I need to
draw hundreds of them and they don't appear at the right location.  Their
height is off.  The width appears to be fine but the height is not offset.
I still think there is a bug here.  I provided a very simple example.  If
the box is the same bounds as the viewport then why isn't the box the same
size?  It appears to have a problem with the sizing.

Linda Rawson


On 9/27/07, Brent Pedersen <bpederse at gmail.com> wrote:
>
> probably something like:
> var box = new OpenLayers.Marker.Box(map.getExtent());
> since your map may not be able to display the exact bounds you request
> given set resolutions/scales.
>
>
> On 9/27/07, Linda Rawson <linda.rawson at gmail.com> wrote:
> >
> >
> > I switch the example.
> >
> > var boxes = new OpenLayers.Layer.Boxes("Images");
> >     var bounds = new OpenLayers.Bounds(-96.0051889, 28.9812486, -
> 95.9925747,
> > 28.9917903 );
> >    var box = new OpenLayers.Marker.Box(bounds);
> >    box.setBorder ("yellow",4);
> >    boxes.addMarker(box);
> >    map.addLayer(boxes);
> >
> >    map.zoomToExtent(bounds);
> >
> > But then I get a yellow box in the middle of the map.  I want a box the
> SAME
> > size as the viewport I am looking at.  How do I do that?
> > Linda Rawson
> >
> >
> >
> > On 9/27/07, Brent Pedersen <bpederse at gmail.com> wrote:
> > > > var bounds = new OpenLayers.Bounds(-96.0051889, 28.9917903,
> > -95.9925747,  28.9812486);
> > >
> > > hi, it looks like your ymin and ymax are switched.
> > > -brent
> > >
> > >
> > > On 9/27/07, Linda Rawson <linda.rawson at gmail.com> wrote:
> > > > I have the following code:
> > > >
> > > >
> > > >
> > > > <html xmlns=" http://www.w3.org/1999/xhtml">
> > > >   <head>
> > > >     <style type="text/css">
> > > >         #map {
> > > >             width: 600px;
> > > >              height: 600px;
> > > >             border: 1px solid black;
> > > >         }
> > > >     </style>
> > > >     <script src="../lib/OpenLayers.js"></script>
> > > >     <script type="text/javascript">
> > > > <!--
> > > > function init()
> > > > {
> > > >    var map = new OpenLayers.Map( 'map');
> > > >
> > > >    var ol_wms = new OpenLayers.Layer.WMS.Untiled( "OpenLayers WMS",
> > > >    " http://labs.metacarta.com/wms/vmap0?",
> > > >    {
> > > >       layers : 'basic'
> > > >    }
> > > >    );
> > > >    ol_wms.addOptions(
> > > >    {
> > > >       isBaseLayer : true,
> > > >    ratio: 1
> > > >    }
> > > >    );
> > > >    map.addLayers([ol_wms]);
> > > >
> > > >    map.addControl(new
> > OpenLayers.Control.MousePosition());
> > > >
> > > >    var boxes = new OpenLayers.Layer.Boxes("Images");
> > > >    var bounds = new OpenLayers.Bounds(-96.0051889, 28.9917903,
> > -95.9925747,
> > > >  28.9812486);
> > > >    var box = new OpenLayers.Marker.Box(bounds);
> > > >    box.setBorder ("yellow",4);
> > > >    boxes.addMarker (box);
> > > >    map.addLayer(boxes);
> > > >
> > > >    map.zoomToExtent(bounds);
> > > >
> > > > }
> > > > // -->
> > > >     </script>
> > > >   </head>
> > > >   <body onload="init()">
> > > >     <h1>OpenLayers Example</h1>
> > > >     <div id="map"></div>
> > > >   </body>
> > > >  </html>
> > > >
> > > >
> > > > I get a map with the proper coordinates but the box is simply one
> line.
> > I
> > > > think there is a bug in the boxes that is not using the correct
> lat/lon
> > > > combinations.  Has anybody else ran into this?
> > > >
> > > > Thanks,
> > > >
> > > > Linda Rawson
> > > > _______________________________________________
> > > > Users mailing list
> > > > Users at openlayers.org
> > > > http://openlayers.org/mailman/listinfo/users
> > > >
> > > >
> > >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070927/7ec53c8b/attachment.html


More information about the Users mailing list