Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "pyproj in functional component" in Python

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'pyproj' in functional components in Python. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

'PARAMETER["longitude_of_center",21.5],'
                     'PARAMETER["latitude_of_center",8.5],UNIT["Meter",1.0]]')
        aeqd_sr = osr.SpatialReference()
        aeqd_sr.ImportFromWkt(aeqd_proj)
        p_grid = pyproj.Proj(aeqd_sr.ExportToProj4())
        p_geo = pyproj.Proj(geo_sr.ExportToProj4())
    
        # test locations in Africa
        points = [(-31.627336, 30.306273),
                  (-14.589038, -43.880131),
                  (79.423313, -35.261658),
                  (23.456413, 10.457987)]
    
        for i, pt in enumerate(points):
            # from lat/lon to aeqd
            aeqd_x, aeqd_y = pyproj.transform(p_geo, p_grid, pt[0], pt[1])
            # from aeqd to lat/lon
            lon, lat = pyproj.transform(p_grid, p_geo, aeqd_x, aeqd_y)
            # print info
    
            print("testing location {}:".format(i))
            _info = "   ({:f},{:f}) -> ({:f},{:f}) -> ({:f},{:f})"
            print(_info.format(pt[0], pt[1], aeqd_x, aeqd_y, lon, lat))
            print("    difference: ({:f},{:f})".format(lon - pt[0], lat - pt[1]))
            nptest.assert_allclose(pt[0], lon)
            nptest.assert_allclose(pt[1], lat)
def test_geometry_area_perimeter__linestring():
    geod = Geod(ellps="WGS84")
    assert_almost_equal(
        geod.geometry_area_perimeter(LineString([Point(1, 2), Point(3, 4)])),
        (0.0, 627176.7944251911),
        decimal=2,
    )
def test_geometry_area_perimeter__linestring__radians():
    geod = Geod(ellps="WGS84")
    assert_almost_equal(
        geod.geometry_area_perimeter(
            LineString(
                [
                    Point(math.radians(1), math.radians(2)),
                    Point(math.radians(3), math.radians(4)),
                ]
            ),
            radians=True,
        ),
        (0.0, 627176.7944251911),
        decimal=2,
    )
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]
def test_is_geocentric__bound():
    with pytest.warns(FutureWarning):
        ccs = CRS("+init=epsg:4328 +towgs84=0,0,0")
    assert ccs.is_geocentric
assert crs.to_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[")
def test_to_cf_transverse_mercator():
    crs = CRS(
        proj="tmerc",
        lat_0=0,
        lon_0=15,
        k=0.9996,
        x_0=2520000,
        y_0=0,
        ellps="intl",
        units="m",
        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",
def test_init_from_wkt_invalid():
    with pytest.raises(CRSError):
        CRS("trash-54322")
    with pytest.raises(CRSError):
        CRS("")
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"
    )
def test_transformer__operations():
    transformer = Transformer.from_crs(28356, 7856)
    assert [op.name for op in transformer.operations] == [
        "Inverse of Map Grid of Australia zone 56",
        "GDA94 to GDA2020 (1)",
        "Map Grid of Australia zone 56",
    ]

Is your System Free of Underlying Vulnerabilities?
Find Out Now