[OpenLayers-Users] Can't get Proj4js.js to Work

Bill Thoen bthoen at gisnet.com
Mon Sep 8 15:57:21 EDT 2008


I'm trying to get transform() to convert coordinates from WGS84 to UTM 
Zone 14. I've included Proj4js.js in this little example, but I can't 
get it to work. Can anyone tell me what's wrong?

<html>
    <head>
        <title>Projection Test</title>
        <link rel="stylesheet" href="/ol/theme/default/style.css" 
type="text/css" />
        <script 
src="http://openlayers.org/api/2.7-rc1/OpenLayers.js"></script>
        <script src="/ol/Proj4js.js" type="text/javascript"></script>
        <script type="text/javascript">
        function init() {
            var p = new OpenLayers.Geometry.Point (-105, 40);
            var data = p.toString() + "<br />"
            p = p.transform (
                new OpenLayers.Projection("EPSG:4326"),
                new OpenLayers.Projection("EPSG:32614")
            );
            data += p.toString()+ "<br />"
            OpenLayers.Util.getElement("x").innerHTML=data;
        }
        </script>
    </head>
    <body onload=init()>
    <h1>Projection Test</h1>
    <div id='x'></div>
    </body>
</html>





More information about the Users mailing list