def compute_tmerc_parameters(coordinates_file: Path, terrain: str) -> TransverseMercator: data = json.loads(coordinates_file.read_text()) airbases = load_coordinate_data(data) wgs84 = CRS("WGS84") # Creates a transformer with 0 for the false easting and northing, but otherwise has # the correct parameters. We'll use this to transform the zero point from the # mission to calculate the error from the actual zero point to determine the correct # false easting and northing. bad = TransverseMercator( central_meridian=CENTRAL_MERIDIANS[terrain], false_easting=0, false_northing=0, scale_factor=0.9996, ).to_crs() zero_finder = Transformer.from_crs(wgs84, bad) z, x = zero_finder.transform(airbases["zero"].latitude, airbases["zero"].longitude) parameters = TransverseMercator( central_meridian=CENTRAL_MERIDIANS[terrain], false_easting=-x, false_northing=-z, scale_factor=0.9996, ) if test_parameters(airbases, parameters): sys.exit("Found errors in projection parameters. Quitting.") return parameters
def test_parameters(airbases: Dict[str, Coordinates], parameters: TransverseMercator) -> bool: errors = False wgs84 = CRS("WGS84") crs = parameters.to_crs() lat_lon_to_x_z = Transformer.from_crs(wgs84, crs) x_z_to_lat_lon = Transformer.from_crs(crs, wgs84) for name, coords in airbases.items(): if name == "zero": continue if test_for_errors(name, lat_lon_to_x_z, x_z_to_lat_lon, coords): errors = True return errors
# DO NOT EDIT: # This file is generated by tools/export_map_projection.py. from dcs.terrain.projections import TransverseMercator PARAMETERS = TransverseMercator( central_meridian=39, false_easting=282801.00000003993, false_northing=-3879865.9999999935, scale_factor=0.9996, )
# DO NOT EDIT: # This file is generated by tools/export_map_projection.py. from dcs.terrain.projections import TransverseMercator PARAMETERS = TransverseMercator( central_meridian=3, false_easting=99376.00000000288, false_northing=-5636889.00000001, scale_factor=0.9996, )
# DO NOT EDIT: # This file is generated by tools/export_map_projection.py. from dcs.terrain.projections import TransverseMercator PARAMETERS = TransverseMercator( central_meridian=-117, false_easting=-193996.80999964548, false_northing=-4410028.063999966, scale_factor=0.9996, )
# DO NOT EDIT: # This file is generated by tools/export_map_projection.py. from dcs.terrain.projections import TransverseMercator PARAMETERS = TransverseMercator( central_meridian=147, false_easting=238417.99999989968, false_northing=-1491840.000000048, scale_factor=0.9996, )
# DO NOT EDIT: # This file is generated by tools/export_map_projection.py. from dcs.terrain.projections import TransverseMercator PARAMETERS = TransverseMercator( central_meridian=57, false_easting=75755.99999999645, false_northing=-2894933.0000000377, scale_factor=0.9996, )
# DO NOT EDIT: # This file is generated by tools/export_map_projection.py. from dcs.terrain.projections import TransverseMercator PARAMETERS = TransverseMercator( central_meridian=-3, false_easting=-195526.00000000204, false_northing=-5484812.999999951, scale_factor=0.9996, )
# DO NOT EDIT: # This file is generated by tools/export_map_projection.py. from dcs.terrain.projections import TransverseMercator PARAMETERS = TransverseMercator( central_meridian=33, false_easting=-99516.9999999732, false_northing=-4998114.999999984, scale_factor=0.9996, )