生成圆半径的坐标到KML中的坐标

时间:2016-03-03 14:22:02

标签: java kml

我有圆心的坐标和半径。我需要知道圆的坐标才能以KML为后缀圆。

我写了一个脚本,它产生一个较低的位置,但是当他插入KML me out elips而不是一个圆圈时,他会创建它们。帮助理解什么是什么?

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
int[] a = new int[10];
double[] ar1;
double  ar2[];
    a[1]=5;

    double centerLat = (44.507693* Math.PI) / 180.0;  //rad
    double centerLng = (34.152739* Math.PI) / 180.0; //rad        
    double dist = 1/ 6371.0; 
    double lan;
     for (int x = 0; x <= 360; x += 1)
    {
        double brng = x * Math.PI / 180.0;         //rad
        double latitude = Math.asin(Math.sin(centerLat) * Math.cos(dist) +    Math.cos(centerLat) * Math.sin(dist) * Math.cos(brng));
        double longitude = ((centerLng + Math.atan2(Math.sin(brng) *   Math.sin(dist)* Math.cos(centerLat), Math.cos(dist) - Math.sin(centerLat) 
        * Math.sin(latitude))) * 180.0) / Math.PI;
        lan=(latitude * 180.0) / Math.PI; //, longitude));
        System.out.println(""+lan+"  "+longitude );
    }
}

}

1 个答案:

答案 0 :(得分:0)

你的公式是正确的。以下是完整的Java代码,用于生成圆的坐标并输出为具有多边形几何的KML地标。

double