Changes between Version 4 and Version 5 of UserGuide
- Timestamp:
- Jul 10, 2008, 1:05:40 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UserGuide
v4 v5 28 28 }}} 29 29 30 '''Note:''' Proj4js currently depends on some core [http://openlayers.org/ OpenLayers] classes which are compiled into the file OLprotoype.js. If you are using Proj4js in a page that already includes the OpenLayers library, there is no need to include this file, otherwise you must also include OLprototype in a <script> tag. The development plan for Proj4js is to factor out this requirement so that theOpenLayers classes will only be required for dynamic lookup of the CRS definitions (see below).30 '''Note:''' Proj4js currently depends on some core [http://openlayers.org/ OpenLayers] classes which are compiled into the file OLprotoype.js. If you are using Proj4js in a page that already includes the !OpenLayers library, there is no need to include this file, otherwise you must also include OLprototype.js in a <script> tag. The development plan for Proj4js is to factor out this requirement so that the !OpenLayers classes will only be required for dynamic lookup of the CRS definitions (see below). 31 31 32 32 == Proj4js.Proj constructor == … … 40 40 }}} 41 41 42 Proj4js uses the same initialization parameters that [wiki:proj ] uses and these values must be defined before the constructor is called.42 Proj4js uses the same initialization parameters that [wiki:proj PROJ.4] uses and these values must be defined before the constructor is called. 43 43 44 44 == If you know the projections to be used in your application == … … 56 56 To use Proj4js in this way, you will need to: 57 57 1. include the OLprotoype.js file in a script tag (only if your page doesn't already include OpenLayers) 58 1. define a proxy script to allow cross domain HTTP requests 59 1. define the value for the /lib path 58 1. define a proxy script to allow cross domain HTTP requests {{{Proj4js.proxyScript = '/mapbuilder/proxy?url=';}}} 60 59 61 The way dynamic definition string lookup works is to first check for the definition at the path lib/defs. If the appropriate file is found there, it will be loaded and used by Proj4js. If it is not found there ('''note:''' in this case it is normal to see an error in the Firebug console), an HTTP request will be issued to spatialreference.org 60 The way dynamic definition string lookup works is to first check for the definition at the path lib/defs. If the appropriate file is found there, it will be loaded and used by Proj4js. If it is not found there ('''note:''' in this case it is normal to see an error in the Firebug console), an HTTP request will be issued to spatialreference.org. If the definition for the CRS code is not found there, you're out of luck! 61 62 == Logging and Errors == 63 64 Proj4js includes two methods for reporting errors and log info which by default are empty stub functions which do nothing. To see error reports and logs, you must provide an override for these methods, for example: 65 66 {{{ 67 //somewhere in your JS code 68 Proj4js.log = function(msg) {console.log(msg);} 69 Proj4js.reportError = function(msg) {alert(msg);} 70 }}}