# Kilometer to degree and back

I used the following code from this github repo I know it take a point coodinates and return area of 10 sequare Km around it by transforming Km to degree, but I need to make this area to 5 sequare Km for example. how can I achieve that? The only number I found is (3.75) but I'm not sure what it represents and how to change it to get the area I need. I know this might sound obvious for some, but I have zero background in GIS and GEO data and I played around with the code but the results I had didn't make any sense at least for me.

``````import math

# Distances are measured in kilometers.
# Longitudes and latitudes are measured in degrees.
# Earth is assumed to be perfectly spherical.

def change_in_latitude(kms):
"Given a distance north, return the change in latitude."

def change_in_longitude(latitude, kms):
"Given a latitude and a distance west, return the change in longitude."
# Find the radius of a circle around the earth at given latitude.

def ten_km_square(latitude, longitude):
slat, nlat = latitude+change_in_latitude(-3.75), latitude+change_in_latitude(3.75)
wlon = longitude+change_in_longitude(latitude,-3.75)
elon = longitude+change_in_longitude(latitude, 3.75)
return(nlat, wlon, slat, elon)

def main(lon, lat):
'''First argument degrees longitude (E is positive, W negative)
of the landslide location,
second argument latitude (N positive, S negative),
in decimal format(not minutes etc.)'''
nlat, wlon, slat, elon = ten_km_square(lat,lon)
#print("(NLat:{:.4f},WLon:{:.4f}),(SLat:{:.4f},ELon:{:.4f});".format(nlat, wlon, slat, elon))
print("var region = '[[{:.4f},{:.4f}], [{:.4f},{:.4f}], [{:.4f},{:.4f}], [{:.4f},{:.4f}]]';".format(wlon,nlat,elon,nlat,wlon,slat,elon,slat))
print("var rectangle = [{:.4f},{:.4f},{:.4f},{:.4f}];".format(wlon,slat,elon,nlat))

#change these to longitude, latitude
main(18.07769,44.14354)
``````
• This definitely doesn't make a 10km² square or a square with 10km sides However it does make a square with ~7.5 km (3.75*2) sides and an area of ~58km² (7.5²) Commented Aug 26, 2020 at 6:39

`sqrt(5) ~= 2.236 (side of square) / 2 = 1.118 km`