Thanks @Johan, your code is very usefully.
I need to find the EPSG id for utm zone, given latitude and longitude :
import math
# Special zones for Svalbard and Norway
def getZones(longitude, latitude) :
if (latitude >= 72.0 and latitude < 84.0 ) :
if (longitude >= 0.0 and longitude < 9.0) :
return 31
if (longitude >= 9.0 and longitude < 21.0):
return 33
if (longitude >= 21.0 and longitude < 33.0):
return 35
if (longitude >= 33.0 and longitude < 42.0) :
return 37
return (math.floor((longitude + 180) / 6) ) + 1
def findEPSG(longitude, latitude) :
zone = getZones(longitude, latitude)
#zone = (math.floor((longitude + 180) / 6) ) + 1 # without special zones for Svalbard and Norway
epsg_code = 32600
epsg_code += int(zone)
if (latitude < 0): # South
epsg_code += 100
return epsg_code
print(findEPSG(-64,-32) )