In this way when you zoom in the map, your features will be huge.
Except that is the behaviour you want to achieve...

cheers

On Thu, Dec 17, 2009 at 11:44 AM, Andreas Hocevar <ahoce...@opengeo.org> wrote:
> Hi,
>
> why so complicated?
>
> Ivan pointed you to the right way to do it. If you look at it, you see a
> context with a getType function. In this function, you can return the
> desired point radius. If you have your radius in map units, just do the
> following:
>
> return radiusInMapUnits / map.getResolution();
>
> Regards,
> Andreas.
>
>
> On 2009-12-17 11:15, Mehmet Sirin wrote:
>> hi, there you have the same problem: point-vectors stays as they are
>> -without stretching/resizing.
>>
>> i just find the solution:
>>
>>           function createCircle(lat, lon, radius){
>>            polygonLayer.removeFeatures(polygonLayer.features);
>>                 var style = {
>>                     fillColor: '#ff0000',
>>                     strokeWidth: 1,
>>                     pointRadius: radius,  // in map coordinates
>>
>>                 };
>>
>>
>>                var point = new OpenLayers.Geometry.Point(lat, lon);
>>                var polygonFeature =
>> OpenLayers.Geometry.Polygon.createRegularPolygon(point,radius,30,0);
>>                var feature = new
>> OpenLayers.Feature.Vector(polygonFeature,null, style);
>>
>>
>>                 polygonLayer.addFeatures([feature]);
>>                 polygonLayer.setOpacity(0.5);
>>
>>
>>             }
>>
>> 2009/12/17 Ivan Grcic <igr...@gmail.com <mailto:igr...@gmail.com>>
>>
>>     Hi, cant you make something like this:
>>     http://openlayers.org/dev/examples/styles-context.html
>>
>>     On Thu, Dec 17, 2009 at 10:34 AM, Mehmet Sirin
>>     <m.siri...@googlemail.com <mailto:m.siri...@googlemail.com>> wrote:
>>     > hi,
>>     > since there isn't a buffer function integrated in openlayers i
>>     have to find
>>     > other ways to simulate buffering a point and displaying it:
>>     >
>>     >  function pointBuffer(lat, lon, radius,color){
>>     >            polygonLayer.removeFeatures(polygonLayer.features);
>>     >                 var style = {
>>     >                     fillColor: '#ff0000',
>>     >                     strokeWidth: 1,
>>     >                     pointRadius: radius,  // in pixels
>>     >
>>     >                 };
>>     >
>>     >
>>     >                 var point = new OpenLayers.Geometry.Point(lat, lon);
>>     >                 var feature = new
>>     OpenLayers.Feature.Vector(point,null,
>>     > style);
>>     >
>>     >                 polygonLayer.addFeatures([feature]);
>>     >                 polygonLayer.setOpacity(0.5);
>>     >
>>     >             }
>>     >
>>     >
>>     
>> ---------------------------------------------------------------------------------------------------------------
>>     > ...
>>     >                                  var lonlat1=new
>>     > OpenLayers.LonLat(parseInt(radius),0);
>>     >                                  var lonlat2=new
>>     > OpenLayers.LonLat(parseInt(radius*2),0);
>>     >                                  var
>>     > pixel1=map.getLayerPxFromLonLat(lonlat1);
>>     >                                  var
>>     > pixel2=map.getLayerPxFromLonLat(lonlat2);
>>     >
>>     >
>>     >                                  var dist=
>>     > Math.abs(parseInt(pixel2.x)-parseInt(pixel1.x));
>>     >
>>     >
>>     >                                  createCircle(x,y,dist);
>>     >
>>     >
>>     
>> --------------------------------------------------------------------------------------------------------------
>>     > It works fine, but now the problem:
>>     > When zooming in or out the point feature won't resize -that
>>     means it does
>>     > not changes. the pixel size/radius is the same in every zoom level.
>>     > for solving this, i thought of creating a linearring and then a
>>     polygon, of
>>     > which i know that will automatically resize with zooming.
>>     > i tried:
>>     > var linearRing = new OpenLayers.Geometry.LinearRing(point);
>>     //just one point
>>     > var polygonFeature = new OpenLayers.Feature.Vector(
>>     >  new OpenLayers.Geometry.Polygon([linearRing]),null, style);
>>     > but seems not to work..
>>     >
>>     >
>>     > anybody can help?
>>     >
>>     > regards
>>     > m.sirin
>>     > _______________________________________________
>>     > Users mailing list
>>     > Users@openlayers.org <mailto:Users@openlayers.org>
>>     > http://openlayers.org/mailman/listinfo/users
>>     >
>>     >
>>
>>
>>
>>     --
>>     Ivan Grcic
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users@openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
> _______________________________________________
> Users mailing list
> Users@openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



-- 
Ivan Grcic
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to