Changeset 8584 in josm
- Timestamp:
- 2015-07-08T20:59:09+02:00 (9 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/projection/epsg
r8568 r8584 22 22 <2154> +proj=lcc +lat_0=46.5 +lat_1=44 +lat_2=49 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +nadgrids=null +units=m +bounds=-5.5,41,10.2,51 <> 23 23 # PUWG 2000 Zone 5 (Poland) 24 <2176> +proj=tmerc +lon_0=15 +k_0=0.999923 +x_0=5500000 +ellps=GRS80 +nadgrids=null +units=m + bounds=13.5,49,16.5,54.84 <>24 <2176> +proj=tmerc +lon_0=15 +k_0=0.999923 +x_0=5500000 +ellps=GRS80 +nadgrids=null +units=m +axis=neu +bounds=13.5,49,16.5,54.84 <> 25 25 # PUWG 2000 Zone 6 (Poland) 26 <2177> +proj=tmerc +lon_0=18 +k_0=0.999923 +x_0=6500000 +ellps=GRS80 +nadgrids=null +units=m + bounds=16.5,49,19.5,54.84 <>26 <2177> +proj=tmerc +lon_0=18 +k_0=0.999923 +x_0=6500000 +ellps=GRS80 +nadgrids=null +units=m +axis=neu +bounds=16.5,49,19.5,54.84 <> 27 27 # PUWG 2000 Zone 7 (Poland) 28 <2178> +proj=tmerc +lon_0=21 +k_0=0.999923 +x_0=7500000 +ellps=GRS80 +nadgrids=null +units=m + bounds=19.5,49,22.5,54.84 <>28 <2178> +proj=tmerc +lon_0=21 +k_0=0.999923 +x_0=7500000 +ellps=GRS80 +nadgrids=null +units=m +axis=neu +bounds=19.5,49,22.5,54.84 <> 29 29 # PUWG 2000 Zone 8 (Poland) 30 <2179> +proj=tmerc +lon_0=24 +k_0=0.999923 +x_0=8500000 +ellps=GRS80 +nadgrids=null +units=m + bounds=22.5,49,25.5,54.84 <>30 <2179> +proj=tmerc +lon_0=24 +k_0=0.999923 +x_0=8500000 +ellps=GRS80 +nadgrids=null +units=m +axis=neu +bounds=22.5,49,25.5,54.84 <> 31 31 # PUWG 1992 (Poland) 32 <2180> +proj=tmerc +lon_0=19 +k_0=0.9993 +x_0=500000 +y_0=-5300000 +ellps=GRS80 +nadgrids=null +units=m + bounds=14.12,49,24.15,54.84 <>32 <2180> +proj=tmerc +lon_0=19 +k_0=0.9993 +x_0=500000 +y_0=-5300000 +ellps=GRS80 +nadgrids=null +units=m +axis=neu +bounds=14.12,49,24.15,54.84 <> 33 33 # UTM France (DOM) Fort Marigot 34 34 <2969> +proj=tmerc +lon_0=-63 +k_0=0.9996 +x_0=500000 +ellps=intl +towgs84=136.596,248.148,-429.789 +units=m +bounds=-63.25,17.6,-62.5,18.5 <> … … 46 46 <3004> +proj=tmerc +lat_0=0 +lon_0=15 +k=0.9996 +x_0=2520000 +y_0=0 +ellps=intl +units=m +bounds=11,34,24,48 <> 47 47 # SWEREF99 13 30 / EPSG:3008 (Sweden) 48 <3008> +proj=tmerc +lon_0=13.5 +x_0=150000 +ellps=GRS80 +nadgrids=null +units=m + bounds=12.1,55.2,14.65,62.26 <>48 <3008> +proj=tmerc +lon_0=13.5 +x_0=150000 +ellps=GRS80 +nadgrids=null +units=m +axis=neu +bounds=12.1,55.2,14.65,62.26 <> 49 49 # LKS-92 (Latvia TM) 50 <3059> +proj=tmerc +lon_0=24 +k_0=0.9996 +x_0=500000 +y_0=-6000000 +ellps=GRS80 +nadgrids=null +units=m + bounds=-180,-90,180,90 <>50 <3059> +proj=tmerc +lon_0=24 +k_0=0.9996 +x_0=500000 +y_0=-6000000 +ellps=GRS80 +nadgrids=null +units=m +axis=neu +bounds=-180,-90,180,90 <> 51 51 # Lambert Zone (Estonia) 52 <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 + bounds=21.64,56.05,28.58,61.13 <>52 <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 <> 53 53 # Belgian Lambert 2008 54 54 <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 <> … … 74 74 <3950> +proj=lcc +lat_0=50 +lat_1=49.25 +lat_2=50.75 +lon_0=3 +x_0=1700000 +y_0=9200000 +ellps=GRS80 +nadgrids=null +units=m +bounds=-5.5,47.5,10.2,51.1 <> 75 75 # ETRS89 76 <4258> +proj=lonlat +ellps=GRS80 +datum=GRS80 + bounds=-180,-90,180,90 <>76 <4258> +proj=lonlat +ellps=GRS80 +datum=GRS80 +axis=neu +bounds=-180,-90,180,90 <> 77 77 # WGS 84 78 <4326> +proj=lonlat +ellps=WGS84 +datum=WGS84 + bounds=-180,-90,180,90 <>78 <4326> +proj=lonlat +ellps=WGS84 +datum=WGS84 +axis=neu +bounds=-180,-90,180,90 <> 79 79 # Swiss Grid (Switzerland) 80 80 <21781> +proj=somerc +lat_0=46d57'8.66" +lon_0=7d26'22.5" +x_0=600000 +y_0=200000 +ellps=bessel +towgs84=674.374,15.056,405.346 +units=m +bounds=5.7,45.7,10.6,47.9 <> … … 114 114 <31370> +proj=lcc +lat_0=90 +lat_1=49d50'0.00204" +lat_2=51d10'0.00204" +lon_0=4d22'2.952" +x_0=150000.013 +y_0=5400088.438 +ellps=intl +towgs84=-99.06,53.32,-112.49,0.419,-0.83,1.885,-1.0 +units=m +bounds=2.54,49.51,6.4,51.5 <> 115 115 # Gauß-Krüger Zone 2 116 <31466> +proj=tmerc +lon_0=6 +x_0=2500000 +ellps=bessel +nadgrids=BETA2007.gsb +units=m + bounds=3.5,-5,8.5,85 <>116 <31466> +proj=tmerc +lon_0=6 +x_0=2500000 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +axis=neu +bounds=3.5,-5,8.5,85 <> 117 117 # Gauß-Krüger Zone 3 118 <31467> +proj=tmerc +lon_0=9 +x_0=3500000 +ellps=bessel +nadgrids=BETA2007.gsb +units=m + bounds=6.5,-5,11.5,85 <>118 <31467> +proj=tmerc +lon_0=9 +x_0=3500000 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +axis=neu +bounds=6.5,-5,11.5,85 <> 119 119 # Gauß-Krüger Zone 4 120 <31468> +proj=tmerc +lon_0=12 +x_0=4500000 +ellps=bessel +nadgrids=BETA2007.gsb +units=m + bounds=9.5,-5,14.5,85 <>120 <31468> +proj=tmerc +lon_0=12 +x_0=4500000 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +axis=neu +bounds=9.5,-5,14.5,85 <> 121 121 # Gauß-Krüger Zone 5 122 <31469> +proj=tmerc +lon_0=15 +x_0=5500000 +ellps=bessel +nadgrids=BETA2007.gsb +units=m + bounds=12.5,-5,17.5,85 <>122 <31469> +proj=tmerc +lon_0=15 +x_0=5500000 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +axis=neu +bounds=12.5,-5,17.5,85 <> 123 123 # UTM zone 1N 124 124 <32601> +proj=tmerc +lon_0=-177 +k_0=0.9996 +x_0=500000 +ellps=WGS84 +datum=WGS84 +units=m +bounds=-182,-5,-172,85 <> -
trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
r8540 r8584 139 139 if (baseUrl.toLowerCase().contains("crs=epsg:4326")) { 140 140 switchLatLon = true; 141 } else if (baseUrl.toLowerCase().contains("crs=") && "EPSG:4326".equals(myProjCode)) { 142 switchLatLon = true; 141 } else if (baseUrl.toLowerCase().contains("crs=")) { 142 // assume WMS 1.3.0 143 switchLatLon = Main.getProjection().switchXY(); 143 144 } 144 145 String bbox; -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r8571 r8584 47 47 import org.openstreetmap.josm.data.coor.LatLon; 48 48 import org.openstreetmap.josm.data.projection.Projection; 49 import org.openstreetmap.josm.data.projection.Projections; 49 50 import org.openstreetmap.josm.gui.ExtendedDialog; 50 51 import org.openstreetmap.josm.io.CachedFile; … … 66 67 private static final String PATTERN_HEADER = "\\{header\\(([^,]+),([^}]+)\\)\\}"; 67 68 68 private static final String URL_GET_ENCODING_PARAMS = "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER={layer}&STYLE={ style}&"69 private static final String URL_GET_ENCODING_PARAMS = "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER={layer}&STYLE={Style}&" 69 70 + "FORMAT={format}&tileMatrixSet={TileMatrixSet}&tileMatrix={TileMatrix}&tileRow={TileRow}&tileCol={TileCol}"; 70 71 … … 229 230 230 231 } catch (Exception e) { 231 Main.error(e); 232 } 233 return null; 232 throw new IllegalArgumentException(e); 233 } 234 234 } 235 235 … … 268 268 matrixSet.crs = crsToCode(getStringByXpath(matrixSetNode, "SupportedCRS")); 269 269 NodeList tileMatrixList = getByXpath(matrixSetNode, "TileMatrix"); 270 Projection matrixProj = Projections.getProjectionByCode(matrixSet.crs); 271 if (matrixProj == null) { 272 // use current projection if none found. Maybe user is using custom string 273 matrixProj = Main.getProjection(); 274 } 270 275 for (int matrixId = 0; matrixId < tileMatrixList.getLength(); matrixId++) { 271 276 Node tileMatrixNode = tileMatrixList.item(matrixId); … … 274 279 tileMatrix.scaleDenominator = Double.parseDouble(getStringByXpath(tileMatrixNode, "ScaleDenominator")); 275 280 String[] topLeftCorner = getStringByXpath(tileMatrixNode, "TopLeftCorner").split(" "); 276 tileMatrix.topLeftCorner = new EastNorth(Double.parseDouble(topLeftCorner[1]), Double.parseDouble(topLeftCorner[0])); 281 282 if(matrixProj.switchXY()) { 283 tileMatrix.topLeftCorner = new EastNorth(Double.parseDouble(topLeftCorner[1]), Double.parseDouble(topLeftCorner[0])); 284 } else { 285 tileMatrix.topLeftCorner = new EastNorth(Double.parseDouble(topLeftCorner[0]), Double.parseDouble(topLeftCorner[1])); 286 } 277 287 tileMatrix.tileHeight = Integer.parseInt(getStringByXpath(tileMatrixNode, "TileHeight")); 278 288 tileMatrix.tileWidth = Integer.parseInt(getStringByXpath(tileMatrixNode, "TileHeight")); … … 291 301 private static String crsToCode(String crsIdentifier) { 292 302 if (crsIdentifier.startsWith("urn:ogc:def:crs:")) { 293 return crsIdentifier.replaceFirst("urn:ogc:def:crs:([^:]*): [^:]*:(.*)$", "$1:$2");303 return crsIdentifier.replaceFirst("urn:ogc:def:crs:([^:]*):.*:(.*)$", "$1:$2"); 294 304 } 295 305 return crsIdentifier; … … 439 449 } 440 450 double scale = matrix.scaleDenominator * this.crsScale; 441 EastNorth ret = new EastNorth(matrix.topLeftCorner. getX() + x * scale, matrix.topLeftCorner.getY() - y * scale);451 EastNorth ret = new EastNorth(matrix.topLeftCorner.east() + x * scale, matrix.topLeftCorner.north() - y * scale); 442 452 return Main.getProjection().eastNorth2latlon(ret).toCoordinate(); 443 453 } … … 589 599 EastNorth min = proj.latlon2eastNorth(bounds.getMin()); 590 600 EastNorth max = proj.latlon2eastNorth(bounds.getMax()); 591 return (int) Math.ceil(Math.abs(max. getY() - min.getY()) / scale);601 return (int) Math.ceil(Math.abs(max.north() - min.north()) / scale); 592 602 } 593 603 … … 601 611 EastNorth min = proj.latlon2eastNorth(bounds.getMin()); 602 612 EastNorth max = proj.latlon2eastNorth(bounds.getMax()); 603 return (int) Math.ceil(Math.abs(max. getX() - min.getX()) / scale);613 return (int) Math.ceil(Math.abs(max.east() - min.east()) / scale); 604 614 } 605 615 } -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r8570 r8584 50 50 protected Bounds bounds; 51 51 private double metersPerUnit = METER_PER_UNIT_DEGREE; // default to degrees 52 private String axis = "enu"; // default axis orientation is East, North, Up 52 53 53 54 /** … … 98 99 no_defs("no_defs", false), 99 100 init("init", true), 101 /** crs units to meter multiplier */ 100 102 to_meter("to_meter", true), 103 /** definition of axis for projection */ 104 axis("axis", true), 101 105 // JOSM extensions, not present in PROJ.4 102 106 wmssrs("wmssrs", true), … … 212 216 if (s != null) { 213 217 this.metersPerUnit = parseDouble(s, Param.to_meter.key); 218 } 219 s = parameters.get(Param.axis.key); 220 if (s != null) { 221 this.axis = s; 214 222 } 215 223 } … … 548 556 } 549 557 558 @Override 559 public boolean switchXY() { 560 // TODO: support for other axis orientation such as West South, and Up Down 561 return this.axis.startsWith("ne"); 562 } 563 550 564 private static Map<String, Double> getUnitsToMeters() { 551 565 Map<String, Double> ret = new ConcurrentHashMap<>(); -
trunk/src/org/openstreetmap/josm/data/projection/Projection.java
r8568 r8584 79 79 */ 80 80 double getMetersPerUnit(); 81 82 /** 83 * Does this projection natural order of coordinates is North East, 84 * instead of East North 85 * 86 * @return true if natural order of coordinates is North East, false if East North 87 */ 88 boolean switchXY(); 81 89 } -
trunk/src/org/openstreetmap/josm/gui/layer/WMTSLayer.java
r8570 r8584 69 69 return tileSource; 70 70 } 71 } catch (Exception e) {72 Main.warn("Could not create imagery layer:");71 return null; 72 } catch (IOException e) { 73 73 Main.warn(e); 74 throw new IllegalArgumentException(e); 74 75 } 75 return null;76 76 } 77 77 -
trunk/test/data/wmts/getCapabilities-wien.xml
r8569 r8584 60 60 <ResourceURL format="image/png" template="http://webgis.linz.at/WMTS/1.0.0/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png" resourceType="tile"/> 61 61 </Layer> 62 <Layer>63 <ows:Title>Stadtkarte</ows:Title>64 <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">65 <ows:LowerCorner>14.42 48.21</ows:LowerCorner>66 <ows:UpperCorner>14.24 48.38</ows:UpperCorner>67 </ows:WGS84BoundingBox>68 <ows:Identifier>Stadtkarte</ows:Identifier>69 <Style isDefault="true">70 <ows:Identifier>normal</ows:Identifier>71 </Style>72 <Format>image/png</Format>73 <TileMatrixSetLink>74 <TileMatrixSet>Stadtkarte_standard</TileMatrixSet>75 </TileMatrixSetLink>76 <ResourceURL format="image/png" template="http://webgis.linz.at/WMTS/1.0.0/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png" resourceType="tile"/>77 </Layer>78 <Layer>79 <ows:Title>Beschriftungen</ows:Title>80 <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">81 <ows:LowerCorner>14.42 48.21</ows:LowerCorner>82 <ows:UpperCorner>14.24 48.38</ows:UpperCorner>83 </ows:WGS84BoundingBox>84 <ows:Identifier>Beschriftungen</ows:Identifier>85 <Style isDefault="true">86 <ows:Identifier>normal</ows:Identifier>87 </Style>88 <Format>image/png</Format>89 <TileMatrixSetLink>90 <TileMatrixSet>Beschriftungen_alles</TileMatrixSet>91 </TileMatrixSetLink>92 <ResourceURL format="image/png" template="http://webgis.linz.at/WMTS/1.0.0/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png" resourceType="tile"/>93 </Layer>94 95 62 <TileMatrixSet> 96 63 <ows:Identifier>Orthofotos_standard</ows:Identifier> -
trunk/test/data/wmts/getcapabilities-pseudo-mercator.xml
r8568 r8584 53 53 <ows:Identifier>EPSG:3857:0</ows:Identifier> 54 54 <ScaleDenominator>559082264.0287178</ScaleDenominator> 55 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>55 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 56 56 <TileWidth>256</TileWidth> 57 57 <TileHeight>256</TileHeight> … … 63 63 <ows:Identifier>EPSG:3857:1</ows:Identifier> 64 64 <ScaleDenominator>279541132.0143589</ScaleDenominator> 65 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>65 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 66 66 <TileWidth>256</TileWidth> 67 67 <TileHeight>256</TileHeight> … … 73 73 <ows:Identifier>EPSG:3857:2</ows:Identifier> 74 74 <ScaleDenominator>139770566.0071794</ScaleDenominator> 75 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>75 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 76 76 <TileWidth>256</TileWidth> 77 77 <TileHeight>256</TileHeight> … … 83 83 <ows:Identifier>EPSG:3857:3</ows:Identifier> 84 84 <ScaleDenominator>69885283.00358972</ScaleDenominator> 85 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>85 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 86 86 <TileWidth>256</TileWidth> 87 87 <TileHeight>256</TileHeight> … … 93 93 <ows:Identifier>EPSG:3857:4</ows:Identifier> 94 94 <ScaleDenominator>34942641.50179486</ScaleDenominator> 95 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>95 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 96 96 <TileWidth>256</TileWidth> 97 97 <TileHeight>256</TileHeight> … … 103 103 <ows:Identifier>EPSG:3857:5</ows:Identifier> 104 104 <ScaleDenominator>17471320.75089743</ScaleDenominator> 105 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>105 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 106 106 <TileWidth>256</TileWidth> 107 107 <TileHeight>256</TileHeight> … … 113 113 <ows:Identifier>EPSG:3857:6</ows:Identifier> 114 114 <ScaleDenominator>8735660.375448715</ScaleDenominator> 115 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>115 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 116 116 <TileWidth>256</TileWidth> 117 117 <TileHeight>256</TileHeight> … … 123 123 <ows:Identifier>EPSG:3857:7</ows:Identifier> 124 124 <ScaleDenominator>4367830.187724357</ScaleDenominator> 125 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>125 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 126 126 <TileWidth>256</TileWidth> 127 127 <TileHeight>256</TileHeight> … … 133 133 <ows:Identifier>EPSG:3857:8</ows:Identifier> 134 134 <ScaleDenominator>2183915.093862179</ScaleDenominator> 135 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>135 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 136 136 <TileWidth>256</TileWidth> 137 137 <TileHeight>256</TileHeight> … … 143 143 <ows:Identifier>EPSG:3857:9</ows:Identifier> 144 144 <ScaleDenominator>1091957.546931089</ScaleDenominator> 145 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>145 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 146 146 <TileWidth>256</TileWidth> 147 147 <TileHeight>256</TileHeight> … … 153 153 <ows:Identifier>EPSG:3857:10</ows:Identifier> 154 154 <ScaleDenominator>545978.7734655447</ScaleDenominator> 155 <TopLeftCorner> 20037509.917339604 -20037508.342789244</TopLeftCorner>155 <TopLeftCorner>-20037508.3428 20037508.3428</TopLeftCorner> 156 156 <TileWidth>256</TileWidth> 157 157 <TileHeight>256</TileHeight> -
trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java
r8570 r8584 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertTrue; 5 6 6 7 import java.io.File; … … 10 11 import org.junit.BeforeClass; 11 12 import org.junit.Test; 13 import org.openstreetmap.gui.jmapviewer.TileXY; 12 14 import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource; 13 15 import org.openstreetmap.josm.JOSMFixture; 14 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.data.Bounds; 15 18 import org.openstreetmap.josm.data.coor.LatLon; 16 19 import org.openstreetmap.josm.data.projection.Projections; … … 69 72 assertEquals("TileXMax", 5, testSource.getTileXMax(3)); 70 73 assertEquals("TileYMax", 4, testSource.getTileYMax(3)); 74 71 75 } 72 76 … … 75 79 Main.setProjection(Projections.getProjectionByCode("EPSG:31370")); 76 80 WMTSTileSource testSource = new WMTSTileSource(testImageryWALLONIE); 77 } 81 Bounds wallonieBounds = new Bounds( 82 new LatLon(49.485372459967245, 2.840548314430268), 83 new LatLon(50.820959517561256, 6.427849693016202) 84 ); 85 verifyBounds(wallonieBounds, testSource, 10, 20324, 17724); 86 87 } 88 89 private void verifyBounds(Bounds bounds, WMTSTileSource testSource, int z, int x, int y) { 90 LatLon ret = new LatLon(testSource.tileXYToLatLon(y, y, z)); 91 assertTrue(ret.toDisplayString() + " doesn't lie within: " + bounds.toString(), bounds.contains(ret)); 92 } 93 94 78 95 79 96 @Test … … 83 100 int zoomOffset = 10; 84 101 102 // Linz - 11/1105/709.png 85 103 verifyMercatorTile(testSource, 0, 0, 1, zoomOffset); 104 verifyMercatorTile(testSource, 1105, 709, 2, zoomOffset); 105 verifyMercatorTile(testSource, 1, 1, 1, zoomOffset); 106 verifyMercatorTile(testSource, 2, 2, 1, zoomOffset); 86 107 verifyMercatorTile(testSource, 0, 0, 2, zoomOffset); 87 108 verifyMercatorTile(testSource, 1, 1, 2, zoomOffset); 88 for (int x = 0; x < 4; x++) { 89 for (int y = 0; y < 4; y++) { 109 110 111 LatLon ll = new LatLon(testSource.tileXYToLatLon(500, 500, 1)); 112 113 TileXY xy = testSource.latLonToTileXY(new LatLon(48.21, 14.24).toCoordinate(), 1); 114 assertTrue("X index is negative: " + xy.getXIndex(), xy.getXIndex() > 0); 115 assertTrue(xy.getYIndex() > 0); 116 for(int x = 0; x < 4; x++) { 117 for(int y = 0; y < 4; y++) { 90 118 verifyMercatorTile(testSource, x, y, 3, zoomOffset); 91 119 } 92 120 } 93 for 94 for 121 for(int x = 0; x < 8; x++) { 122 for(int y = 0; y < 4; y++) { 95 123 verifyMercatorTile(testSource, x, y, zoomOffset); 96 124 } 97 125 } 98 126 99 verifyMercatorTile(testSource, 2 << 9 - 1, 2 <<8 - 1, zoomOffset);127 verifyMercatorTile(testSource, 2<<9 - 1, 2<<8 - 1, zoomOffset); 100 128 101 129 assertEquals("TileXMax", 1, testSource.getTileXMax(1)); … … 122 150 assertEquals("TileYMax", 74, testSource.getTileYMax(3)); 123 151 assertEquals( 124 "http://mapy.geoportal.gov.pl/wss/service/WMTS/guest/wmts/TOPO?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=MAPA " 125 + "TOPOGRAFICZNA&STYLE=&FORMAT=image/jpeg&TileMatrixSet=EPSG:4326&TileMatrix=EPSG:4326:0&TileRow=1&TileCol=1", 152 "http://mapy.geoportal.gov.pl/wss/service/WMTS/guest/wmts/TOPO?SERVICE=WMTS&REQUEST=GetTile&" 153 + "VERSION=1.0.0&LAYER=MAPA TOPOGRAFICZNA&STYLE=&FORMAT=image/jpeg&tileMatrixSet=EPSG:4326&" 154 + "tileMatrix=EPSG:4326:0&tileRow=1&tileCol=1", 126 155 testSource.getTileUrl(1, 1, 1)); 127 156 }
Note:
See TracChangeset
for help on using the changeset viewer.