Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val latMax = 41.2
- val degreeDist = (earthRadius * 2 * math.Pi) / 360
- val latWidth = dist / degreeDist
- val lonWidth = dist / (degreeDist * math.cos(math.toRadians(latMax)))
- .withColumn("dropoff_lat_bucket", floor($"dropoff_latitude" * degreeDist / dist))
- .withColumn("pickup_lat_bucket", floor($"pickup_latitude" * degreeDist / dist))
- .withColumn("dropoff_lon_bucket", floor($"dropoff_longitude" * (degreeDist * math.cos(math.toRadians(latMax)) / dist)))
- .withColumn("pickup_lon_bucket", floor($"pickup_longitude" * (degreeDist * math.cos(math.toRadians(latMax)) / dist)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement