Changeset 3922 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2011-02-21T11:22:45+01:00 (13 years ago)
Author:
stoecker
Message:

correct mercator projection scaling factor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/Mercator.java

    r3205 r3922  
    2222public class Mercator implements Projection {
    2323
     24    final double radius = 6378137.0;
     25
    2426    public EastNorth latlon2eastNorth(LatLon p) {
    2527        return new EastNorth(
    26                 p.lon()*Math.PI/180,
    27                 Math.log(Math.tan(Math.PI/4+p.lat()*Math.PI/360)));
     28                p.lon()*Math.PI/180*radius,
     29                Math.log(Math.tan(Math.PI/4+p.lat()*Math.PI/360))*radius);
    2830    }
    2931
    3032    public LatLon eastNorth2latlon(EastNorth p) {
    3133        return new LatLon(
    32                 Math.atan(Math.sinh(p.north()))*180/Math.PI,
    33                 p.east()*180/Math.PI);
     34                Math.atan(Math.sinh(p.north()/radius))*180/Math.PI,
     35                p.east()/radius*180/Math.PI);
    3436    }
    3537
     
    6062    public double getDefaultZoomInPPD() {
    6163        // This will set the scale bar to about 100 km
    62         return 0.000158;
     64        return 1000.0;/*0.000158*/
    6365    }
    6466}
Note: See TracChangeset for help on using the changeset viewer.