Exemplo n.º 1
0
def test_from_esri_wkt():
    projection_string = (
        'PROJCS["USA_Contiguous_Albers_Equal_Area_Conic_USGS_version",'
        'GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",'
        'SPHEROID["GRS_1980",6378137.0,298.257222101]],'
        'PRIMEM["Greenwich",0.0],'
        'UNIT["Degree",0.0174532925199433]],'
        'PROJECTION["Albers"],'
        'PARAMETER["false_easting",0.0],'
        'PARAMETER["false_northing",0.0],'
        'PARAMETER["central_meridian",-96.0],'
        'PARAMETER["standard_parallel_1",29.5],'
        'PARAMETER["standard_parallel_2",45.5],'
        'PARAMETER["latitude_of_origin",23.0],'
        'UNIT["Meter",1.0],'
        'VERTCS["NAVD_1988",'
        'VDATUM["North_American_Vertical_Datum_1988"],'
        'PARAMETER["Vertical_Shift",0.0],'
        'PARAMETER["Direction",1.0],UNIT["Centimeter",0.01]]]'
    )
    proj_crs_str = CRS.from_string(projection_string)
    proj_crs_wkt = CRS(projection_string)
    assert proj_crs_str.to_proj4() == proj_crs_wkt.to_proj4()
    assert proj_crs_str.to_proj4(4) == (
        "+proj=aea +lat_0=23 +lon_0=-96 +lat_1=29.5 "
        "+lat_2=45.5 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +type=crs"
    )
Exemplo n.º 2
0
def test_crs_OSR_equivalence():
    crs1 = CRS.from_string("+proj=longlat +datum=WGS84 +no_defs")
    crs2 = CRS.from_string("+proj=latlong +datum=WGS84 +no_defs")
    crs3 = CRS({"init": "EPSG:4326"})
    assert crs1 == crs2
    # these are not equivalent in proj.4 now as one uses degrees and the othe radians
    assert crs1 == crs3
Exemplo n.º 3
0
def test_from_epsg():
    proj = CRS.from_epsg(4326)
    assert proj.to_epsg() == 4326

    # Test with invalid EPSG code
    with pytest.raises(CRSError):
        assert CRS.from_epsg(0)
Exemplo n.º 4
0
def test_to_cf_transverse_mercator():
    crs = CRS(
        init="epsg:3004", towgs84="-122.74,-34.27,-22.83,-1.884,-3.400,-3.030,-15.62"
    )
    with pytest.warns(UserWarning):
        cf_dict = crs.to_cf(errcheck=True)
    towgs84_test = [-122.74, -34.27, -22.83, -1.884, -3.4, -3.03, -15.62]
    assert cf_dict.pop("crs_wkt").startswith("BOUNDCRS[")
    assert cf_dict == {
        "grid_mapping_name": "transverse_mercator",
        "latitude_of_projection_origin": 0,
        "longitude_of_central_meridian": 15,
        "fase_easting": 2520000,
        "fase_northing": 0,
        "reference_ellipsoid_name": "intl",
        "towgs84": towgs84_test,
        "unit": "m",
    }
    assert crs.to_proj4_dict() == {
        "proj": "tmerc",
        "lat_0": 0,
        "lon_0": 15,
        "k": 0.9996,
        "x_0": 2520000,
        "y_0": 0,
        "ellps": "intl",
        "towgs84": towgs84_test,
        "units": "m",
        "no_defs": None,
        "type": "crs",
    }
Exemplo n.º 5
0
def test_from_epsg_string():
    proj = CRS.from_string("epsg:4326")
    assert proj.to_epsg() == 4326

    # Test with invalid EPSG code
    with pytest.raises(ValueError):
        assert CRS.from_string("epsg:xyz")
Exemplo n.º 6
0
def test_sub_crs():
    crs = CRS.from_epsg(5972)
    sub_crs_list = crs.sub_crs_list
    assert len(sub_crs_list) == 2
    assert sub_crs_list[0] == CRS.from_epsg(25832)
    assert sub_crs_list[1] == CRS.from_epsg(5941)
    assert crs.is_projected
    assert not crs.is_geographic
