Ejemplo n.º 1
0
def test_bound_crs__example():
    proj_crs = ProjectedCRS(
        conversion=TransverseMercatorConversion(
            latitude_natural_origin=0,
            longitude_natural_origin=15,
            false_easting=2520000,
            false_northing=0,
            scale_factor_natural_origin=0.9996,
        ),
        geodetic_crs=GeographicCRS(
            datum=CustomDatum(ellipsoid="International 1909 (Hayford)")
        ),
    )
    bound_crs = BoundCRS(
        source_crs=proj_crs,
        target_crs="WGS 84",
        transformation=ToWGS84Transformation(
            proj_crs.geodetic_crs, -122.74, -34.27, -22.83, -1.884, -3.4, -3.03, -15.62
        ),
    )
    with pytest.warns(UserWarning):
        assert bound_crs.to_dict() == {
            "ellps": "intl",
            "k": 0.9996,
            "lat_0": 0,
            "lon_0": 15,
            "no_defs": None,
            "proj": "tmerc",
            "towgs84": [-122.74, -34.27, -22.83, -1.884, -3.4, -3.03, -15.62],
            "type": "crs",
            "units": "m",
            "x_0": 2520000,
            "y_0": 0,
        }
def test_transverse_mercator_operation__defaults():
    aeaop = TransverseMercatorConversion()
    assert aeaop.name == "unknown"
    assert aeaop.method_name == "Transverse Mercator"
    assert _to_dict(aeaop) == {
        "Latitude of natural origin": 0.0,
        "Longitude of natural origin": 0.0,
        "False easting": 0.0,
        "False northing": 0.0,
        "Scale factor at natural origin": 1.0,
    }
Ejemplo n.º 3
0
def _transverse_mercator(cf_params):
    """
    http://cfconventions.org/cf-conventions/cf-conventions.html#_transverse_mercator
    """
    return TransverseMercatorConversion(
        latitude_natural_origin=cf_params.get("latitude_of_projection_origin", 0.0),
        longitude_natural_origin=cf_params.get("longitude_of_central_meridian", 0.0),
        false_easting=cf_params.get("false_easting", 0.0),
        false_northing=cf_params.get("false_northing", 0.0),
        scale_factor_natural_origin=cf_params.get(
            "scale_factor_at_central_meridian", 1.0
        ),
    )
def test_transverse_mercator_operation():
    aeaop = TransverseMercatorConversion(
        latitude_natural_origin=1,
        longitude_natural_origin=2,
        false_easting=3,
        false_northing=4,
        scale_factor_natural_origin=0.5,
    )
    assert aeaop.name == "unknown"
    assert aeaop.method_name == "Transverse Mercator"
    assert _to_dict(aeaop) == {
        "Latitude of natural origin": 1.0,
        "Longitude of natural origin": 2.0,
        "False easting": 3.0,
        "False northing": 4.0,
        "Scale factor at natural origin": 0.5,
    }