`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
1
vote
0 answers
Problem plotting a raster (GeoTIFF) on top of a basemap (Google Maps / Mapbox) with Python
I've been stuck for a few days trying to plot a TIF file over a basemap (Google Maps or Mapbox) using Python. I don't know if this is actually possible because I didn't find examples and nothing very clear about it, the most I found is how to plot…

pizzi
- 11
- 2
1
vote
0 answers
Contextily Userwarning: The inferred zoom level of 31 is not valid for the current tile provider (valid zooms: 0 - 20)
I am trying to plot latitude and longitude coordinates on a contextily basemap but thus far have been unable to do so because the "inferred zoom level is not valid for the tile provider."
df1 = pd.DataFrame(clip_businesses)
geometry1 = [Point(xy)…

ColtonH123
- 11
- 1
1
vote
1 answer
Why contextily fails to fetch some tiles in auto zoom mode?
I would like to use contextily to add OSM layer to a map I draw with GeoPandas. But I have kind of a random error when using the zoom in automatic mode (default).
MCVE
Here is a MCVE:
df = pd.DataFrame({"key": ["A"], "lon": [3.6], "lat":…

jlandercy
- 7,183
- 1
- 39
- 57
1
vote
1 answer
Change default attribution text location in Contextily
Using this code:
import contextily as ctx
from shapely.geometry import box
import geopandas as gpd
minx, miny = 1.612359e+06, 0.950860e+07
maxx, maxy = 4.320331e+06, 1.007808e+07
rectangle = box(minx, miny, maxx, maxy)
gdf = gpd.GeoDataFrame(
…

mins
- 6,478
- 12
- 56
- 75
1
vote
1 answer
Plot limits are ignored when adding Contextily basemap
As the title says, when I plot some geopandas data by itself the plot limits are exactly as I specify them, but when I add the basemap through contextily (v1.1.0) the extent of the tiles determines the size of the underlying image, and the plot…

Aaron Bramson
- 1,176
- 3
- 20
- 34
1
vote
0 answers
Change contextily basemap size
I am creating a program that maps out postal codes of my choosing and then applies a colormap based on some conditions. The issue I am running into is that I would like the resulting image to always be specific dimensions. I am using data from…

davidmilad
- 21
- 2
1
vote
0 answers
How can I export contextily-geopandas image?
I have a script where I'm looping through geopandas daraframe and showing each row on a notebook with contextily for basemap, but I'm not sure how can I export it.
I'm aware of the method bounds2img but the problem is there I can only export…

krishna lodha
- 381
- 3
- 9
1
vote
1 answer
Contextily, how to get max zoom allowable and set map extents accordingly
Using Python 3.8, GeoPandas, and Contextily, I am plotting a lot of maps in different areas at different zoom levels (looping through list of points in a GeoDataFrame). Different zoom levels work for different global areas.
What is the best way to…

a11
- 3,122
- 4
- 27
- 66
1
vote
1 answer
Contextily Basemap matching issue
I'm trying to plot a set of points on a basemap using contextily in python. I have the following points object generated by shapely.geometry, long first and then lat.
0 POINT (-122.44040676 37.7452892821)
1 POINT (-122.432337016…

N. Rad
- 27
- 6
1
vote
1 answer
Contextily add_basemap inferred zoom level is not valid and changing zoom parameter doesn't fix issue
I want to plot the background map of Melbourne behind the plotted points of property addresses.
I used the following code:
import pandas as pd
import geopandas as gpd
from shapely.geometry import shape
import matplotlib.pyplot as plt
import…

Ryan Ward
- 196
- 1
- 10
1
vote
0 answers
How can I add basemaps to a seaborn jointplot?
Can someone guide me on how best to add a background map to two seaborn jointplots I created?
To give context, I am currently analyzing a dataset from Austin Police Dept's Crime Reports database. What I am attempting to do is visualize the density…

Robert Grantham
- 11
- 3
1
vote
2 answers
Contextily map upside down when used with cartopy
When a contextily basemap is added to an axis projected with cartopy, the map appears upside down. Here is a minimum example:
import matplotlib.pyplot as plt
import cartopy
import contextily
# contextily & cartopy
fig, ax = plt.subplots()
ax =…

Martin
- 1,395
- 1
- 11
- 33
0
votes
0 answers
How to get runway and taxiway coordinates on given ICAO airport in python using OSMnx?
this is my first question on StackOverflow :) I'm trying to get coordinates of runways and taxiways in Python using OSMnx.
I was trying to run the following code (I wanted to use this example):
import osmnx as ox
import matplotlib.pyplot as…
0
votes
1 answer
Plotting a Geodataframe over a satellite image
I've been trying several ways to plot a GeodataFrame over a satellite image and none seemed to work.
First I tried with contextily. I managed to make it work, but not with satellite data. It seems there is no google imagery, and Esri.WorldImagery…

ImanolUr
- 348
- 2
- 13
0
votes
0 answers
Geopandas plot with contextily basemap south face up
I was wondering if it is possible to plot a map using geopandas and contextily basemaps in an orientation other than North up.
Example code with a map that I would like to plot upside down, but with the basemaps labels right-side up:
import osmnx as…

Cheesecake
- 80
- 6