Dear all,
I hope everything is fine.
Reading the forum I found a solution to read and plot over a topographic map *shp files (https://flint.soest.hawaii.edu/t/shapefile-to-gmt-python/834/33).
My code is the same, trying to plot some geological faults.
import geopandas as gpd
shape_file = r'D:\Inves\MT\map_data\Fallas.shp'
gdf = gpd.read_file(shape_file)
gdf['geometry'].head()
region = [-70, -56.99, -23.03, -12.42]
fig = pygmt.Figure()
fig.grdimage(shading=True, **KWARGS)
fig.coast(
region=[-70, -56.99, -23.03, -12.42],
projection="M6i",
water="cornflowerblue",
borders="1/0.5p",
shorelines="1/0.5p",
frame=['a2f2', 'WSne+t"Geological Faults"']
)
gdf.geometry.explode()
linestrings = [geom for geom in gdf.geometry]
for line in linestrings:
x, y = line.coords.xy
fig.plot(x=x, y=y, pen="thin")
However I got the following error:
NotImplementedError: Multi-part geometries do not provide a coordinate sequence
To try to avoid the error I applied the suggested solution on https://stackoverflow.com/questions/69331190/multilinestring-not-working-with-pythons-momepy-gdf-to-nx
Unfortunately I did not make it work, does anyone have an idea what am I doing wrong?, attach are the *shp file, thanks in advance
Faults.zip (918.5 KB)