[OpenLayers-Users] RC 2.5-RC3 Problem with Boxes
Brent Pedersen
bpederse at gmail.com
Thu Sep 27 13:55:53 EDT 2007
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
> > >
> > >
> >
>
>
More information about the Users
mailing list