[OSM-dev] diffs in rails port and josm for the same algo
Martin Schafran
martin at ampelmeter.com
Thu Jun 20 19:46:44 UTC 2013
hi,
josm and rails port have different world parts. 65535 and 65536.
testing at bounds
for eg. at lon=180 we get different results, namely 65535 or 65536.
am I right?
look at this in quad_tile.rb
def self.tiles_for_area(bbox)
minx = ((bbox.min_lon + 180) * 65535 / 360).round
maxx = ((bbox.max_lon + 180) * 65535 / 360).round
miny = ((bbox.min_lat + 90) * 65535 / 180).round
maxy = ((bbox.max_lat + 90) * 65535 / 180).round
tiles = []
minx.upto(maxx) do |x|
miny.upto(maxy) do |y|
tiles << tile_for_xy(x, y)
end
end
return tiles
end
and this in josm QuadTiling.java
double WORLD_PARTS = 65536.0;
public static long lon2x(double lon)
{
//return Math.round((lon + 180.0) * QuadBuckets.WORLD_PARTS /
360.0)-1;
long ret = (long)((lon + 180.0) * WORLD_PARTS / 360.0);
if (ret == WORLD_PARTS) {
ret--;
}
return ret;
}
martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20130620/31c1bd15/attachment.pgp>
More information about the dev
mailing list