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                    MILLER CYLINDRICAL
11
 
12
  PURPOSE:	Transforms input longitude and latitude to Easting and
13
  Northing for the Miller Cylindrical projection.  The
14
  longitude and latitude must be in radians.  The Easting
15
  and Northing values will be returned in meters.
16
 
17
  PROGRAMMER              DATE
18
  ----------              ----
19
  T. Mittan		March, 1993
20
 
21
  This function was adapted from the Lambert Azimuthal Equal Area projection
22
  code (FORTRAN) in the General Cartographic Transformation Package software
23
  which is available from the U.S. Geological Survey National Mapping Division.
24
 
25
  ALGORITHM REFERENCES
26
 
27
  1.  "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
28
  The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
29
 
30
  2.  Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
31
  Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
32
  State Government Printing Office, Washington D.C., 1987.
33
 
34
  3.  "Software Documentation for GCTP General Cartographic Transformation
35
  Package", U.S. Geological Survey National Mapping Division, May 1982.
36
 * ***************************************************************************** */
37
 
38
class Proj4phpProjMill {
39
    /* Initialize the Miller Cylindrical projection
40
      ------------------------------------------- */
41
 
42
    public function init() {
43
        //no-op
44
    }
45
 
46
    /* Miller Cylindrical forward equations--mapping lat,long to x,y
47
      ------------------------------------------------------------ */
48
    public function forward( $p ) {
49
 
50
        $lon = $p->x;
51
        $lat = $p->y;
52
 
53
        /* Forward equations
54
          ----------------- */
55
        $dlon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
56
        $x = $this->x0 + $this->a * $dlon;
57
        $y = $this->y0 + $this->a * log( tan( (Proj4php::$common->PI / 4.0) + ($lat / 2.5) ) ) * 1.25;
58
 
59
        $p->x = $x;
60
        $p->y = $y;
61
 
62
        return $p;
63
    }
64
 
65
    /* Miller Cylindrical inverse equations--mapping x,y to lat/long
66
      ------------------------------------------------------------ */
67
    public function inverse( $p ) {
68
 
69
        $p->x -= $this->x0;
70
        $p->y -= $this->y0;
71
 
72
        $lon = Proj4php::$common->adjust_lon( $this->long0 + $p->x / $this->a );
73
        $lat = 2.5 * (atan( exp( 0.8 * $p->y / $this->a ) ) - Proj4php::$common->PI / 4.0);
74
 
75
        $p->x = $lon;
76
        $p->y = $lat;
77
 
78
        return $p;
79
    }
80
}
81
 
82
Proj4php::$proj['mill'] = new Proj4phpProjMill();