How to use the contextily.bounds2img function in contextily

To help you get started, we’ve selected a few contextily examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ResidentMario / geoplot / geoplot / geoplot.py View on Github external
def draw(self):
            ax = plot.ax
            if len(self.df.geometry) == 0:
                return ax

            basemap, extent = ctx.bounds2img(
                *self._webmap_extent, zoom=self.zoom, 
                url=getattr(ctx.sources, provider), ll=True
            )
            extent = (extent[0], extent[1], extent[3], extent[2])
            ax.imshow(basemap, extent=extent, interpolation='bilinear')
            return ax
github geopandas / geopandas / _downloads / 399dcf4f7cc83e955db0e5417ce5645d / plotting_basemap_background.py View on Github external
def add_basemap(ax, zoom, url='http://tile.stamen.com/terrain/tileZ/tileX/tileY.png'):
    xmin, xmax, ymin, ymax = ax.axis()
    basemap, extent = ctx.bounds2img(xmin, ymin, xmax, ymax, zoom=zoom, url=url)
    ax.imshow(basemap, extent=extent, interpolation='bilinear')
    # restore original x/y limits
    ax.axis((xmin, xmax, ymin, ymax))