I have a dataframe with a column of linestrings. I want to convert the linestrings to its corresponding latitude/longitude so that I can plot it with basemap. My code is as follows:
gdf = gpd.read_file('./call2016.shp') #read the data into a variable
streetsaslinestring = gdf.loc[: , "geometry"] #getting the linestring column
Next, I want to convert the data as described as lon/lat.
streetsinlatlong = convert_etrs89_to_lonlat(streetsaslinestring)
streetsinlatlong.to_file('./streetslonglat.shp') #store it as .shp in order to plot it with basemap
m.readshapefile('./streetslonglat', 'streets') #read as shape file
The geometry column looks like this: geometry column
How can I convert the longstring data?
I think you can simply use
Lats, Lons = LineStringObject.coords.xy
It will return the latitude and longitude array separately.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.