def forward_mercator(lonlat):
 x = ((lonlat[0] * 20037508.34) / 180)
 try:
  n = math.tan((((90 + lonlat[1]) * math.pi) / 360))
 except ValueError:
  n = 0
 if (n <= 0):
  y = float('-inf')
 else:
  y = ((math.log(n) / math.pi) * 20037508.34)
 return (x, y)

def forward_mercator ( lonlat ) : x = ( ( lonlat [ 0 ] * 20037508.34 ) / 180 ) try : n = math . tan ( ( ( ( 90 + lonlat [ 1 ] ) * math . pi ) / 360 ) ) except ValueError : n = 0 if ( n <= 0 ) : y = float ( '-inf' ) else : y = ( ( math . log ( n ) / math . pi ) * 20037508.34 ) return ( x , y )
given geographic coordinates .