Changes between Version 4 and Version 5 of UserGuide


Ignore:
Timestamp:
Jul 10, 2008, 1:05:40 PM (16 years ago)
Author:
madair
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuide

    v4 v5  
    2828}}}
    2929
    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 the OpenLayers 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).
    3131
    3232== Proj4js.Proj constructor ==
     
    4040}}}
    4141
    42 Proj4js uses the same initialization parameters that [wiki:proj] uses and these values must be defined before the constructor is called.
     42Proj4js uses the same initialization parameters that [wiki:proj PROJ.4] uses and these values must be defined before the constructor is called.
    4343
    4444== If you know the projections to be used in your application ==
     
    5656To use Proj4js in this way, you will need to:
    5757 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=';}}}
    6059
    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
     60The 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
     64Proj4js 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
     68Proj4js.log = function(msg) {console.log(msg);}
     69Proj4js.reportError = function(msg) {alert(msg);}
     70}}}