[josm-dev] WMTS scales - proper definition of 1m along meridian
Paul Hartmann
phaaurlt at gmail.com
Thu Jul 2 21:57:54 UTC 2015
On 02.07.2015 23:33, Wiktor Niesiobedzki wrote:
> I understand, that how much real meters you get per unit of latitude
> as well as per unit of longitude differs for different part of the
> ellipsoid/sphere. But that's not what WMTS specification ask. The
> crucial part of spec says:
>
> pixelSpan = scaleDenominator × 0.28e-03 / metersPerUnit(crs);
> tileSpanX = tileWidth × pixelSpan;
> tileSpanY = tileHeight × pixelSpan
> tileMatrixMaxX = tileMatrixMinX + tileSpanX × matrixWidth;
> tileMatrixMinY = tileMatrixMaxY - tileSpanY × matrixHeight;
>
> And uses following wording: "the coefficient to convert the coordinate
> reference system (CRS) units into meters (metersPerUnit)"
>
> And metersPerUnit(crs) function is something I do need for proper
> computations. As I said, if I use the constant, I get working WMTS
> layer for WGS84 (no matter at which longitude and latitude), as well
> as for Mercator and PUWG1992. This is also the way OpenLayers
> implement their support for WMTS.
Okay, I misunderstood your first email, sorry.
> But there are some EPGS projections, that use other units internally
> (foot for example; EPGS:26782 and EPGS:3739 to use the ones shown in
> OpenLayers testcases).
>
> The question is:
> 1. Should I implement this as a part of Projection (I think this is
> preferred way, though the name "metersPerUnit" is misleading, though
> even OGC uses such name, so I would keep this with disclaimer)
> 2. Should I implement this as a part of WMTS tile source internal
> conversions, but then I would need to create my own dictionary of
> projections and which units internally do they use.
I think it should go into the data/epsg file. The normal epsg file for
Proj4 contains this info, e.g.:
# ATS77 / UTM zone 19N
<2219> +proj=utm +zone=19 +a=6378135 +b=6356750.304921594 +units=m
+no_defs <>
(The "+units=m" part)
The format is explained here:
https://github.com/OSGeo/proj.4/wiki/GenParms
The ultimate reference is the EPSG database, e.g.:
<http://www.epsg-registry.org/report.htm?type=selection&entity=urn:ogc:def:crs:EPSG::3857&reportDetail=long&style=urn:uuid:report-style:default-with-code&style_name=OGP%20Default%20With%20Code&title=>
(It says: Coordinate Axes/Unit of Measure=metre)
Best, Paul
More information about the josm-dev
mailing list