When attempting to use Cartopy to plot rivers, I'm getting a URL error. I'm not even sure the rivers feature will plot what I want...I'm attempting to get the Galveston Ship Channel to show on my map.
Here's the error I get:
C:\ProgramData\Anaconda3\lib\site-packages\cartopy\io\__init__.py:260: DownloadWarning: Downloading: https://naciscdn.org/naturalearth/10m/physical/ne_10m_rivers_lake_centerlines.zipwarnings.warn('Downloading: {}'.format(url), DownloadWarning)
Traceback (most recent call last):File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 1354, in do_openh.request(req.get_method(), req.selector, req.data, headers,File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1255, in requestself._send_request(method, url, body, headers, encode_chunked)File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1301, in _send_requestself.endheaders(body, encode_chunked=encode_chunked)File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1250, in endheadersself._send_output(message_body, encode_chunked=encode_chunked)File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1010, in _send_outputself.send(msg)File "C:\ProgramData\Anaconda3\lib\http\client.py", line 950, in sendself.connect()File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1417, in connectsuper().connect()File "C:\ProgramData\Anaconda3\lib\http\client.py", line 921, in connectself.sock = self._create_connection(File "C:\ProgramData\Anaconda3\lib\socket.py", line 787, in create_connectionfor res in getaddrinfo(host, port, 0, SOCK_STREAM):File "C:\ProgramData\Anaconda3\lib\socket.py", line 918, in getaddrinfofor res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
And here's the code:
import matplotlib.pyplot as plt
import datetime as dt
import cartopy.crs as ccrs
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
import cartopy.feature as cfeature
from metpy.plots import USCOUNTIESship_lon, ship_lat = -94.80234, 29.31221ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_extent([-95.5, -94.1, 28.8, 29.8])
ax.add_feature(USCOUNTIES.with_scale('500k'),facecolor='none', edgecolor='gray',linewidth=0.5)ax.add_feature(cfeature.NaturalEarthFeature('physical', 'land', '10m', edgecolor='black', facecolor='#d4d4d4'))
ax.add_feature(cfeature.NaturalEarthFeature('physical', 'ocean', '10m', facecolor='lightblue'))
ax.add_feature(cfeature.NaturalEarthFeature('physical', 'rivers_lake_centerlines', '10m', facecolor='lightblue'))ax.set_title('Hunter-T Approximate Location at Time of Incident',loc='left',fontsize=10,fontweight='bold')
plt.scatter(ship_lon, ship_lat, marker='*', color='black',s=12, zorder=10)
plt.text(ship_lon, ship_lat+.03, 'Vessel Location', fontsize=5, fontweight='bold',horizontalalignment='center')plt.savefig(fname='vessel_location.png',bbox_inches='tight', dpi=600)
plt.close()
If I leave the rivers line out, this is my output. The marker with the vessel location is actually a ship channel. I'm trying to get that body of water to display. I tried searching for a shapefile, but I'm unsure of what shapefile might plot that feature. Or is there a better way to go about plotting a high-res map of this area?