[OpenLayers-Users] Dynamically Sized Points With Styles

Arnd Wippermann arnd.wippermann at web.de
Fri Oct 10 14:25:53 EDT 2008


The resolution is units per pixel. if you want a point with a radius of 20km
= 20000m, then you can calculate the radius in pixel = 20000 / actual
resolution.
 
Instead of a point feature, you can also take a regular polygon with ie. 20
sides to get a circle. Then the radius have to be in units of the map and as
it is a geometric object, it changes the size with zoom. 

Arnd Wippermann
 
  _____  

Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Chris Streeter
Gesendet: Freitag, 10. Oktober 2008 19:09
An: users at openlayers.org
Betreff: Re: [OpenLayers-Users] Dynamically Sized Points With Styles


As a followup to this question, I'm trying to wrap my head around how to
translate actual distances to what is shown on the map.  For example, if I
wanted to create a feature with a radius of 20 kilometers, how do I specify
the radius for the feature based on the map's resolution and scale.  I'm not
quite clear on how feature radii relate to map resolution and scale.

Thanks,

- Chris


On Wed, Oct 8, 2008 at 11:49, Arnd Wippermann <arnd.wippermann at web.de>
wrote:


http://n2.nabble.com/GML%2C-Point-and-Change-the-Size-of-the-Circle...-tc791
275.html#a791275
 
listen to the zoom event and redraw the feature with the new styleMap, where
the pointRadius is a function of the zoom level:
 
new OpenLayers.StyleMap({
    "default": OpenLayers.Util.applyDefaults({
        pointRadius: faktor*map.getZoom()
    }, OpenLayers.Feature.Vector.style["default"]
});


Arnd Wippermann

  _____  

Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Chris Streeter
Gesendet: Mittwoch, 8. Oktober 2008 07:04
An: users at openlayers.org
Betreff: [OpenLayers-Users] Dynamically Sized Points With Styles


I was wondering if it is possible to dynamically resize a point based on the
zoom level of the map.

With the example at
http://www.openlayers.org/dev/examples/styles-unique.html, can we make the
points change their radius as we zoom in?  I'd like to keep the circles the
same relative size to the underlying map layer.

Thanks,

- Chris



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081010/6c8adc39/attachment.html


More information about the Users mailing list