Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.
This library is a port of both the Proj.4 and GCTCP C libraries to JavaScript. Enabling these transformations in the browser allows geographic data stored in different projections to be combined in browser-based web mapping applications.
Proj4js must have access to coordinate system initialization strings (which are the same as for PROJ.4 command line). Thes can be included in your application using a <script> tag or Proj4js can load CS initialization strings from a local directory or a web service such as spatialreference.org.
Similarly, Proj4js must have access to projection transform code. These can be included individually using a <script> tag in your page, built into a custom build of Proj4js or loaded dynamically at run-time. Using the -combined and -compressed versions of Proj4js includes all projection class code by default.
Note that dynamic loading of defs and code happens ascynchrously, check the Proj.readyToUse flag before using the Proj object. If the defs and code required by your application are loaded through script tags, dynamic loading is not required and the Proj object will be readyToUse on return from the constructor.
All coordinates are handled as points which have a .x and a .y property which will be modified in place.
Override Proj4js.reportError for output of alerts and warnings.
See http://trac.osgeo.org/proj4js/wiki/UserGuide for full details.
Summary
| Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations. |
| |
| The datum to use when no others a specified |
| |
| Transform a point coordinate from one map projection to another. |
| An internal method to report errors back to user. |
| The following properties and methods are intended for internal use only. |
| |
| Copy all properties of a source object to a destination object. |
| Base class used to construct all other classes. |
| Bind a function to an object. |
| AJAX service to retreive projection definition parameters from |
| internal: http server path to library code. |
| Return the path to this script. |
| Load a JS file from a URL into a <script> tag in the page. |
| IE workaround since there is no onerror handler. |
| Proj objects provide transformation methods for point coordinates between geodetic latitude/longitude and a projected coordinate system. |
| |
| Flag to indicate if initialization is complete for this Proj object |
| The title to describe the projection |
| The projection class for this projection, e.g. |
| The units of the projection. |
| The datum specified for the projection |
| |
| |
| |
| Constructor for Proj4js.Proj objects |
| Loads the coordinate system initialization string if required. |
| Creates the REST URL for loading the definition from a web service and loads it. |
| Continues the Proj object initilization once the def file is loaded |
| This is the loadCheck method to see if the def object exists |
| Report an error in loading the defs file, but continue on using WGS84 |
| Loads projection class code dynamically if required. |
| Loads any proj dependencies or continue on to final initialization. |
| Report an error in loading the proj file. |
| This is the loadCheck method to see if the projection code is loaded |
| Finalize the initialization of the Proj object |
| Parses the PROJ.4 initialization string and sets the associated properties. |
| Sets several derived constant values and initialization of datum and ellipse parameters. |
| |
| has been included for the ellipsoidal forward transform, but derivation of the ellispoidal inverse transform is beyond me. |