Please check the code which i tried to write with the help of the link suggested by people below. Please tell whether i have implemented the logic correctly or not. I have pasted the data in excel sheet to see its plot on http://www.copypastemap.com/map.php `
import java.io.File;
import java.io.IOException;
import jxl.Workbook;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
public class FindingLatLongAlongACircle {
static double latitude= 35.306614;
static double longitude= -80.7444093;
//static double circumofEarth= 40075000;
static double R=20;
public static void main(String[] args) throws IOException {
File f= new File("C:\\Users\\Manu Chaudhary\\Desktop\\LatongAroundaPoint.xls");
WritableWorkbook myexcel= Workbook.createWorkbook(f);
WritableSheet mysheet= myexcel.createSheet("mysheet",0);
int YAxis1=0;
int YAxis2=0;
// Added now
jxl.write.Label k1;
jxl.write.Label k2;
double angle=0;
double angleRadian=0;
// double changeInLat;
//double changeInLong;
double dx;
double dy;
double final_latitude=0;
double final_longitude=0;
double delta_longitude;
double delta_latitude;
while(angle<360){
angle=angle+15;
angleRadian= Math.toRadians(angle);
dx= R* Math.sin(angleRadian);
dy= R* Math.cos(angleRadian);
//changeInLat= (distance* Math.cos(angleRadian))/(circumofEarth* Math.cos(lat1));
//changeInLong= (distance*Math.sin(angleRadian))/circumofEarth;
//newLatitude= lat1+changeInLat;
//newLongitude=long1+ changeInLong;
delta_longitude= dx/(111320* Math.cos(latitude));
delta_latitude= dy/110540;
final_latitude= latitude+ delta_latitude;
final_longitude=longitude+ delta_longitude;
YAxis1++;
YAxis2++;
k1= new jxl.write.Label(0,YAxis1,Double.toString(final_latitude));
k2= new jxl.write.Label(1,YAxis2,Double.toString(final_longitude));
try {
mysheet.addCell(k1);
} catch (RowsExceededException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
mysheet.addCell(k2);
} catch (RowsExceededException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("The value of latitude at "+ angle + " angle is"+ final_latitude);
System.out.println("The value of longitude at "+ angle + " angle is"+ final_longitude);
}
myexcel.write();
try {
myexcel.close();
} catch (WriteException e) {
e.printStackTrace();
System.out.println("Finish");
}
}
}
`Suppose i know the latitude and longitude of a point. Can i calculate the latitude and longitude all around the point(approx. 16 points) if i know the distance of separation? I searched the stackoverflow and found two useful links.
- Calculate second point knowing the starting point and distance
- Google Maps V3 Circle & Circle that I created do not match
For making the question clear please see the Latitudes and longitudes required. Please help me with a code in python.