I am trying to create a x mile square (or circle) around a central point, where all sides of the square would be x miles from the centre. I need the 4 corner coordinates.
It is scrambling my brain trying to get my head round it? I can work out the distance between two points using the haversine formula but maths is seriously not my strong point and I don't understand sin,cos etc.. and trying sort this out has lost me!
I have come across Calculating Latitude/Longitude X miles from point? but I just don't get it!
Would anyone be kind enough to explain how I do this in apples and pears terms?
To explain exactly what I trying to do;
I have a website, where users can search for buildings in a specific area. They will enter a town or place (which I will know the lat long of) and they search within a specific radius of say 10 miles of the place.
I need to find the min/max lat and longs of the 10mile radius so I can query my database using a where clause similar to:
Where buildingLat <= maxLat
and buildingLat <= minLat
and buildingLong >= minLong
or buildingLong >= maxLong
I need some kind of formula!
My coordinates are in decimal degrees
dlbedf * cos(f), as you mention in the second sentence, "... but east or west, it is only 69*cos(latitude) miles"? – boot-scootin Aug 31 '21 at 20:121/cos(f). – whuber Aug 31 '21 at 20:31(f, l)points:(48.71626872816001, -124.76410018717496)and(48.70177597453682, -124.76410018717496). Usingr = 1and the formulae described above, the longitudinal values for the second point creates a much wider box than would be expected (full math redacted for brevity. It seems to happen becausecos(f)gets very small for the second point. Any ideas as to whether this is expected? Happy to pose a separate question if need be. – boot-scootin Aug 31 '21 at 21:08cosfunction expects degrees or radians for the units of its argumentf. The cosine of a latitude near 48.7 will be close to 0.66 (as you can tell by examining the mid-latitudes on any globe), not "very small" at all. – whuber Aug 08 '23 at 17:11