I'm using this tool to get the tile number (horizontal/vertical) from lat/long. Is there any code,preferably python, to get the tile number ? I tried using this tool. But it gives wrong tile number. Here's my code:

import numpy as np
data = np.genfromtxt('sn_bound_10deg.txt', skip_header = 7, skip_footer = 3)
lat,lon = -25.439538,149.053418
in_tile = False
i = 0
while(not in_tile):
  #print data[i,0],data[i,1],data[i, 4],data[i, 5],data[i, 2],data[i, 3]
  in_tile = lat >= data[i, 4] and lat <= data[i, 5] and lon >= data[i, 2] and lon <= data[i, 3]
  i += 1

vert = data[i-1, 0]
horiz = data[i-1, 1]
print('Vertical Tile:', vert, 'Horizontal Tile:', horiz)

The output tile from the above code is: h30v11

Expected output and output from the online calculator is: h31v11

Here's the sn_bound_10deg.txt file.

  • I'm looking at sn_bound_10deg and it definitely feels like some of the tiles overlap. Not sure exactly what is going on – badgley Feb 4 '18 at 0:10
  • Often you can't calculate a single tile number from lat/lon bounding coordinates (try to reproject an image and you'll see why). Though the online tile calculator is open source landweb.modaps.eosdis.nasa.gov/cgi-bin/developer/tilemap.cgi – dr_times Feb 6 '18 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.