On Monday, July 13, 2009, winfield.dave <[email protected]> wrote: > > Hi all, > > Essentially, I'm having a problem converting some lat/long values I get back > from a webservice onto my map. The map is using EPSG:3395, so I thought code > like this would work. > > <!-- at the top --> > var latLonProj = new OpenLayers.Projection("EPSG:4236"); > var osmProj = new OpenLayers.Projection("EPSG:3395"); > > <!-- code that matters --> > var markers = new OpenLayers.Layer.Markers( "Markers" ); > map.addLayer(markers); > > var ll = new OpenLayers.LonLat(51.644715, -0.0327); > ll.transform(latLonProj, osmProj); > > <!-- code for the icon and adding to the map --> > var size = new OpenLayers.Size(10,17); > var offset = new OpenLayers.Pixel(-(size.w/2), -size.h); > var icon = new > OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,offset); > markers.addMarker(new OpenLayers.Marker(ll,icon)); > > I can do an alert on the ll.lon and ll.lat values AFTER the transform and > they're the same as what I passed into the constructor. > > I thought maybe I had the lon/lat values reversed, so I changed the order of > the parameters in the LonLat constructor, but it did not help. I was also > under the impression that EPSG:4236 was the geographic coordinates, but I > could be wrong. > > Any thoughts?
Hi. Do you have proj4js loaded? And is the EPSG:3395 projection defined in proj4js? Cheers, > -- > View this message in context: > http://n2.nabble.com/Can%27t-transform-lat-long-to-a-projection-tp3250372p3250372.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : [email protected] http://www.camptocamp.com _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
