<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Aug 11, 2010, at 2:18 , Sveen Atle Frenvik (Geomatikk IKT) wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div>
<!-- Converted from text/plain format --><p><font size="2">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; var center = this.map.getLonLatFromPixel(new<br>
OpenLayers.Pixel(centerPx.x,centerPx.y));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var leftBottom = this.map.getLonLatFromPixel(new<br>
OpenLayers.Pixel(centerPx.x-addX, centerPx.y+addY));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var rightTop = this.map.getLonLatFromPixel(new<br>
OpenLayers.Pixel(centerPx.x+addX, centerPx.y-addY));<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //create the polygon, the feature and add to the layer<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var poly = new OpenLayers.Geometry.Polygon(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new OpenLayers.Geometry.LinearRing([<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new OpenLayers.Geometry.Point(leftBottom.lon,<br>
leftBottom.lat),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new OpenLayers.Geometry.Point(leftBottom.lon,<br>
rightTop.lat),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new OpenLayers.Geometry.Point(rightTop.lon,<br>
rightTop.lat),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new OpenLayers.Geometry.Point(rightTop.lon,<br>
leftBottom.lat)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ])<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.feature = new OpenLayers.Feature.Vector(poly);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.mylayer.addFeatures([this.feature]);<br>
&nbsp;&nbsp;&nbsp;&nbsp; },<br></font></p></div></blockquote></div>I was hoping I wouldn't need to do anything that was<div><br></div><div>1. This complicated; and</div><div>2. This wasteful.<div><br></div><div>Presumably, after I do all that tedious converting to latlongs, the framework is going to convert them back to screen coordinates. Then when the user resizes, I'm going to erase them (because they're now the wrong size), recalculate all the latlongs, then the framework re-uncalculates them, and so on.</div><div><br></div><div>This seems enormously wasteful and presumably won't work as well with larger numbers of markers.</div></div></div></body></html>