I have a few shapely.linestring
objects that are read into geopandas with the call:
piped = gpd.read_file("Pipes.dbf")
In the geometry column the values are in UTM. I have identified the sector as 44Q and I can use utm
to extract the lat/long for a single value. I'm pretty new to using Geopandas but was hoping there was an .apply
where I could duplicate and convert the linestring objects into a list of tuples and store them in another column.
Example row value: LINESTRING(376753.3276983045 2042051.6105498213, 376764.03744285746 2042051.728052152)
I'd like to have a corresponding column called say lat_long
that contains the same information from the linestring
column but in a the format [(18.465193133286725, 73.83275226395054),(18.465194819587577, 73.83285367143624)]
def utm_to_latlon(vals, utm_lon, utm_lat):
"""Function to convert UTM TO lat long
returns a tuple of latlong
"""
return utm.to_latlon(vals[0], vals[1], zone_number=utm_lon, zone_letter=utm_lat)
Best Answer
You can use this script:
OUTPUT: