HI there! I know the below code calculates the north west corner long/lat coordinates of a tile, but is there a way to calculate the north east, south east or south west corner long/lat coordinates? (I'm terrible at maths...).

I'm programming in java, and any zoom around 17 - 19 would do.

static double tile2lon(int x, int z) { return x / Math.pow(2.0, z) * 360.0 - 180; }

static double tile2lat(int y, int z) { double n = Math.PI - (2.0 * Math.PI * y) / Math.pow(2.0, z); return Math.toDegrees(Math.atan(Math.sinh(n))); }

Thank you very much!

asked 30 May, 02:18

xj18205's gravatar image

xj18205
3612
accept rate: 0%


I just realised I can use the NW corner of the surround tiles to work out this answer!

permanent link

answered 30 May, 03:06

xj18205's gravatar image

xj18205
3612
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×229
×117
×61
×33
×8

question asked: 30 May, 02:18

question was seen: 202 times

last updated: 30 May, 03:06

powered by OSQA