Exemplo n.º 7
0
def test_from_proj4_json():
    json_str = '{"proj": "longlat", "ellps": "WGS84", "datum": "WGS84"}'
    proj = CRS.from_string(json_str)
    assert proj.to_proj4(4) == "+proj=longlat +datum=WGS84 +no_defs +type=crs"
    assert proj.to_proj4(5) == "+proj=longlat +datum=WGS84 +no_defs +type=crs"
    # Test with invalid JSON code
    with pytest.raises(CRSError):
        assert CRS.from_string("{foo: bar}")
Exemplo n.º 8
0
def test_oblique_mercator():
    crs = CRS.from_cf(
        dict(
            grid_mapping_name="oblique_mercator",
            azimuth_of_central_line=0.35,
            latitude_of_projection_origin=10,
            longitude_of_projection_origin=15,
            reference_ellipsoid_name="WGS84",
            false_easting=0.0,
            false_northing=0.0,
        )
    )
    cf_dict = crs.to_cf()
    assert cf_dict.pop("crs_wkt").startswith("PROJCRS[")
    assert cf_dict == {
        "grid_mapping_name": "oblique_mercator",
        "latitude_of_projection_origin": 10,
        "longitude_of_projection_origin": 15,
        "azimuth_of_central_line": 0.35,
        "fase_easting": 0,
        "fase_northing": 0,
        "reference_ellipsoid_name": "WGS84",
        "unit": "m",
    }
    assert crs.to_proj4_dict() == {
        "proj": "omerc",
        "lat_0": 10,
        "lonc": 15,
        "alpha": 0.35,
        "gamma": 0.35,
        "k": 1,
        "x_0": 0,
        "y_0": 0,
        "ellps": "WGS84",
        "units": "m",
        "no_defs": None,
        "type": "crs",
    }
    # test CRS with input as lon_0 from the user
    lon0crs_cf = CRS(
        {
            "proj": "omerc",
            "lat_0": 10,
            "lon_0": 15,
            "alpha": 0.35,
            "gamma": 0.35,
            "k": 1,
            "x_0": 0,
            "y_0": 0,
            "ellps": "WGS84",
            "units": "m",
            "no_defs": None,
            "type": "crs",
        }
    ).to_cf()
    assert lon0crs_cf.pop("crs_wkt").startswith("PROJCRS[")
    assert lon0crs_cf == cf_dict
