Пример #1
0
    def test_grs80_to_geographic(self):
        geo1 = Geocentrics(1418595, -689557, -6159338)
        lat_long1 = geo1.make_geographic()
        self.assertEqual(lat_long1, [-75.72836167, -25.92366687, 30.705])

        geo2 = Geocentrics(1425925.3230, -703655.7929, -6156081.8741)
        lat_long2 = geo2.make_geographic()
        self.assertEqual(lat_long2, [-75.61017435, -26.26509986, 40.322])
Пример #2
0
def main():
    parser = argparse.ArgumentParser()

    parser.add_argument('-t', type=str, metavar='transform', dest='transform', required=True,
                    help='Select either to_geographic, or to_geocentric.')

    parser.add_argument('-x', type=float, metavar='x', dest='x', required=True, 
                    help='Enter x coordinate. If Geocentric this should be in metres. If Geographic, this should be in decimal degrees')

    parser.add_argument('-y', type=float, metavar='y', dest='y', required=True, 
                    help='Enter y coordinate. If Geocentric this should be in metres. If Geographic, this should be in decimal degrees')

    parser.add_argument('-z', type=float, metavar='z', dest='z', required=True, 
                    help='Enter z coordinate in metres.')

    parser.add_argument('-e', type=str, metavar='ellipsoid', dest='ellipsoid', required=True,
                    help='Select which ellipsoid your coordinates are in reference to. At the moment we only support either WGS84 or GRS80.')

    args = parser.parse_args()

    transform = args.transform
    ellipsoid = args.ellipsoid
    x         = args.x
    y         = args.y
    z         = args.z

    if transform == 'to_geographic':
        geo = Geocentrics(x, y, z, ellipsoid=ellipsoid)
        latlongs = geo.make_geographic()
        print("Geographic coordinates ({})".format(ellipsoid))
        print("lat: {0}, lon: {1}, h: {2}".format(latlongs[0], latlongs[1], latlongs[2]))
    elif transform == 'to_geocentric':
        print("coorblimey isn't this clever ... yet.")
Пример #3
0
def main():
    parser = argparse.ArgumentParser()

    parser.add_argument('-t',
                        type=str,
                        metavar='transform',
                        dest='transform',
                        required=True,
                        choices=['to_geographic', 'to_geocentric'],
                        help='Select either to_geographic, or to_geocentric.')

    parser.add_argument(
        '-x',
        type=float,
        metavar='x',
        dest='x',
        required=True,
        help=
        'Enter x coordinate. If Geocentric this should be in metres. If Geographic, this should be in decimal degrees'
    )

    parser.add_argument(
        '-y',
        type=float,
        metavar='y',
        dest='y',
        required=True,
        help=
        'Enter y coordinate. If Geocentric this should be in metres. If Geographic, this should be in decimal degrees'
    )

    parser.add_argument('-z',
                        type=float,
                        metavar='z',
                        dest='z',
                        required=True,
                        help='Enter z coordinate in metres.')

    parser.add_argument(
        '-e',
        type=str,
        metavar='ellipsoid',
        dest='ellipsoid',
        required=True,
        choices=['GRS80', 'WGS84'],
        help=
        'Select which ellipsoid your coordinates are in reference to. At the moment we only support either WGS84 or GRS80.'
    )

    args = parser.parse_args()

    transform = args.transform
    ellipsoid = args.ellipsoid
    x = args.x
    y = args.y
    z = args.z

    if transform == 'to_geographic':
        geo = Geocentrics(x, y, z, ellipsoid=ellipsoid)
        latlongs = geo.make_geographic()
        print("Geographic coordinates ({})".format(ellipsoid))
        print("lat: {0}, lon: {1}, h: {2}".format(latlongs[0], latlongs[1],
                                                  latlongs[2]))
    elif transform == 'to_geocentric':
        print("coorblimey isn't this clever ... yet.")
Пример #4
0
 def test_to_geographic(self):
     geo      = Geocentrics(1418595, -689557, -6159338)
     lat_long = geo.make_geographic()
     self.assertEqual(lat_long, [-75.7283616724, -25.9236668699, 30.705])
Пример #5
0
 def test_wgs84_to_geographic(self):
     geo = Geocentrics(1418595, -689557, -6159338, ellipsoid='WGS84')
     lat_long = geo.make_geographic()
     self.assertEqual(lat_long, [-75.72836167, -25.92366687, 30.705])