2

I have gone through the link Given a latitude and longitude, and distance, I want to find a bounding box this linke gives the solution to creating bounding box but few things I could not understand .

def boundingBox(latitudeInDegrees, longitudeInDegrees, halfSideInKm):
lat = math.radians(latitudeInDegrees)
lon = math.radians(longitudeInDegrees)
halfSide = 1000*halfSideInKm

RADIUS_OF_EARTH  = 6371
# Radius of the parallel at given latitude
pradius = radius*math.cos(lat)

latMin = lat - halfSide/radius
latMax = lat + halfSide/radius
lonMin = lon - halfSide/pradius
lonMax = lon + halfSide/pradius
rad2deg = math.degrees
return (rad2deg(latMin), rad2deg(lonMin), rad2deg(latMax), rad2deg(lonMax))

in the above code what is the value of radius and what is represent by 6371 in RADIUS_OF_EARTH ?

Any one can explain ?

Thanks

Community
  • 1
  • 1

1 Answers1

0

according to wikipedia 6371km is the mean radius of the earth. I can't see a definition of radius in the piece of code you show, but it should be set to RADIUS_OF_EARTH, because pradius is the horizontal projection of the radius (according to the comment).

slfan
  • 8,950
  • 115
  • 65
  • 78