def latLonToPixel(raster_dataset, location):
  ds = raster_dataset
  gt = ds.GetGeoTransform()
  srs = osr.SpatialReference()
  srs.ImportFromWkt(ds.GetProjection())
  srsLatLong = srs.CloneGeogCS()
  ct = osr.CoordinateTransformation(srsLatLong,srs)
  new_location =[None, None]
  # Change the point locations into the GeoTransform space
  (new_location[1],new_location[0],holder) = ct.TransformPoint(location[1],location[0])
  # Translate the x and y coordinates into pixel values
  x = (new_location[1]-gt[0])/gt[1]
  y = (new_location[0]-gt[3])/gt[5]
  return(int(x),int(y))
from http://zacharybears.com/using-python-to-translate-latlon-locations-to-pixels-on-a-geotiff/
dataset/ETHPy150Open trailbehind/DeepOSM/src/geo_util.py/latLonToPixel