Changeset 25265 in osm
- Timestamp:
- 2011-02-09T12:58:23+01:00 (14 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileSource.java
r24763 r25265 99 99 return "http://openstreetmap.org/"; 100 100 } 101 102 public double latToTileY(double lat, int zoom) { 103 double l = lat / 180 * Math.PI; 104 double pf = Math.log(Math.tan(l) + (1 / Math.cos(l))); 105 return Math.pow(2.0, zoom - 1) * (Math.PI - pf) / Math.PI; 106 } 107 108 public double lonToTileX(double lon, int zoom) { 109 return Math.pow(2.0, zoom - 3) * (lon + 180.0) / 45.0; 110 } 111 112 public double tileYToLat(int y, int zoom) { 113 return Math.atan(Math.sinh(Math.PI 114 - (Math.PI * y / Math.pow(2.0, zoom - 1)))) 115 * 180 / Math.PI; 116 } 117 118 public double tileXToLon(int x, int zoom) { 119 return x * 45.0 / Math.pow(2.0, zoom - 3) - 180.0; 120 } 101 121 } 102 122 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
r24763 r25265 124 124 */ 125 125 public String getTermsOfUseURL(); 126 127 public double latToTileY(double lat, int zoom); 128 129 public double lonToTileX(double lon, int zoom); 130 131 public double tileYToLat(int y, int zoom); 132 133 public double tileXToLon(int x, int zoom); 126 134 }
Note:
See TracChangeset
for help on using the changeset viewer.