Questions tagged [cartopy]

Cartopy is a Python package harnessing the power of matplotlib to deliver informative, precise and striking maps.

Cartopy is a Python package designed to make drawing maps for data analysis easy and enjoyable.

Primarily the non-drawing functionality of cartopy makes use of proj.4, numpy, geos and shapely; with simple and intuitive interfacing to matplotlib for map drawing.

Some of the key features of cartopy are:

  • object oriented projection definitions
  • point, line, polygon and image transformations between projections
  • integration to expose advanced mapping in matplotlib with a simple and intuitive interface
  • work-in-progress mechanisms for accessing specialist data such as those from the “Shuttle - Radar Topography Mission” (SRTM) and the “Global Self-consistent, Hierarchical, High-resolution Shoreline” database (GSHHS).

Licensed under the GNU LGPL3, cartopy's latest documentation can be found at http://scitools.org.uk/cartopy/docs/latest and the source repository at https://github.com/SciTools/cartopy

612 questions
8
votes
2 answers

cartopy set_xlabel set_ylabel (not ticklabels)

When using a cartopy map I cannot add an xlabel or ylabel. Is there a way to do this? I am not looking for ticklabels. import matplotlib.pyplot as plt import cartopy ax =…
mathause
  • 1,243
  • 1
  • 12
  • 22
7
votes
1 answer

Geometry must be a Point or LineString error using Cartopy

I'm trying to run a simple Cartopy example: import cartopy.crs as ccrs import matplotlib.pyplot as plt ax = plt.axes(projection=ccrs.PlateCarree()) ax.coastlines() plt.show() But I'm getting this error: Geometry must be a Point or…
Marc
  • 1,080
  • 2
  • 12
  • 21
7
votes
1 answer

Checking if a geocoordinate point is land or ocean with cartopy?

I want to know given a latitude and longitude if a coordinate is land or sea According to https://gis.stackexchange.com/questions/235133/checking-if-a-geocoordinate-point-is-land-or-ocean from mpl_toolkits.basemap import Basemap bm = Basemap() #…
David Michael Gang
  • 6,179
  • 7
  • 40
  • 87
7
votes
2 answers

cartopy - set_extent() extending requested boundary

i'm new to cartopy and still learning basic features. I tried to plot a specific region however, cartopy extended this region and produced a map going up to approximately 85oN when I requested 80oN. Is there a way I can ensure I only get the region…
Ray Bell
  • 993
  • 2
  • 9
  • 19
7
votes
1 answer

Make colorbar legend in Matplotlib/Cartopy

I've made a geographical heatmap using cartopy and matplotlib, of the number of users of my app, but am having trouble adding a colorbar legend: import cartopy.crs as ccrs import cartopy.io.shapereader as shpreader import matplotlib.pyplot as…
goodcow
  • 3,465
  • 3
  • 28
  • 46
7
votes
1 answer

cartopy: higher resolution for great circle distance line

I am trying to plot a great circle distance between two points. I have found an in the cartopy docs (introductory_examples/01.great_circle.html): import matplotlib.pyplot as plt import cartopy.crs as ccrs ax =…
Kristen
  • 73
  • 4
7
votes
1 answer

Subtitles within Matplotlib legend

I am doing some plotting with matplotlib, and I have a legend which tells the viewer which sensors the points were recorded with. There are multiple sensors of multiple types, and I'd like to have subtitles within the legend to tell the viewer what…
Jabberwock Stomp
  • 183
  • 2
  • 15
7
votes
1 answer

Change map boundary color in Cartopy

I'm plotting a world map in Cartopy and as part of the process I want to color all lines white. I have been able to do so for every element with exception of the map's boundaries. This is the code I'm using: import matplotlib.pyplot as plt import…
wotaskd
  • 855
  • 1
  • 10
  • 15
7
votes
1 answer

How to add custom shapefile to map using cartopy

Using basemap I used to add my custom boundary shapefile like this: map = Basemap(..) map.readshapefile(file.shp, 'attribute', drawbounds=True) How can I do the same using cartopy? I tried…
Mattijn
  • 9,333
  • 11
  • 38
  • 59
7
votes
1 answer

Projection Problems when Displaying an Image on a Map with Cartopy

I have some satellite image data I would like to display using Cartopy. I have successfully followed the image example detailed here. Resulting in this code: import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs fig =…
Julien Chastang
  • 16,970
  • 12
  • 59
  • 88
6
votes
4 answers

how to import conda packages into google colab?

I was able to install packages in google colab with pip, using: !pip install.... but i am not able to install any package from conda-forge. I tried: !conda install -c conda-forge cartopy
6
votes
1 answer

County boarders in Cartopy

How do you plot US county borders in Cartopy? It's very straight forward to plot state and country boundaries ax.add_feature(cfeature.BORDERS.with_scale('50m')) ax.add_feature(cfeature.STATES.with_scale('50m')) But I can't seem to find a similar…
blaylockbk
  • 1,273
  • 1
  • 17
  • 28
6
votes
4 answers

Calculate overlap between polygon and shapefile in Python 3.6

I would like to calculate the percentage of overlap between a shapefile and a polygon. I'm using Cartopy and Matplotlib and created the map shown here: A part of Europe (using a shapefile downloaded here) and an arbitrary rectangle are shown. Let's…
A T
  • 251
  • 3
  • 11
6
votes
2 answers

Changing line width of Cartopy borders

I am trying to make a basic map of North America, but I cannot figure out how to make the line width of the coastline and the administrative border smaller. There does not seem to be a built in option for this. Is there an easy work around? Below is…
jtam
  • 576
  • 1
  • 4
  • 15
6
votes
1 answer

Geodesic buffering in python

Given land polygons as a Shapely MultiPolygon, I want to find the (Multi-)Polygon that represents the e.g. 12 nautical mile buffer around the coastlines. Using the Shapely buffer method does not work since it uses euclidean calculations. Can…
ARF
  • 6,320
  • 5
  • 34
  • 62
1
2
3
40 41