Friday 14 December 2018

how to use the google elevation api








Below is a code written in python to send get requests to the google elevation api and then store
the results into an sqlite database.
Make appropriate changes to the code as mentioned in the comments before executing the code.


Go here to get your own api key




import requests
import sqlite3
import json

key = '<paste your google api key here>' #google api key
#sqlite connection
conn = sqlite3.connect('<path to your sqlite database>')
id = 1
#api end point
base_url = 'https://maps.googleapis.com/maps/api/elevation/json?'
number_of_coordinates = 4610
while (id < number_of_coordinates):    
   instanceOfRow = conn.execute("SELECT * from forlake WHERE Number=?",(id,))
   row = instanceOfRow.fetchall()
   latitude = row[0][2]
   longitude = row[0][3]
   url = base_url + 'locations=' + str(latitude) + ',' + str(longitude) + '&key=' + key #constructing api endpoint
   api_response = requests.get(url)
   data = api_response.json()
   conn.execute("UPDATE forlake SET elevation = ? WHERE Number = ?",(data["results"][0]['elevation'],id,))
   if id%100 == 0:
       conn.commit() #commit changes in the database after every 100 records
       print id
   id = id + 1

conn.commit()    
print 'done'



Friday 21 September 2018

Human eye

The eye is a cohesive organ: different tissues performing different functions but working together as a team to perform specific larger functions within an organism. In contrast, you're trying to draw a comparison about interactions between completely different macro organisms.
Now one can make the argument that these kind of definitions and distinctions are arbitrary, and then we could get into a pseudo-scientific, pseudo-philosophical discussion about whether individual cells are actually discrete organisms and whether an animal (i.e. human) organism is really an individual or simply a collection of individuals. But that wouldn't change the fact that organs and organisms are separate definitions implying specific purposes and functions and that when we are talking about words like waste and byproduct we are also talking about specific purpose and function. Since none of the functions of our cells have sentient intent, any purpose of function (or lack thereof) is described in terms of intent that we ascribe to the cellular life.
From a metabolic point of view, each cone and rod cell is it's own system with inputs and outputs. Let's say you are speaking of plants. We commonly say they produce O2, which is perfectly true. But one might also say, looking at only the plant itself as a system, that O2 is a byproduct of it's metabolism. Surely many animals would die without it, and it's necessary to the ecosystem as a whole, but not to the plant itself. The purpose was to make energy, and O2 is a waste product removed from the system.Tetrachromats can see colors that most people cannot — up to 100 million, estimates suggest, which is 100 times that of the average human. Most people have three cells, or receptors, in their retinas, but tetrachomats have a fourth receptor, which may be what allows for their heightened color perception. They are usually female, and it’s estimated that about 12 percent of women carry the gene for this fourth receptor.