`contextily` is a small Python 3 package to retrieve and write to disk tile maps from the internet into geospatial raster files.
Questions tagged [contextily]
43 questions
12
votes
3 answers
Change background map for contextily
I have this code:
import pandas as pd
import numpy as np
from geopandas import GeoDataFrame
import geopandas
from shapely.geometry import LineString, Point
import matplotlib.pyplot as plt
import contextily
''' Do Something'''
df =…

SingaporePythonProgrammer
- 206
- 1
- 2
- 11
6
votes
3 answers
How to install Contextily?
This question is written in relation with the answer to Plotting a map using geopandas and matplotlib.
The main point is that installing (spatial) libraries such as Proj.4 or Contextily can be a confusing task under Windows, so that most of the time…

keepAlive
- 6,369
- 5
- 24
- 39
5
votes
0 answers
Python "EPSG code is unknown" when plotting a base map?
I am trying to add a base map to my plot through Contextily, but am getting this error when trying to see the plot.
Traceback (most recent call last):
File "rasterio/_crs.pyx", line 322, in rasterio._crs._CRS.from_epsg
File "rasterio/_err.pyx",…

pumpkinchugger
- 89
- 1
- 8
4
votes
0 answers
How to rotate a Contextily basemap in matplotlib and Jupyter notebook
I am making a set of figures with subplots in Jupyter Notebook using matplotlib and geopandas. The top plots (A & B) have geospatial data and use various basemaps (aerial imagery, shaded relief, etc.).
How can I rotate the top two plots 90-degrees,…

a11
- 3,122
- 4
- 27
- 66
4
votes
2 answers
How to use geopandas to plot latitude and longitude on a more detailed map with by using basemaps?
I am trying to plot some latitude and longitudes on the map of delhi which I am able to do by using a shape file in python3.8 using geopandas
Here is the link for the shape…

gm1312
- 99
- 1
- 1
- 11
4
votes
1 answer
Import error of contextily package in python
I installed the package contextily with pip install contextily, it appears when I do conda list
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py36h2fc01ae_0
affine …

eetiaro
- 342
- 1
- 3
- 14
3
votes
1 answer
Goeopandas plot shape and apply opacity outside shape
I am plotting a city boundary (geopandas dataframe) to which I added a basemap using contextily.
I would like to apply opacity to the region of the map outside of the city limits.
The below example shows the opposite of the desired effect, as the…

Cheesecake
- 80
- 6
3
votes
1 answer
seaborn jointplot with same size plots
I'm doing a jointplot with a basemap, the problem is that when I add the basemap the main plot doesn't have the same size of the marginal plots. I've tried with different parameters without luck. Does anyone have an idea?
import seaborn as…

Luis Medina
- 535
- 3
- 15
3
votes
2 answers
Getting contextily basemap to fill plots
I'm trying to create a 2x2 subplot using the following:
import geopandas as gpd
import matplotlib.pyplot as plt
import contextily as ctx
site = gdf.groupby('Site_name')
plt.figure(figsize =(20,20))
# Iterate through sites
for i, (Site_name,…

ferus89
- 157
- 5
3
votes
1 answer
Open Street Map (pyproj). How to solve syntax issue?
Using pyproj for visualizing open street map and getting the following error:
> AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyproj\crs.py:77:
> FutureWarning: '+init=:
' syntax is deprecated.
> ':' is…

RageAgainstheMachine
- 901
- 2
- 11
- 28
3
votes
1 answer
HTTPError: Tile URL resulted in a 404 error
I have data on NY State Hospitals with georeferences and want to create a choropleth map with base map. I also tried layering with .plot() with no success.
When I run my code for layered plot no image is shown, and when I run contextily I get this…

Natalie Shahsavarian
- 31
- 1
- 2
2
votes
1 answer
How to set fixed size for 'basemap' subplot when iterating through rows?
Please forgive me as this is my first go at a Python 'Project'.
A quick overview: I am trying to produce maps (MatPlotLib figures) by iterating through a GeoPandas dataframe of a GeoJSON file containing the boundaries of active subdivision phases in…
2
votes
1 answer
How can I reduce the contextily source footer at the bottom of a cartopy GeoAxes?
I'm attempting to plot a contextily basemap onto one of my cartopy GeoAxes, but the problem is the source footer at the bottom is HUGE. Is there any way to decrease its size? Thanks!
This is how I simply add it to my axes:
import contextily as…

NaN
- 643
- 1
- 8
- 21
2
votes
1 answer
Exception has occurred: SSLError when adding basemap with Contextily to GeoPandas map
I'm trying to use Contextily to add a basemap to a map created with GeoPandas, but am getting the following error:
HTTPSConnectionPool(host='a.tile.openstreetmap.org', port=443): Max retries exceeded with url: /14/8452/7869.png (Caused by…

Bernardo Trindade
- 461
- 4
- 16
2
votes
0 answers
Installing contextily on mac
I am trying to install contextily package and get the error below. Do you have any ideas how to overcome it? Cheers.
(base) 100KOTTONs-MacBook-Air:~ 100kotton$ pip3 install contextily
Collecting contextily
Using cached…

Ekaterina Kuzmina
- 31
- 4