[OpenLayers-Users] Markers with dymamically changing appearance
    Guyren G Howe 
    gisborne at emailuser.net
       
    Wed Aug 11 06:30:25 EDT 2010
    
    
  
On Aug 11, 2010, at 2:18 , Sveen Atle Frenvik (Geomatikk IKT) wrote:
>          var center = this.map.getLonLatFromPixel(new
> OpenLayers.Pixel(centerPx.x,centerPx.y));
>          var leftBottom = this.map.getLonLatFromPixel(new
> OpenLayers.Pixel(centerPx.x-addX, centerPx.y+addY));
>          var rightTop = this.map.getLonLatFromPixel(new
> OpenLayers.Pixel(centerPx.x+addX, centerPx.y-addY));
> 
>          //create the polygon, the feature and add to the layer
>          var poly = new OpenLayers.Geometry.Polygon(
>                  new OpenLayers.Geometry.LinearRing([
>                      new OpenLayers.Geometry.Point(leftBottom.lon,
> leftBottom.lat),
>                      new OpenLayers.Geometry.Point(leftBottom.lon,
> rightTop.lat),
>                      new OpenLayers.Geometry.Point(rightTop.lon,
> rightTop.lat),
>                      new OpenLayers.Geometry.Point(rightTop.lon,
> leftBottom.lat)
>                  ])
>                  );
>          this.feature = new OpenLayers.Feature.Vector(poly);
>          this.mylayer.addFeatures([this.feature]);
>      },
> 
I was hoping I wouldn't need to do anything that was
1. This complicated; and
2. This wasteful.
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.
This seems enormously wasteful and presumably won't work as well with larger numbers of markers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100811/622fe836/attachment.html
    
    
More information about the Users
mailing list