Subversion Repositories eFlore/Projets.eflore-projets

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1001 delphine 1
<?php
2
/**
3
 * Author : Julien Moquet
4
 *
5
 * Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
6
 *                      and Richard Greenwood rich@greenwoodma$p->com
7
 * License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
8
 */
9
/*******************************************************************************
10
  NAME                            TRANSVERSE MERCATOR
11
 
12
  PURPOSE:	Transforms input longitude and latitude to Easting and
13
  Northing for the Transverse Mercator projection.  The
14
  longitude and latitude must be in radians.  The Easting
15
  and Northing values will be returned in meters.
16
 
17
  ALGORITHM REFERENCES
18
 
19
  1.  Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
20
  Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
21
  State Government Printing Office, Washington D.C., 1987.
22
 
23
  2.  Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
24
  U.S. Geological Survey Professional Paper 1453 , United State Government
25
  Printing Office, Washington D.C., 1989.
26
*******************************************************************************/
27
 
28
/**
29
  Initialize Transverse Mercator projection
30
 */
31
class Proj4phpProjUtm {
32
 
33
    public $dependsOn = 'tmerc';
34
 
35
    public $utmSouth = false; // UTM north/south
36
 
37
    /**
38
     *
39
     * @return void
40
     */
41
    public function init() {
42
 
43
        if( !isset($this->zone) ) {
44
            Proj4php::reportError( "utm:init: zone must be specified for UTM" );
45
            return;
46
        }
47
 
48
        $this->lat0 = 0.0;
49
        $this->long0 = ((6 * abs( $this->zone )) - 183) * Proj4php::$common->D2R;
50
        $this->x0 = 500000.0;
51
        $this->y0 = $this->utmSouth ? 10000000.0 : 0.0;
52
        $this->k0 = 0.9996;
53
    }
54
 
55
    /**
56
     *
57
     * @param type $p
58
     * @return type
59
     */
60
    public function forward( $p ) {
61
        return Proj4php::$proj['tmerc']->forward( $p );
62
    }
63
 
64
    /**
65
     *
66
     * @param type $p
67
     * @return type
68
     */
69
    public function inverse( $p ) {
70
        return Proj4php::$proj['tmerc']->inverse( $p );
71
    }
72
}
73
 
74
Proj4php::$proj['utm'] = new Proj4phpProjUtm();