In case anyone else out there has been having trouble getting the proj4js lib to do a coordinate transform, I have recently gone through it with success. I was goofing up a small part that caused much problems.
I did one thing to solve my issue, 1) make sure that I included the merc.js projCode in my header: <script src="/html/scripts/proj4js/lib/projCode/merc.js"></script> So, the following is a page that will convert a latlon coord to google (based on an original posting from this listserv): <html> <head> <script src="/html/devlib/OpenLayers-2.7/lib/OpenLayers.js"></script> <script src="/html/scripts/proj4js/lib/proj4js.js"></script> <script src="/html/scripts/proj4js/lib/projCode/merc.js"></script> </head> <body> <div id="map"></div> <script type='text/javascript'> <!-- \n"; Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"; Proj4js.defs["EPSG:900913"] = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m [EMAIL PROTECTED] +no_defs"; var proj4326 = new OpenLayers.Projection("EPSG:4326"); var projGoogle = new OpenLayers.Projection("EPSG:900913"); var lon = -77.1266708374023; var lat = 37.6813888549805; var point = new OpenLayers.Geometry.Point(lon, lat); OpenLayers.Projection.transform(point, proj4326, projGoogle); alert(lon + " " + lat + " = " + point.x +" "+ point.y); // --> </script> </body> </html> Robert W. Burgholzer Surface Water Modeler Office of Water Supply and Planning Virginia Department of Environmental Quality [EMAIL PROTECTED] 804-698-4405 Open Source Modeling Tools: http://sourceforge.net/projects/npsource/
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users