Reputation: 13
I am using Cartopy and Metpy to create new graphics. When using Google codelab when ever I try to set an extent with on my maps with:
track_line_gdf = geopandas.read_file('/content/al112017-020_5day_lin.shp')
cone_gdf = geopandas.read_file('/content/al112017-020_5day_lin.shp')
points_gdf = geopandas.read_file('/content/al112017-020_5day_pts.shp')
map_crs = ccrs.LambertConformal(central_latitude=35, central_longitude=100,
standard_parallels=(30, 60))
data_crs = ccrs.PlateCarree()
fig = plt.figure(figsize=(14 , 12))
ax = plt.subplot(1, 1, 1, projection=map_crs)
ax.set_extent([-90,-72, 20, 55]) #Problem line
I get the warning: "Geometry must be a Point or LineString" then my notebook crashes. I have tried changing the values in the ax.set_extent() I still get the same issue of "Geometry must be a Point or LineString" and then my notebook crashes for an "Unknown" reason. Also the data I am using are shape-files for Hurricane Irma. Has anyone seen this issue before? Thank you for the help!
P.S. I currently live in Guam so I might respond at strange times compared to the mainland US. Thank you again for your help!
Upvotes: 0
Views: 804
Reputation: 11
This was happening to me as well on Google Colab, with the same error ending in Point or Linestring. That message seemed to be key. I noticed the regular apt-get to install cartopy didn't seem to be doing anything - as it was already installed, and so I uninstalled and reinstalled it. But, I suspect the only necessary step was what this earlier post found: Geometry must be a Point or LineString error using Cartopy
That is: preface your Cartopy use with:
!apt-get -V -y -qq install python-cartopy python3-cartopy
!pip uninstall shapely -y
!pip install shapely --no-binary shapely
Upvotes: 1