[josm-dev] WMTS scales - proper definition of 1m along meridian

Wiktor Niesiobedzki osm at vink.pl
Thu Jul 2 19:47:25 UTC 2015


Hi,

Currently I'm working on WMTS support. As some of you may know (and
those who do not, I refer to
http://www.opengeospatial.org/standards/wmts) uses notion of
scaleDenominator that's crucial to tile positioning. More less -
scaleDenominator tell how many meters are on the tile per pixel.

I tried several of algorithms to get the number of meters along
meridian for current JOSM projection, the best I could find is:

            Projection proj = Main.getProjection();
            EastNorth p1 = new EastNorth(0, 0);
            EastNorth p2 = new EastNorth(0, 1);
            double metersPerDegree =
proj.eastNorth2latlon(p1).greatCircleDistance(p2);

But still this doesn't give satisfactory results. From my manual
trials, I guessed following "correct" values, depending on the
projection used:
EPSG:3857 (Mercator) - 1
EPSG:2180 (PUWG1992) - 1
EPSG:4326 (WGS84) - 111194.87428468118 (this one - got from OpenLayers
unit test source code)

But I got:
EPSG:3857 (Mercator) - 0.9988243474118915
EPSG:2180 (PUWG1992) - 0.9988243474118915
EPSG:4326 (WGS84) - 111319.4558866885

Looking through the OpenLayers code I see, that they define 4 values
got getMetersPerUnit():
- degrees (111194.87428468118)
- feet (0.3048)
- meters (1)
- us feet (.3048006096)

Do I understand correctly, that for base projections:
- org.openstreetmap.josm.data.projection.proj.LonLat - I should use degrees
- org.openstreetmap.josm.data.projection.proj.Mercator - I should use meters
- org.openstreetmap.josm.data.projection.proj.TransverseMercator - I
should use meters

But I'm not sure about:
org.openstreetmap.josm.data.projection.proj.LambertConformalConic
org.openstreetmap.josm.data.projection.proj.SwissObliqueMercator

Which unit I should use there?

I plan to extend Projection interface to include getMetersPerUnit
method and implement necessary constants in
org.openstreetmap.josm.data.projection.proj.* classes.

Does anybody has any objections with such approach?

Cheers,

Wiktor



More information about the josm-dev mailing list