示例#1
0
def test_make_projected_crs(tmp_path):
    aeaop = AlbersEqualAreaConversion(0, 0)
    pc = ProjectedCRS(conversion=aeaop, name="Albers")
    assert pc.name == "Albers"
    assert pc.type_name == "Derived Projected CRS"
    assert pc.coordinate_operation == aeaop
    assert_can_pickle(pc, tmp_path)
示例#2
0
def test_compund_crs(tmp_path):
    vertcrs = VerticalCRS(
        name="NAVD88 height",
        datum="North American Vertical Datum 1988",
        vertical_cs=VerticalCS(),
        geoid_model="GEOID12B",
    )
    projcrs = ProjectedCRS(
        name="NAD83 / Pennsylvania South",
        conversion=LambertConformalConic2SPConversion(
            latitude_false_origin=39.3333333333333,
            longitude_false_origin=-77.75,
            latitude_first_parallel=40.9666666666667,
            latitude_second_parallel=39.9333333333333,
            easting_false_origin=600000,
            northing_false_origin=0,
        ),
        geodetic_crs=GeographicCRS(datum="North American Datum 1983"),
        cartesian_cs=Cartesian2DCS(),
    )
    compcrs = CompoundCRS(name="NAD83 / Pennsylvania South + NAVD88 height",
                          components=[projcrs, vertcrs])
    assert compcrs.name == "NAD83 / Pennsylvania South + NAVD88 height"
    assert compcrs.type_name == "Compound CRS"
    assert compcrs.sub_crs_list[0].type_name == "Derived Projected CRS"
    assert compcrs.sub_crs_list[1].type_name == "Vertical CRS"
    assert_can_pickle(compcrs, tmp_path)
示例#3
0
def test_make_geocentric_crs(tmp_path):
    gc = GeocentricCRS(name="WGS 84")
    assert gc.name == "WGS 84"
    assert gc.is_geocentric
    assert gc.type_name == "Geocentric CRS"
    assert gc.to_authority() == ("EPSG", "4978")
    assert_can_pickle(gc, tmp_path)
示例#4
0
def test_make_derived_geographic_crs(tmp_path):
    conversion = RotatedLatitudeLongitudeConversion(o_lat_p=0, o_lon_p=0)
    dgc = DerivedGeographicCRS(base_crs=GeographicCRS(), conversion=conversion)
    assert dgc.name == "undefined"
    assert dgc.type_name == "Derived Geographic 2D CRS"
    assert dgc.coordinate_operation == conversion
    assert dgc.is_derived
    assert_can_pickle(dgc, tmp_path)
示例#5
0
def test_vertical_crs(tmp_path):
    vc = VerticalCRS(
        name="NAVD88 height",
        datum="North American Vertical Datum 1988",
        geoid_model="GEOID12B",
    )
    assert vc.name == "NAVD88 height"
    assert vc.type_name == "Vertical CRS"
    assert vc.coordinate_system == VerticalCS()
    assert vc.to_json_dict()["geoid_model"]["name"] == "GEOID12B"
    assert_can_pickle(vc, tmp_path)
示例#6
0
def test_bound_crs(tmp_path):
    proj_crs = ProjectedCRS(conversion=UTMConversion(12))
    bound_crs = BoundCRS(
        source_crs=proj_crs,
        target_crs="WGS 84",
        transformation=ToWGS84Transformation(proj_crs.geodetic_crs, 1, 2, 3, 4,
                                             5, 6, 7),
    )
    assert bound_crs.type_name == "Bound CRS"
    assert bound_crs.source_crs.coordinate_operation.name == "UTM zone 12N"
    assert bound_crs.coordinate_operation.towgs84 == [
        1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0
    ]
    assert bound_crs.target_crs.name == "WGS 84"
    assert_can_pickle(bound_crs, tmp_path)
示例#7
0
def test_crs__pickle(tmp_path):
    assert_can_pickle(CRS("epsg:4326"), tmp_path)
示例#8
0
def test_make_geographic_crs(tmp_path):
    gc = GeographicCRS(name="WGS 84")
    assert gc.name == "WGS 84"
    assert gc.type_name == "Geographic 2D CRS"
    assert gc.to_authority() == ("OGC", "CRS84")
    assert_can_pickle(gc, tmp_path)