Index: /trunk/nodist/data/projection/josm-epsg
===================================================================
--- /trunk/nodist/data/projection/josm-epsg	(revision 17548)
+++ /trunk/nodist/data/projection/josm-epsg	(revision 17549)
@@ -75,4 +75,6 @@
 # Lambert Zone (Estonia)
 <3301> +proj=lcc +lat_0=57.51755393055556 +lat_1=59.333333333333336 +lat_2=58 +lon_0=24 +x_0=500000 +y_0=6375000 +ellps=GRS80 +nadgrids=null +units=m +axis=neu +bounds=21.64,56.05,28.58,61.13  <>
+# LKS94 / Lithuania TM
+<3346> +proj=tmerc +lat_0=0 +lon_0=24 +k=0.9998 +x_0=500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +axis=neu +bounds=19.03,53.89,26.84,56.46 +no_defs <>
 # Belgian Lambert 2008
 <3812> +proj=lcc +lat_0=50d47'52.134" +lat_1=49d50'0" +lat_2=51d10'0" +lon_0=4d21'33.177" +x_0=649328 +y_0=665262 +ellps=GRS80 +nadgrids=null +units=m +bounds=2.54,49.51,6.4,51.5  <>
Index: /trunk/test/data/wmts/WMTSCapabilities-Lithuania.xml
===================================================================
--- /trunk/test/data/wmts/WMTSCapabilities-Lithuania.xml	(revision 17549)
+++ /trunk/test/data/wmts/WMTSCapabilities-Lithuania.xml	(revision 17549)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
+    <Contents>
+        <Layer>
+            <ows:Title>NZT_ORT2LT_2018</ows:Title>
+            <ows:Identifier>NZT_ORT2LT_2018</ows:Identifier>
+            <ows:BoundingBox crs="urn:ogc:def:crs:EPSG::3346">
+                <ows:LowerCorner>6022999.8655913975 316000.06350012776</ows:LowerCorner>
+                <ows:UpperCorner>6211000.061383456 605999.984124969</ows:UpperCorner>
+            </ows:BoundingBox>
+            <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
+                <ows:LowerCorner>21.05003442434057 54.31083718956931</ows:LowerCorner>
+                <ows:UpperCorner>25.70028436683549 56.0330467679823</ows:UpperCorner>
+            </ows:WGS84BoundingBox>
+            <Style isDefault="true">
+                <ows:Title>Default Style</ows:Title>
+                <ows:Identifier>default</ows:Identifier>
+            </Style>
+            <Format>image/png</Format>
+            <TileMatrixSetLink>
+                <TileMatrixSet>default028mm</TileMatrixSet>
+            </TileMatrixSetLink>
+            <ResourceURL format="image/png" resourceType="tile" template="https://this_is_test/tile/{TileMatrix}/{TileRow}/{TileCol}"/>
+        </Layer>
+        <TileMatrixSet>
+            <ows:Title>TileMatrix using 0.28mm</ows:Title>
+            <ows:Abstract>The tile matrix set that has scale values calculated based on the dpi defined by OGC specification (dpi assumes 0.28mm as the physical distance of a pixel).</ows:Abstract>
+            <ows:Identifier>default028mm</ows:Identifier>
+            <ows:SupportedCRS>urn:ogc:def:crs:EPSG::3346</ows:SupportedCRS>
+            <TileMatrix>
+                <ows:Identifier>0</ows:Identifier>
+                <ScaleDenominator>2834827.0982252685</ScaleDenominator>
+                <TopLeftCorner>1.00001E7 -5122000.0</TopLeftCorner>
+                <TileWidth>256</TileWidth>
+                <TileHeight>256</TileHeight>
+                <MatrixWidth>29</MatrixWidth>
+                <MatrixHeight>20</MatrixHeight>
+            </TileMatrix>
+            <TileMatrix>
+                <ows:Identifier>1</ows:Identifier>
+                <ScaleDenominator>1889884.7321501793</ScaleDenominator>
+                <TopLeftCorner>1.00001E7 -5122000.0</TopLeftCorner>
+                <TileWidth>256</TileWidth>
+                <TileHeight>256</TileHeight>
+                <MatrixWidth>43</MatrixWidth>
+                <MatrixHeight>30</MatrixHeight>
+            </TileMatrix>
+            <TileMatrix>
+                <ows:Identifier>2</ows:Identifier>
+                <ScaleDenominator>944942.3660750897</ScaleDenominator>
+                <TopLeftCorner>1.00001E7 -5122000.0</TopLeftCorner>
+                <TileWidth>256</TileWidth>
+                <TileHeight>256</TileHeight>
+                <MatrixWidth>85</MatrixWidth>
+                <MatrixHeight>59</MatrixHeight>
+            </TileMatrix>
+        </TileMatrixSet>
+    </Contents>
+    <ServiceMetadataURL xlink:href="http://www.geoportal.lt/arcgis/rest/services/NZT/ORT2LT_2018/MapServer/WMTS/1.0.0/WMTSCapabilities.xml"/>
+</Capabilities>
Index: /trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java	(revision 17548)
+++ /trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java	(revision 17549)
@@ -62,4 +62,5 @@
     private final ImageryInfo testImageryGeoAdminCh = getImagery(TestUtils.getTestDataRoot() + "wmts/WMTSCapabilities-GeoAdminCh.xml");
     private final ImageryInfo testImagery12168 = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12168-WMTSCapabilities.xml");
+    private final ImageryInfo testImageryORT2LT = getImagery(TestUtils.getTestDataRoot() + "wmts/WMTSCapabilities-Lithuania.xml");
     private final ImageryInfo testLotsOfLayers = getImagery(TestUtils.getTestDataRoot() + "wmts/getCapabilities-lots-of-layers.xml");
     private final ImageryInfo testDuplicateTags = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12573-wmts-identifier.xml");
@@ -249,4 +250,18 @@
                 "http://www.ngi.be/cartoweb/1.0.0/topo/default/3857/7/1/1.png",
                 testSource.getTileUrl(0, 1, 1));
+    }
+
+    @Test
+    public void testProjectionWithENUAxis() throws IOException, WMTSGetCapabilitiesException {
+        ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3346"));
+        WMTSTileSource testSource = new WMTSTileSource(testImageryORT2LT);
+        testSource.initProjection(ProjectionRegistry.getProjection());
+        TileXY tileXY0 = testSource.latLonToTileXY(55.31083718860799, 22.172052608196587, 0);
+        double delta = 1e-10;
+        assertEquals(27.09619727782481, tileXY0.getX(), delta);
+        assertEquals(19.03524443532604, tileXY0.getY(), delta);
+        TileXY tileXY2 = testSource.latLonToTileXY(55.31083718860799, 22.172052608196587, 2);
+        assertEquals(81.28859183347444, tileXY2.getX(), delta);
+        assertEquals(57.10573330597811, tileXY2.getY(), delta);
     }
 
