Advertisement
Guest User

Untitled

a guest
Jan 11th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.61 KB | None | 0 0
  1.     val latMax = 41.2
  2.     val degreeDist = (earthRadius * 2 * math.Pi) / 360
  3.     val latWidth = dist / degreeDist
  4.     val lonWidth = dist / (degreeDist * math.cos(math.toRadians(latMax)))
  5.  
  6.  
  7.      .withColumn("dropoff_lat_bucket", floor($"dropoff_latitude" * degreeDist / dist))
  8.       .withColumn("pickup_lat_bucket", floor($"pickup_latitude" * degreeDist / dist))
  9.       .withColumn("dropoff_lon_bucket", floor($"dropoff_longitude" * (degreeDist * math.cos(math.toRadians(latMax)) / dist)))
  10.       .withColumn("pickup_lon_bucket", floor($"pickup_longitude" * (degreeDist * math.cos(math.toRadians(latMax)) / dist)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement