0
votes

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.

For making the question clear please see the Latitudes and longitudes required. Please help me with a code in python.

1
What are your ideas as to the formulas? Show us the code you have so far. The point of this site is not to have someone solve a general problem like this for you. Rather, you should give what you're doing a try so that you can show us some attempt you've made and have a more specific question.CryptoFool
What are your ideas as to the formulas? Show us the code you have so far. The point of this site is not to have someone solve a general problem like this for you. Rather, you should give what you're doing a try so that you can show us some attempt you've made and have a more specific question.CryptoFool
Please give me some link to understand the mathematical formula.Manu Chaudhary
Huh? This isn't a site for free research. If someone happens to know it off hand, I guess it's ok to hope for that, but I think you should go do your own research. This Exchange is about programming, and computer stuff, not about geospatial relationships. For help on this forum, you should come with your domain knowledge in hand.CryptoFool
Hey Steve, be a bit polite in your comments. This is just a programming problem. I have pasted a solution. Hopefully it is correct.Manu Chaudhary

1 Answers

0
votes

This is just basic trig:

θ = angle of elevation in a triangle formed by connecting an outer dot to the center dot, then extending a 90º line horizontally from the center dot until an altitude can connect the two priorly drawn lines

ec = earth's circumference

distance•cos(θ)/(ec•cos(latitude)) = Δlong

distance•sin(θ)/ec = Δlat

Please attempt some code, this site isn't to have people do your homework.