Changeset 9642 in josm


Ignore:
Timestamp:
2016-01-26T23:02:47+01:00 (4 years ago)
Author:
wiktorn
Message:

Correct METER_PER_UNIT_DEGREE to match values in OpenLayers and QGIS.

After some investigation in the code, it looks like both OpenLayers and QGIS use
this value for calculations how many meters fit within one degree. This is also
in line with WMTS specificationi (thanks: bastiK).

Warning: this will break (probably broken) Geoportal 2 in Poland WMTS service
(and alike), when using EPSG:4326 projection. The problem is already reported to
Geoportal administrator in Poland.

See: #12186

File:
1 edited

Legend:

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

    r9631 r9642  
    4242
    4343    /*
    44      * Equation taken from:
    45      * https://github.com/openlayers/ol3/blob/master/src/ol/proj/proj.js#L48-#L49
     44     * Equation for METER_PER_UNIT_DEGREE taken from:
     45     * https://github.com/openlayers/ol3/blob/master/src/ol/proj/epsg4326projection.js#L58
    4646     * Value for Radius taken form:
    47      * https://github.com/openlayers/ol3/blob/master/src/ol/sphere/normal.js#L11
    48      */
    49     private static final double METER_PER_UNIT_DEGREE = 2 * Math.PI * 6370997 / 360;
     47     * https://github.com/openlayers/ol3/blob/master/src/ol/sphere/wgs84sphere.js#L11
     48     */
     49    private static final double METER_PER_UNIT_DEGREE = 2 * Math.PI * 6378137.0 / 360;
    5050    private static final Map<String, Double> UNITS_TO_METERS = getUnitsToMeters();
    5151    private static final Map<String, Double> PRIME_MERIDANS = getPrimeMeridians();
Note: See TracChangeset for help on using the changeset viewer.