Altair wrote:
> hi list.
> I have feature on the vector layer, how to get feature position in browser
> coordinates(x,y) in pixel ?
>   

var geom = feature.geometry;
var vertices = geom.getVertices();
var v, ll;
for(var i=0; i<vertices.length; i++) {
    v = vertices[i];
    ll = OpenLayers.LonLat.fromString(v.toShortString());
    alert("Screen Coord: " + map.getPixelFromLonLat(ll));
}

This will give you the pixel coordinates relative to the map viewport.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to