[OpenLayers-Users] projection problem proj4js

Robert Sanson SansonR at asurequality.com
Mon Oct 5 20:18:33 EDT 2009


Hi Karsten
 
This code works for me:
 
var src = new OpenLayers.Projection('EPSG:4326');
var dest = new OpenLayers.Projection('EPSG:2193');
latitude = document.getElementById('lat').value;
longitude = document.getElementById('llong').value;
var markergeom = new OpenLayers.Geometry.Point(longitude,latitude);
//now in-place re-projection
OpenLayers.Projection.transform(markergeom, src, dest); 
gpsx = markergeom.x;
gpsy = markergeom.y;
alert(alert('coordinates transformed:'+gpsx.toString()+','+gpsy.toString());
regards,
 
Robert Sanson

>>> "karsten vennemann" <karsten at terragis.net> 6/10/2009 1:00 p.m. >>>
Thanks, now I do not get an error any more with this code:

var mapcenter = new OpenLayers.LonLat(-122.30785315739, 47.638080437239);
Proj4js.defs["EPSG:102003"] = "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
var source = new OpenLayers.Projection("EPSG:4326");   
var dest = new OpenLayers.Projection("EPSG:102003");                                          
OpenLayers.Projection.transform(mapcenter, source, dest);
alert('coordinates transformed:'+mapcenter.toString());

However the coordinates are the same as the input values (-122.30785315739, 47.638080437239) and not transformed. 
What is still wrong ?

Karsten 

_______________________________________________
Users mailing list
Users at openlayers.org 
http://openlayers.org/mailman/listinfo/users 

------------------------------------------------------------------
The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.
------------------------------------------------------------------


This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091006/fee5cc4b/attachment.html


More information about the Users mailing list