Changes between Version 1 and Version 2 of UserGuide


Ignore:
Timestamp:
Jun 4, 2008, 8:09:58 PM (16 years ago)
Author:
madair
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuide

    v1 v2  
    33Using Proj4js is a matter of including the library in your page, creating source and destination Proj objects, transforming point coordinates. 
    44
    5 
    65{{{
    76
    8 <script src="lib/proj4js-combined.js"></script>
     7<script src="lib/proj4js-combined.js"></script>  //adjust the path for your server
    98
    109
    11 var source = new Proj4js.Proj(‘EPSG:4236’);
    12 var dest = new Proj4js.Proj(‘EPSG:42304’);
    13 var p = new Proj4js.Point(-76.0,45.0);
    14 Proj4js.transform(source, dest, p);
     10//somewhere in your JavaScript code where you need this
     11
     12var source = new Proj4js.Proj(‘EPSG:4236’);    //source coordinates will be in Longitude/Latitude
     13var dest = new Proj4js.Proj(‘EPSG:27563’);     //destination coordinates in LCC, south of France
     14
     15var p = new Proj4js.Point(-76.0,45.0);   //any object will do as long as it has 'x' and 'y' properties
     16Proj4js.transform(source, dest, p);      //do the transformation.  x and y are modified in place
     17
     18//p.x and p.y are now EPSG:27563 easting and northing in meters
    1519
    1620
    1721}}}
    1822
    19 p.x and p.y are now EPSG:42304 easting and northing in meters
     23== Proj4js.Proj constructor ==
     24
     25Every Proj object must be initialized with the parameters of the CRS to be used.  Proj4js uses the same initialization parameters that PROJ4 uses [link].
     26
     27The argument to the constructor is a key in the Proj4js.defs initialization parameters object.
    2028
    2129
    22 Every Proj object must be initialized with the parameters of the CRS to be used.
     30{{{
     31Proj4js.defs["EPSG:27563"]="+title=LAMB sud france  +proj=lcc +lat_1=44.1 +lat_0=44.1 +lon_0=0 +k_0=0.999877499 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m";
     32}}}
     33
    2334
    2435== If you know the projections to be used in your application ==
    2536
    26 <script src="lib/defs/EPSG42304.js"></script >
     37The Proj4js.defs value must be defined before the constructor is called.  You can define these via the script tag (see examples in the lib/defs directory) or anywhere else in your application.
    2738
    2839
     40{{{
     41<script src="lib/defs/EPSG27563.js"></script >
     42}}}
     43
    2944== Using dynamic lookup of initialization parameters ==
     45
     46set libPath
     47set proxy
     48spatialreference.org