1

I'm trying to calc a square around a single point but I keep getting a rectangle.

This is the point -80.42816162109375, 26.686729520004036.

Here's what it looks like:

enter image description here

What am I doing wrong?

int lat_feet = long_feet = 50;
double lat_meters = lat_feet * .3048;
double long_meters = long_feet * .3048;
var earth = 6378137;

var l1 = lat + (180 / Math.PI) * (lat_meters / earth);
var l2 = llong + (180 / Math.PI) * (long_meters / earth) / Math.Cos(lat);
jbassking10
  • 833
  • 4
  • 15
  • 42
  • Longitudes aren't constant, they vary with latitude. At the equator you'd get a square. – Mark Ransom Nov 01 '18 at 02:53
  • Is there a reliable way to calc a square? – jbassking10 Nov 01 '18 at 02:56
  • 1
    You could start by checking out https://stackoverflow.com/questions/3024404/transform-longitude-latitude-into-meters. – Mark Ransom Nov 01 '18 at 02:59
  • Using dividing by `Math.Cos(lat)` is right, and you should get rather good square approximation **at the map**. Is there some mistake like degree argument of Cos or something else? How do you see rectangle? For what data? – MBo Nov 01 '18 at 05:00
  • 1
    Please specify what you want. There is no square in the usual sense on a sphere. Do you want a square in a projection of the sphere / map? Then, what projection do you use? – Nico Schertler Nov 01 '18 at 07:31
  • I added an image of what it looks like along with the lat/long – jbassking10 Nov 01 '18 at 13:14
  • Show result values – MBo Nov 01 '18 at 15:55
  • Thanks for adding code. You don't mention a language, but pretty much all of them require radians as input to `Cos` but you're supplying degrees. – Mark Ransom Nov 05 '18 at 16:16

0 Answers0