[OpenLayers-Users] Circles
Heidt, Christopher M.
CHRISTOPHER.M.HEIDT at saic.com
Mon Dec 8 13:45:55 EST 2008
this is definitly a clever aproach, but it is still a work-around for what i consider to be a basic shape.
I just wonder why i cant have something along the lines of: new Openlayers.Geometry.Circle(lon,lat,radius);
________________________________
From: Estanislao Gonzalez [mailto:estanislao.gonzalez at isst.fraunhofer.de]
Sent: Mon 12/8/2008 11:47 AM
To: Heidt, Christopher M.
Subject: Re: [OpenLayers-Users] Circles
That's not true. You can always recalculate the circle radius when
changing the zoom. That's what I did and had no problem at all.
//radius unit is in kilometers
var DOTS_PER_UNIT = OpenLayers.INCHES_PER_UNIT.km *
OpenLayers.DOTS_PER_INCH;
// 5 km radius
var circleRadius = 5;
"default": new OpenLayers.Style({
pointRadius: "${radius}"
}, {
context: {
radius: function(feature){
//very rough. Be sure it is at least somehow correct.
var rad = circleRadius * DOTS_PER_UNIT /
feature.layer.map.getScale();
return rad;
}
}
});
Still I didn't check if the measurement is right, but it is constant. So
you might have to multiply it by a constant if required (probably by
adapting DOTS_PER_UNIT).
Note that I'm reading the radius from a feature in a WFS layer, so you
might have to change that as well (feature.attributes.radius)
Hope it helps,
Regards,
Estani
Heidt, Christopher M. schrieb:
> right, changing a points radius in the style makes the marker that represents a point larger, but it isnt a "Circle" Feature because it remains the same size when u zoom in and out.
>
> oracle has a WKT outputer that makes a CURVEPOLYGON(# #,# #,# #,# #) or some such nonsence to represent circles. the problem is that it isnt part of the WKT spec so nothing supports it.
>
> I'd change it to a format that is supported,
> but i can't find anything in any format that can represent a circle.
> Anybody know if it would be a daunting task to add CURVEPOLYGON support to the WKT parser?
>
> ________________________________
> From: users-bounces at openlayers.org on behalf of Lehtonen, Mika
> Sent: Tue 12/2/2008 2:23 PM
> To: Didrik Pinte
> Cc: users at openlayers.org
> Subject: Re: [OpenLayers-Users] Circles
>
>
> Hi Didrik,
>
> I guess the points are still points regardless of their style? So you
> can't use their geometry as a replacement of a circle?
>
> - mika -
>
> Didrik Pinte kirjoitti:
>
>> On Tue, 2008-12-02 at 08:27 -0500, Heidt, Christopher M. wrote:
>>
>>
>>> Probably a dumb question, but how can I create a circle feature using
>>> the api?
>>>
>>> I'm hoping you're not going to say I have to generate a bunch of
>>> points an make a polygon :(
>>>
>>>
>> Using a point with a style using a radius will do it fine.
>>
>> For example :
>> http://openlayers.org/dev/examples/stylemap.html
>>
>> Didrik
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
Dipl.-Kfm. Estanislao Gonzalez, Fraunhofer-Institut für Software- und Systemtechnik ISST
Location-based Services, Steinplatz 2, 10623 Berlin, Germany
Telefon: +49 (0) 30 / 2 43 06-3 36
mailto:estanislao.gonzalez at isst.fraunhofer.de
www.isst.fraunhofer.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081208/5584305a/attachment.html
More information about the Users
mailing list