Exemplo n.º 9
0
def test_from_string():
    wgs84_crs = CRS.from_string("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
    assert wgs84_crs.to_proj4() == "+proj=longlat +datum=WGS84 +no_defs +type=crs"
    # Make sure this doesn't get handled using the from_epsg() even though 'epsg' is in the string
    epsg_init_crs = CRS.from_string("+init=epsg:26911 +units=m +no_defs=True")
    assert (
        epsg_init_crs.to_proj4()
        == "+proj=utm +zone=11 +datum=NAD83 +units=m +no_defs +type=crs"
    )
Exemplo n.º 10
0
def test_is_projected():
    assert CRS({"init": "EPSG:3857"}).is_projected is True

    lcc_crs = CRS.from_string(
        "+lon_0=-95 +ellps=GRS80 +y_0=0 +no_defs=True +proj=lcc +x_0=0 +units=m +lat_2=77 +lat_1=49 +lat_0=0"
    )
    assert CRS.from_user_input(lcc_crs).is_projected is True

    wgs84_crs = CRS.from_string("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
    assert CRS.from_user_input(wgs84_crs).is_projected is False
Exemplo n.º 11
0
def test_cf_from_invalid():
    with pytest.raises(CRSError):
        CRS.from_cf(
            dict(
                longitude_of_central_meridian=265.0, latitude_of_projection_origin=25.0
            )
        )

    with pytest.raises(CRSError):
        CRS.from_cf(
            dict(grid_mapping_name="invalid", latitude_of_projection_origin=25.0)
        )
Exemplo n.º 12
0
def test_is_geographic():
    assert CRS({"init": "EPSG:4326"}).is_geographic is True
    assert CRS({"init": "EPSG:3857"}).is_geographic is False

    wgs84_crs = CRS.from_string("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
    assert wgs84_crs.is_geographic is True

    nad27_crs = CRS.from_string("+proj=longlat +ellps=clrk66 +datum=NAD27 +no_defs")
    assert nad27_crs.is_geographic is True

    lcc_crs = CRS.from_string(
        "+lon_0=-95 +ellps=GRS80 +y_0=0 +no_defs=True +proj=lcc +x_0=0 +units=m +lat_2=77 +lat_1=49 +lat_0=0"
    )
    assert lcc_crs.is_geographic is False
Exemplo n.º 13
0
def test_bare_parameters():
    """ Make sure that bare parameters (e.g., no_defs) are handled properly,
    even if they come in with key=True.  This covers interaction with pyproj,
    which makes presents bare parameters as key=<bool>."""

    # Example produced by pyproj
    proj = CRS.from_string(
        "+proj=lcc +lon_0=-95 +ellps=GRS80 +y_0=0 +no_defs=True +x_0=0 +units=m +lat_2=77 +lat_1=49 +lat_0=0"
    )
    assert "+no_defs" in proj.to_proj4(4)

    # TODO: THIS DOES NOT WORK
    proj = CRS.from_string(
        "+lon_0=-95 +ellps=GRS80 +proj=lcc +y_0=0 +no_defs=False +x_0=0 +units=m +lat_2=77 +lat_1=49 +lat_0=0"
    )
Exemplo n.º 14
0
def test_coordinate_system():
    crs = CRS.from_epsg(26915)
    assert repr(crs.coordinate_system).startswith("CS[Cartesian")
    assert crs.coordinate_system.name == "cartesian"
    assert crs.coordinate_system.name == str(crs.coordinate_system)
    assert crs.coordinate_system.axis_list == crs.axis_info
    assert len(crs.coordinate_system.axis_list) == 2
Exemplo n.º 15
0
def test_coordinate_operation():
    crs = CRS.from_epsg(26915)
    assert repr(crs.coordinate_operation).startswith('CONVERSION["UTM zone 15N"')
    assert crs.coordinate_operation.method_name == "Transverse Mercator"
    assert crs.coordinate_operation.name == str(crs.coordinate_operation)
    assert crs.coordinate_operation.method_auth_name == "EPSG"
    assert crs.coordinate_operation.method_code == "9807"
    assert crs.coordinate_operation.is_instantiable == 1
    assert crs.coordinate_operation.has_ballpark_transformation == 0
    assert crs.coordinate_operation.accuracy == -1.0
    assert repr(crs.coordinate_operation.params) == (
        "[Param(name=Latitude of natural origin, auth_name=EPSG, code=8801, "
        "value=0.0, unit_name=degree, unit_auth_name=EPSG, "
        "unit_code=9102, unit_category=angular), "
        "Param(name=Longitude of natural origin, auth_name=EPSG, code=8802, "
        "value=-93.0, unit_name=degree, unit_auth_name=EPSG, "
        "unit_code=9102, unit_category=angular), "
        "Param(name=Scale factor at natural origin, auth_name=EPSG, code=8805, "
        "value=0.9996, unit_name=unity, unit_auth_name=EPSG, "
        "unit_code=9201, unit_category=scale), "
        "Param(name=False easting, auth_name=EPSG, code=8806, value=500000.0, "
        "unit_name=metre, unit_auth_name=EPSG, unit_code=9001, unit_category=linear), "
        "Param(name=False northing, auth_name=EPSG, code=8807, value=0.0, "
        "unit_name=metre, unit_auth_name=EPSG, unit_code=9001, unit_category=linear)]"
    )
    assert crs.coordinate_operation.grids == []
Exemplo n.º 16
0
def test_from_cf_transverse_mercator():
    towgs84_test = (-122.74, -34.27, -22.83, -1.884, -3.4, -3.03, -15.62)
    crs = CRS.from_cf(
        {
            "grid_mapping_name": "transverse_mercator",
            "latitude_of_projection_origin": 0,
            "longitude_of_central_meridian": 15,
            "fase_easting": 2520000,
            "fase_northing": 0,
            "reference_ellipsoid_name": "intl",
            "towgs84": towgs84_test,
            "unit": "m",
        }
    )
    with pytest.warns(UserWarning):
        cf_dict = crs.to_cf(errcheck=True)
    assert len(cf_dict) == 9
    assert cf_dict["crs_wkt"].startswith("BOUNDCRS[")
    assert cf_dict["grid_mapping_name"] == "transverse_mercator"
    assert cf_dict["latitude_of_projection_origin"] == 0
    assert cf_dict["longitude_of_central_meridian"] == 15
    assert cf_dict["fase_easting"] == 2520000
    assert cf_dict["fase_northing"] == 0
    assert cf_dict["reference_ellipsoid_name"] == "intl"
    assert cf_dict["unit"] == "m"
    assert_almost_equal(cf_dict["towgs84"], list(towgs84_test))
Exemplo n.º 17
0
def test_datum():
    datum = CRS.from_epsg(4326).datum
    assert repr(datum).startswith('DATUM["World Geodetic System 1984"')
    assert "\n" in repr(datum)
    assert datum.to_wkt().startswith('DATUM["World Geodetic System 1984"')
    assert datum == datum
    assert datum.is_exact_same(datum)
Exemplo n.º 18
0
def test_is_same_crs():
    crs1 = CRS({"init": "EPSG:4326"})
    crs2 = CRS({"init": "EPSG:3857"})

    assert crs1 == crs1
    assert crs1 != crs2

    wgs84_crs = CRS.from_string("+proj=longlat +ellps=WGS84 +datum=WGS84")
    assert crs1 == wgs84_crs

    # Make sure that same projection with different parameter are not equal
    lcc_crs1 = CRS.from_string(
        "+lon_0=-95 +ellps=GRS80 +y_0=0 +no_defs=True +proj=lcc +x_0=0 +units=m +lat_2=77 +lat_1=49 +lat_0=0"
    )
    lcc_crs2 = CRS.from_string(
        "+lon_0=-95 +ellps=GRS80 +y_0=0 +no_defs=True +proj=lcc +x_0=0 +units=m +lat_2=77 +lat_1=45 +lat_0=0"
    )
    assert lcc_crs1 != lcc_crs2
Exemplo n.º 19
0
def test_cf_from_latlon__named():
    crs = CRS.from_cf(dict(spatial_ref="epsg:4326"))
    with pytest.warns(UserWarning):
        cf_dict = crs.to_cf(errcheck=True)
    assert cf_dict.pop("crs_wkt").startswith("GEOGCRS[")
    assert cf_dict == {
        "geographic_crs_name": "WGS 84",
        "grid_mapping_name": "latitude_longitude",
        "horizontal_datum_name": "WGS84",
    }
Exemplo n.º 20
0
def test_cf_from_utm():
    crs = CRS.from_cf(dict(crs_wkt="epsg:32615"))
    with pytest.warns(UserWarning):
        cf_dict = crs.to_cf(errcheck=True)
    assert cf_dict.pop("crs_wkt").startswith("PROJCRS[")
    assert cf_dict == {
        "projected_crs_name": "WGS 84 / UTM zone 15N",
        "grid_mapping_name": "unknown",
        "horizontal_datum_name": "WGS84",
        "unit": "m",
    }
Exemplo n.º 21
0
def test_coordinate_system_geog():
    crs = CRS.from_epsg(4326)
    assert repr(crs.coordinate_system).startswith("CS[ellipsoidal")
    assert crs.coordinate_system.name == "ellipsoidal"
    assert crs.coordinate_system.name == str(crs.coordinate_system)
    assert crs.coordinate_system.axis_list == crs.axis_info
    assert repr(crs.coordinate_system.axis_list) == (
        "[Axis(name=Geodetic latitude, abbrev=Lat, direction=north, "
        "unit_auth_code=EPSG, unit_code=9122, unit_name=degree), "
        "Axis(name=Geodetic longitude, abbrev=Lon, direction=east, "
        "unit_auth_code=EPSG, unit_code=9122, unit_name=degree)]"
    )
Exemplo n.º 22
0
def test_empty_json():
    with pytest.raises(CRSError):
        CRS.from_string("{}")
    with pytest.raises(CRSError):
        CRS.from_string("[]")
    with pytest.raises(CRSError):
        CRS.from_string("")
Exemplo n.º 23
0
def test_cf_from_latlon():
    crs = CRS.from_cf(
        dict(
            grid_mapping_name="latitude_longitude",
            semi_major_axis=6378137.0,
            inverse_flattening=298.257223,
        )
    )
    with pytest.warns(UserWarning):
        cf_dict = crs.to_cf(errcheck=True)
    assert len(cf_dict) == 4
    assert cf_dict["crs_wkt"].startswith("GEOGCRS[")
    assert cf_dict["grid_mapping_name"] == "latitude_longitude"
    assert cf_dict["semi_major_axis"] == 6378137.0
    assert cf_dict["inverse_flattening"] == 298.257223
Exemplo n.º 24
0
def test_cf_rotated_latlon__grid():
    crs = CRS.from_cf(
        dict(
            grid_mapping_name="rotated_latitude_longitude",
            grid_north_pole_latitude=32.5,
            grid_north_pole_longitude=170.0,
            north_pole_grid_longitude=0,
        )
    )
    assert crs.to_proj4_dict() == {
        "proj": "ob_tran",
        "o_proj": "latlon",
        "o_lat_p": 32.5,
        "o_lon_p": 170.0,
        "lon_0": 0,
        "type": "crs",
    }
Exemplo n.º 25
0
def test_cf_rotated_latlon():
    crs = CRS.from_cf(
        dict(
            grid_mapping_name="rotated_latitude_longitude",
            grid_north_pole_latitude=32.5,
            grid_north_pole_longitude=170.0,
        )
    )
    assert crs.to_proj4_dict() == {
        "proj": "ob_tran",
        "o_proj": "latlon",
        "o_lat_p": 32.5,
        "o_lon_p": 170.0,
        "type": "crs",
    }
    cf_dict = crs.to_cf()
    assert cf_dict.pop("crs_wkt").startswith("PROJCRS[")
    assert cf_dict == dict(
        grid_mapping_name="rotated_latitude_longitude",
        grid_north_pole_latitude=32.5,
        grid_north_pole_longitude=170.0,
    )
Exemplo n.º 26
0
def test_cf_lambert_conformal_conic():
    crs = CRS.from_cf(
        dict(
            grid_mapping_name="lambert_conformal_conic",
            standard_parallel=25.0,
            longitude_of_central_meridian=265.0,
            latitude_of_projection_origin=25.0,
        )
    )
    with pytest.warns(UserWarning):
        cf_dict = crs.to_cf(errcheck=True)
    assert cf_dict.pop("crs_wkt").startswith("PROJCRS[")
    assert cf_dict == {
        "grid_mapping_name": "lambert_conformal_conic",
        "longitude_of_central_meridian": 265,
        "scale_factor_at_projection_origin": 1,
        "standard_parallel": 25,
        "latitude_of_projection_origin": 25,
        "fase_easting": 0,
        "fase_northing": 0,
        "horizontal_datum_name": "WGS84",
        "unit": "m",
    }
Exemplo n.º 27
0
def test_cf_lambert_conformal_conic_2sp():
    crs = CRS.from_cf(
        dict(
            grid_mapping_name="lambert_conformal_conic",
            standard_parallel=[25.0, 30.0],
            longitude_of_central_meridian=265.0,
            latitude_of_projection_origin=25.0,
        )
    )
    with pytest.warns(UserWarning):
        cf_dict = crs.to_cf(errcheck=True)
    assert cf_dict.pop("crs_wkt").startswith("PROJCRS[")
    assert cf_dict == {
        "grid_mapping_name": "lambert_conformal_conic",
        "longitude_of_central_meridian": 265,
        "standard_parallel": [25, 30],
        "latitude_of_projection_origin": 25,
        "fase_easting": 0,
        "fase_northing": 0,
        "horizontal_datum_name": "WGS84",
        "unit": "m",
    }
    proj_dict = crs.to_proj4_dict()
    assert proj_dict == {
        "proj": "lcc",
        "lat_1": 25,
        "lat_2": 30,
        "lat_0": 25,
        "lon_0": 265,
        "x_0": 0,
        "y_0": 0,
        "datum": "WGS84",
        "units": "m",
        "no_defs": None,
        "type": "crs",
    }
Exemplo n.º 28
0
def test_source_crs__missing():
    assert CRS("epsg:4326").source_crs is None
Exemplo n.º 29
0
def test_axis_info_bound():
    crs = CRS(
        "+proj=tmerc +lat_0=0 +lon_0=15 +k=0.9996 +x_0=2520000 +y_0=0 "
        "+ellps=intl +towgs84=-122.74,-34.27,-22.83,-1.884,-3.400,-3.030,-15.62"
    )
    assert [axis.direction for axis in crs.axis_info] == ["east", "north"]
Exemplo n.º 30
0
def test_target_crs__bound():
    with pytest.warns(FutureWarning):
        assert CRS(
            "+init=epsg:4328 +towgs84=0,0,0").target_crs.name == "WGS 84"
Exemplo n.º 31
0
def test_to_dict_from_dict():
    cc = CRS.from_epsg(4326)
    with pytest.warns(UserWarning):
        assert CRS.from_dict(cc.to_dict()).name == "unknown"
Exemplo n.º 32
0
def test_initialize_projparams_with_kwargs():
    crs_mixed_args = CRS("+proj=utm +zone=10", ellps="WGS84")
    crs_positional = CRS("+proj=utm +zone=10 +ellps=WGS84")
    assert crs_mixed_args.is_exact_same(crs_positional)
Exemplo n.º 33
0
def test_from_authority__ignf():
    cc = CRS.from_authority("IGNF", "ETRS89UTM28")
    assert cc.to_authority() == ("IGNF", "ETRS89UTM28")
    assert cc.to_authority("EPSG") == ("EPSG", "25828")
    assert cc.to_epsg() == 25828
Exemplo n.º 34
0
def test_coordinate_operation__missing():
    crs = CRS.from_epsg(4326)
    assert crs.coordinate_operation is None
Exemplo n.º 35
0
def test_is_exact_same_different_type():
    assert not CRS("epsg:4326").is_exact_same(None)
Exemplo n.º 36
0
def test_is_geocentric__bound():
    with pytest.warns(FutureWarning):
        ccs = CRS("+init=epsg:4328 +towgs84=0,0,0")
    assert ccs.is_geocentric
Exemplo n.º 37
0
def test_is_geocentric():
    ccs = CRS.from_epsg(4328)
    assert ccs.is_geocentric
Exemplo n.º 38
0
def test_is_vertical():
    cc = CRS.from_epsg(5717)
    assert cc.is_vertical
Exemplo n.º 39
0
def test_coordinate_operation_towgs84_three():
    crs = CRS("+proj=latlong +ellps=GRS80 +towgs84=-199.87,74.79,246.62")
    assert crs.coordinate_operation.towgs84 == [-199.87, 74.79, 246.62]
Exemplo n.º 40
0
def test_operations_missing():
    cc = CRS(("IGNF", "ETRS89UTM28"))
    assert cc.coordinate_operation.operations == ()
Exemplo n.º 41
0
def test_crs__scope__remarks__missing():
    cc = CRS(4326)
    assert cc.scope is None
    assert cc.remarks is None
Exemplo n.º 42
0
def test_crs_hash_unequal():
    """hashes of non-equivalent CRS are not equal"""
    assert hash(CRS.from_epsg(3857)) != hash(CRS.from_epsg(4326))
Exemplo n.º 43
0
def test_crs_hash():
    """hashes of equivalent CRS are equal"""
    assert hash(CRS.from_epsg(3857)) == hash(CRS.from_epsg(3857))
Exemplo n.º 44
0
def test_equals_different_type():
    assert CRS("epsg:4326") != ""
Exemplo n.º 45
0
def test_ignf_authority_repr():
    assert repr(CRS.from_authority(
        "IGNF", "ETRS89UTM28")).startswith("<Projected CRS: IGNF:ETRS89UTM28>")
Exemplo n.º 46
0
def test_target_crs__missing():
    assert CRS("epsg:4326").target_crs is None
Exemplo n.º 47
0
def test_compound_crs_urn_init():
    crs = CRS("urn:ogc:def:crs,crs:EPSG::2393,crs:EPSG::5717")
    assert crs.name == "KKJ / Finland Uniform Coordinate System + N60 height"
Exemplo n.º 48
0
def test_to_wkt_enum__invalid():
    crs = CRS.from_epsg(4326)
    with pytest.raises(ValueError, match="Invalid value"):
        crs.to_wkt("WKT_INVALID")
Exemplo n.º 49
0
def test_srs__no_plus():
    assert (CRS("proj=longlat datum=WGS84 no_defs").srs ==
            "proj=longlat datum=WGS84 no_defs type=crs")
Exemplo n.º 50
0
def test_whitepace_between_equals():
    crs = CRS(
        "+proj =lcc +lat_1= 30.0 +lat_2= 35.0 +lat_0=30.0 +lon_0=87.0 +x_0=0 +y_0=0"
    )
    assert crs.srs == ("+proj=lcc +lat_1=30.0 +lat_2=35.0 +lat_0=30.0 "
                       "+lon_0=87.0 +x_0=0 +y_0=0 +type=crs")
Exemplo n.º 51
0
 def to_wkt(self):
     return CRS.from_epsg(4326).to_wkt()
Exemplo n.º 52
0
def test_to_string__auth():
    assert CRS(("IGNF", "ETRS89UTM28")).to_string() == "IGNF:ETRS89UTM28"
Exemplo n.º 53
0
def test_to_proj4_enum():
    crs = CRS.from_epsg(4326)
    with pytest.warns(UserWarning):
        assert crs.to_proj4(4) == crs.to_proj4(ProjVersion.PROJ_4)
        assert crs.to_proj4(5) == crs.to_proj4(ProjVersion.PROJ_5)
Exemplo n.º 54
0
def test_sub_crs__none():
    assert CRS.from_epsg(4326).sub_crs_list == []
Exemplo n.º 55
0
def test_to_wkt_enum(wkt_version_str, wkt_version_enum):
    crs = CRS.from_epsg(4326)
    assert crs.to_wkt(wkt_version_str) == crs.to_wkt(wkt_version_enum)
Exemplo n.º 56
0
def test_to_string__no_auth():
    proj = CRS("+proj=latlong +ellps=GRS80 +towgs84=-199.87,74.79,246.62")
    assert (proj.to_string(
    ) == "+proj=latlong +ellps=GRS80 +towgs84=-199.87,74.79,246.62 +type=crs")
Exemplo n.º 57
0
def test_coordinate_operation_towgs84_missing():
    crs = CRS("epsg:3004")
    assert crs.coordinate_operation.towgs84 == []
Exemplo n.º 58
0
def test_crs_is_exact_same__non_crs_input():
    assert CRS(4326).is_exact_same("epsg:4326")
    with pytest.warns(FutureWarning):
        assert not CRS(4326).is_exact_same("+init=epsg:4326")
Exemplo n.º 59
0
def test_bound_crs_is_geographic():
    assert CRS("proj=longlat datum=WGS84 no_defs ellps=WGS84 towgs84=0,0,0"
               ).is_geographic
Exemplo n.º 60
0
def test_source_crs__bound():
    with pytest.warns(FutureWarning):
        assert CRS(
            "+init=epsg:4328 +towgs84=0,0,0").source_crs.name == "unknown"