On 2013-03-28, at 7:29 AM, KURT PETERS wrote: > If I'm using this SGP4 library: https://pypi.python.org/pypi/sgp4/ > which provides x,y,z of a satellite with respect to the center of > the Earth, what do you think would be the best way to calculate the > distance from the satellite to a lat/long point on the Earth using > MATPLOT library basemaps? > > I suppose using WGS 84, I could do something like: > # setup of basemap ('lcc' = lambert conformal conic). > # use major and minor sphere radii from WGS84 ellipsoid. > m = > Basemap > (llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\ > rsphere=(6378137.00,6356752.3142),\ > resolution='l',area_thresh=1000.,projection='lcc',\ > lat_1=50.,lon_0=-107.,ax=ax) > > x,y = m(lon, lat) > > But how could I get "Z" for a particular coordinate so I could be > this norm calculation? And... would the x,y yielded above be in the > same coordinate frame (ie, from the center of the Earth) as the SGP4 > library in the first place? > > Regards, > Kurt
The x,y you get from Basemap appear to be tailored to the particular projection you are using. If you change the projection, then you will probably get different x,y values for the same (lat,lon). This is very useful for mapping, but it is not what you need. You need convert your position P from geodetic coordinates (lat, lon) (more generally, (lat, lon, elevation)) to geocentric coordinates (x,y,z). Geocentric coordinates are also called Earth-centered-Earth- fixed (ECEF or ECF) coordinates. Here is a link to the formulas you need. Notice that the author uses the terminology Latitude,Longitude,Altitude (LLA) to refer to geodetic coordinates. http://www.satsleuth.com/GPS_ECEF_Datum_transformation.htm This can be difficult to interpret if you are doing it for the first time (and even if you have done it many times before!!). Feel free to email me directly if you have any questions. I would be glad to help. -John ------------------------------------------------------------------------------ Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users