[OpenLayers-Users] Marker and projection

Roald de Wit roald.dewit at lisasoft.com
Wed Nov 4 16:27:05 EST 2009


Daniel,

It is better to use Layer.Vector instead. You can style vector layers to 
have icons too. If you manually add points to a Vector layer, you'd 
still need to reproject yourself (IIRC).

Regards, Roald

Daniel Degasperi wrote:
> Hi,
> is there any plan to integrate the reprojection in "Marker"?
> In this moment I've to transform my point ("EPSG:4326") manually to 
> "EPSG:900913",
> create a LatLon-Object and pass it trough the constructor of the "Marker".
>
> Example:
>     proj4326 = new OpenLayers.Projection("EPSG:4326");
>     proj900913 = new OpenLayers.Projection("EPSG:900913");
>     pt = new OpenLayers.Geometry.Point(11.3307484,46.4825565);
>     pt = OpenLayers.Projection.transform(pt, proj4326, proj900913);
>     var ll = new OpenLayers.LonLat(pt.x,pt.y);
>    
>     // marker info
>     var icon = new 
> OpenLayers.Icon('http://openlayers.org/dev/img/marker-gold.png', size);
>     var data = {'icon': icon};
>     var feature = new OpenLayers.Feature(layer_marker, ll, data);
>
> Best regards
> Daniel
>
>   




More information about the Users mailing list