title: How to convert Longitude and Latitude to points and using the points in drawing a polygon
body: <p>I'm new to GIS applications and I have a little problem. I'm trying to plot a polygon using geographic coordinates but I need to convert these coordinates to points before I can use them in plotting the polygon.
  I don't know how to convert these coordinates to points to use for the polygon. I spent all my yesterday finding out how to do this but I really still don't get it.
  I tried using the geography datatype in ms sql server 2008 but I couldn't find a java api in retrieving the polygon or the converted coordinates.
  Please help me with a sample code on how to do this.</p>
  
  <p>Thanks a lot people!!!</p>
  
  <p>This is my code. 'Code'</p>
  
  <pre><code>double earth=6371;
  double focal=500;
  
  double lat= 47.653 ;
  double lon = -122.358  ;
  
  double latitude = lat*Math.PI/180;
  double longitude = lon*Math.PI/180;
  
  double x = earth * Math.sin(latitude)*Math.cos(longitude);
  
  double y = earth * Math.sin(latitude)*Math.sin(longitude);
  
  double z = earth * Math.cos(latitude);
  
  double projectedX = x*focal /(focal+z);
  
  double projectedY = y * focal / (focal+z);
  
  int magx = (int) Math.round(projectedX * 5); 
  int magy = (int) Math.round(projectedY *5);
  
  System.out.println ("MAG X : "+magx);
  System.out.println ("MAG Y : "+magy);
  </code></pre>
  
  <p>I just plug in d mag x and y into my polygon but nothing comes up.</p>