Documentation ¶
Overview ¶
Package sphere contains convenience methods for generating coordinates on a sphere. All angles are measured in degrees.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Unit is the unit sphere. Unit = T{R: 1} // FAI is the FAI sphere, measured in meters. FAI = T{R: 6371000} // WGS84 is a sphere whose radius is equal to the the semi-major axis of // the WGS84 ellipsoid, measured in meters. WGS84 = T{R: 6378137} )
Functions ¶
This section is empty.
Types ¶
type T ¶
type T struct {
R float64
}
A T is a sphere of radius R.
func (T) Circle ¶
Circle returns an array of kml.Coordinates that approximate a circle of radius radius centered on center with a maximum error of maxErr.
Example ¶
k := kml.KML( kml.Placemark( kml.LineString( kml.Coordinates(WGS84.Circle(kml.Coordinate{Lon: 7.658320, Lat: 45.97651, Alt: 0}, 5500, 1)...), ), ), ) if err := k.WriteIndent(os.Stdout, "", " "); err != nil { log.Fatal(err) }
Output: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Placemark> <LineString> <coordinates>7.658320000000001,46.02591734062657 7.662139516168806,46.02584604997079 7.665947990217271,46.02563238410356 7.669734412203183,46.02527696072462 7.6734878364438375,46.024780807333265 7.677197413404282,46.024145358234385 7.680852421296631,46.02337245035928 7.684442297295684,46.02246431791424 7.68795666827733,46.02142358587259 7.691385380987812,46.02025326232997 7.694718531553885,46.01895672974565 7.697946494246017,46.01753773509616 7.701059949409304,46.016000378970816 7.704049910479545,46.01434910364147 7.706907750004893,46.01258868014259 7.70962522459679,46.010724194399664 7.712194498737385,46.00876103244779 7.71460816737436,46.00670486478404 7.7168592772379965,46.004561629900266 7.7189413468194505,46.00233751704516 7.720848384953432,46.00003894826663 7.722574907953002,45.99767255978747 7.72411595524867,45.995245182769374 7.7254671034887545,45.99276382352193 7.726624479062679,45.99023564321468 7.727584769013816,45.987667937151684 7.728345230313356,45.98506811366952 7.728903697471718,45.982443672719974 7.729258588468999,45.97980218420011 7.729408908990993,45.97715126609252 7.729354254962322,45.97449856247933 7.7290948133732424,45.971851721493394 7.728631361401627,45.96921837327061 7.727965263836586,45.9666061079666 7.727098468814982,45.964022453901094 7.726033501886931,45.961474855892696 7.724773458431034,45.958970653845924 7.723321994444677,45.95651706165177 7.72168331573922,45.95412114646181 7.719862165574228,45.95178980839473 7.717863810769134,45.94952976073298 7.715694026334803,45.947347510665324 7.713359078671356,45.94524934063003 7.710865707382437,45.94324129031095 7.708221105759674,45.941329139337306 7.705432899994549,45.93951839073578 7.702509127178112,45.9378142551811 7.69945821215212,45.93622163608952 7.696288943278037,45.934745115596385 7.693010447193027,45.93338894145731 7.689632162624654,45.932157014909166 7.686163813338272,45.93105287952481 7.682615380293243,45.93007971109241 7.678997073086062,45.92924030854741 7.675319300760165,45.92853708598244 7.671592642063786,45.9279720657571 7.667827815238496,45.92754687272685 7.66403564742224,45.927262729606845 7.660227043751559,45.92712045348346 7.656412956248442,45.92712045348346 7.652604352577761,45.927262729606845 7.648812184761505,45.92754687272685 7.645047357936216,45.9279720657571 7.641320699239836,45.92853708598244 7.637642926913938,45.92924030854741 7.634024619706757,45.93007971109241 7.630476186661729,45.93105287952481 7.627007837375347,45.932157014909166 7.623629552806974,45.93338894145731 7.620351056721964,45.934745115596385 7.617181787847882,45.93622163608952 7.61413087282189,45.9378142551811 7.611207100005451,45.93951839073578 7.608418894240327,45.941329139337306 7.605774292617563,45.94324129031095 7.603280921328645,45.94524934063003 7.600945973665198,45.947347510665324 7.598776189230867,45.94952976073298 7.596777834425772,45.95178980839473 7.59495668426078,45.95412114646181 7.593318005555323,45.95651706165177 7.591866541568967,45.958970653845924 7.590606498113069,45.961474855892696 7.589541531185019,45.964022453901094 7.588674736163415,45.9666061079666 7.588008638598374,45.96921837327061 7.587545186626759,45.971851721493394 7.587285745037679,45.97449856247933 7.5872310910090075,45.97715126609252 7.587381411531002,45.97980218420011 7.587736302528283,45.982443672719974 7.5882947696866445,45.98506811366952 7.589055230986185,45.987667937151684 7.590015520937322,45.99023564321468 7.591172896511246,45.99276382352193 7.592524044751331,45.995245182769374 7.594065092046999,45.99767255978747 7.5957916150465685,46.00003894826663 7.597698653180551,46.00233751704516 7.599780722762004,46.004561629900266 7.6020318326256415,46.00670486478404 7.604445501262616,46.00876103244779 7.607014775403211,46.010724194399664 7.6097322499951074,46.01258868014259 7.612590089520457,46.01434910364147 7.6155800505906965,46.016000378970816 7.618693505753984,46.01753773509616 7.621921468446115,46.01895672974565 7.625254619012189,46.02025326232997 7.628683331722671,46.02142358587259 7.632197702704317,46.02246431791424 7.63578757870337,46.02337245035928 7.63944258659572,46.024145358234385 7.643152163556164,46.024780807333265 7.646905587796819,46.02527696072462 7.65069200978273,46.02563238410356 7.654500483831195,46.02584604997079 7.658320000000001,46.02591734062657</coordinates> </LineString> </Placemark> </kml>
func (T) HaversineDistance ¶ added in v1.1.0
HaversineDistance returns the great circle distance beween c1 and c2 using the Haversine formula. Altitude is ignored.
Click to show internal directories.
Click to hide internal directories.