[OpenLayers-Users] Vector feature projection

Fernando fnorte at gmail.com
Thu Dec 22 05:43:01 EST 2011


Leigh,

Maybe the problem is in this line:
var sphermerc = new OpenLayers.Projection("900913"**);

Is missing the "EPSG:" before the 900913

Fernando G. Norte
BHte - MG
cel: +55 31 9119 8814
-------------------------
MSN e Gtalk # fnorte at gmail.com


2011/12/22 Leigh Holcombe <lholcombe at triple-bypass.net>

> Hello,
> I'm trying to add some WGS84 points to a spherical mercator map.  After
> studying examples and reading some documentation, I've been led to believe
> that the following code should work.  And yet, it does not.
>
>    var wgs84 = new OpenLayers.Projection("EPSG:**4326");
>    var sphermerc = new OpenLayers.Projection("900913"**);
> // vector points overlay
>    var pointslayer = new OpenLayers.Layer.Vector("**Points Layer", {
>        styleMap: stylepoint,
>        displayInLayerSwitcher: false
>    });
> // define the points
>    var start = new OpenLayers.Geometry.Point(-**157, 21);
>    start.transform(wgs84, sphermerc);
>    var startfeature = new OpenLayers.Feature.Vector(**start);
>    pointslayer.addFeatures([**startfeature]);
>
> map.addLayer(pointslayer);
>
> This isn't all of the code, but I'm pretty sure it's the only part that
> isn't working.  I think the reason I can't figure this out is that I don't
> quite understand how transforming "in place" works.  Which version of
> 'start' is being passed to OpenLayers.Feature.Vector: the original, or the
> transformed?
>
> Code ideas and/or explanatory speeches (of any length) would be greatly
> appreciated.
>
> Thank you,
> Leigh Holcombe
>
>
> ______________________________**_________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111222/6ab5fdc7/attachment.html


More information about the Users mailing list