easyidp.geotools.convert_proj#

easyidp.geotools.convert_proj(shp_dict, crs_origin, crs_target)#

Provide the geo coordinate transfrom based on pyproj package

Parameters:
  • shp_dict (dict) – the output of read_shp() function

  • crs_origin (pyproj object) – the hidden output of read_shp(…, return_proj=True)

  • crs_target (str | pyproj object) –

    Examples:
    crs_target = pyproj.CRS.from_epsg(4326)
    crs_target = r'path/to/{shp_name}.prj'

Example

Data prepare

>>>
>>> import easyidp as idp
>>> test_data = idp.data.TestData()

>>> plot = {'N1W1': np.array([[139.54052962,  35.73475194], [139.54055106,  35.73475596]])}

>>> proj = pyproj.CRS.from_epsg(4326)
>>> proj_to = pyproj.CRS.from_epsg(32654)

Then do the transformation from lon-lat coordainte to WGS 84 / UTM zone 54N (CRS: EPSG:32654)

>>> idp.geotools.convert_proj(plot, proj, proj_to)
{'N1W1': array([[ 368017.75637046, 3955511.0806603 ],
                [ 368019.70199342, 3955511.49771163]])}