0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GPSの研究 その6

Last updated at Posted at 2018-06-14

概要

GPSを理解したかった。
RINEXから、読み出した衛星の軌道をEARTHで、眺めてみた。

写真

sat.jpg

サンプルコード

from lxml import etree
from pykml.factory import KML_ElementMaker as KML
import pyproj

ecef = pyproj.Proj(proj = 'geocent', ellps = 'WGS84', datum = 'WGS84')
lla = pyproj.Proj(proj = 'latlong', ellps = 'WGS84', datum = 'WGS84')
sats = [
	"G02 6262234.031370984 -14613110.981922923 21254935.229655903",
	"G04 19040661.998708855 -8311756.524602333 16532658.634675292",
	"G07 26078664.69836943 5588070.077162541 -239561.27794465935",
	"G08 24470813.305349953 -95731.17177840695 -10965308.78942738",
	"G10 10946425.106999923 -13217422.981333993 19960118.04486387",
	"G13 17400028.443231095 1461399.2922087098 19887536.270703305",
	"G17 21078475.93615281 -13351300.07070003 -8639709.183587706",
	"G20 14385911.569008492 20514420.345839 8765413.838559393",
	"G23 9336918.80677975 12048291.269695656 21723935.800126303" 
]

doc = KML.kml(
	KML.Folder(
	)
)
for sat in sats:
	l = sat.split(' ')
	x = float(l[1])
	y = float(l[2])
	z = float(l[3])
	lon, lat, alt = pyproj.transform(ecef, lla, x, y, z, radians = False)
	pm = KML.Placemark(
		KML.name(l[0]),
		KML.Point(
			KML.altitudeMode("absolute"),
			KML.coordinates("{},{},{}".format(lon, lat, alt)),
		),
		KML.Style(
			KML.IconStyle(
				KML.Icon(
					KML.href('http://maps.google.com/mapfiles/kml/paddle/A.png')
				),
				KML.scale(40)
			)
		)
	)
	doc.Folder.append(pm)

print (etree.tostring(doc, pretty_print = True).decode())

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?