title: Convert from latitude, longitude to x, y
body: <p>I want to convert GPS location (latitude, longitude) into x,y coordinates.
  I found many links about this topic and applied it, but it doesn't give me the correct answer!</p>
  
  <p>I am following these steps to test the answer:
  (1) firstly, i take two positions and calculate the distance between them using maps.
  (2) then convert the two positions into x,y coordinates.
  (3) then again calculate  distance between the two points in the x,y coordinates 
    and see if it give me the same result in point(1) or not.</p>
  
  <p>one of the solution i found the following, but it doesn't give me correct answer!</p>
  
  <pre><code>latitude = Math.PI * latitude / 180;
  longitude = Math.PI * longitude / 180;
  
  // adjust position by radians
  latitude -= 1.570795765134; // subtract 90 degrees (in radians)
  
  // and switch z and y 
  xPos = (app.radius) * Math.sin(latitude) * Math.cos(longitude);
  zPos = (app.radius) * Math.sin(latitude) * Math.sin(longitude);
  yPos = (app.radius) * Math.cos(latitude);
  </code></pre>
  
  <p>also i tried this <a href="https://stackoverflow.com/a/1185413/2035790">link</a> but still not work with me well!</p>
  
  <p>any help how to convert from(latitude, longitude) to (x,y) ?</p>
  
  <p>Thanks,</p>