coordtarns

package module
v0.0.0-...-e77dabc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2019 License: MIT Imports: 2 Imported by: 0

README

coordtrans

计算地球上两点间的距离、方位、俯仰

示例代码

package main
import (
	"fmt"
	 "github.com/csyangbinbin/coordtrans"
)

func main() {
	LocJd := 121.15
	locaWd := 37.5
	localH := 40.0
  
	targetJw := 121.6
	targetWd := 37.6
	targetH := 60.0
	
	//计算目标点相对于参考点的极坐标
	P := coordtarns.JWH2RAE_S(coordtarns.GeoCoord{LocJd, locaWd, localH},
		coordtarns.GeoCoord{targetJw, targetWd, targetH})
		
	//相对于参考点的极坐标转换为地理坐标
	G := coordtarns.RAE2JWH_S(coordtarns.GeoCoord{LocJd, locaWd, localH}, P)

	fmt.Print(P, G)

}

Documentation

Index

Constants

View Source
const M_PI = math.Pi
View Source
const Ra = 6378137.0 //WGS84椭球长半轴
View Source
const Rb = 6356752.314245179497 //WGS84椭球短半轴
View Source
const Re = 6378.137 //地球赤道半径2002.4.7

Variables

This section is empty.

Functions

func JWH2RAE

func JWH2RAE(LocJd, LocWd, LocH, targetJw, TargeWd, TargetH float64) (r, a, e float64)

func RAE2JWH

func RAE2JWH(LocJd, LocWd, LocH, r, a, e float64) (targetJw, TargeWd, TargetH float64)

Types

type GeoCoord

type GeoCoord struct {
	Lon float64 //经度
	Lat float64 //纬度
	Alt float64 //高度(单位:米)
}

func RAE2JWH_S

func RAE2JWH_S(ref GeoCoord, target PolarCoordstruct) GeoCoord

type PolarCoordstruct

type PolarCoordstruct struct {
	R float64 //距离
	A float64 //方位
	E float64 //俯仰
}

func JWH2RAE_S

func JWH2RAE_S(ref GeoCoord, target GeoCoord) PolarCoordstruct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL