def render_locator_map(city_slug, size=(75, 75), extension='png'): map_srs = SpatialReference(settings.SPATIAL_REF_SYS) bbox = city_extent_in_map_srs(city_slug) mapserver = get_mapserver('locator')(map_srs.proj4, width=size[0], height=size[1]) mapserver.zoom_to_bbox(*bbox) return mapserver(extension)
def renderTile(self, tile): """ Overrides MetaLayer's renderTile method Returns the raw bytes of the rendered tile. """ # The bbox will be in map projection units, not (necessarily) lat/lng tile_bbox = tile.bounds() width, height = tile.size() mapserver = get_mapserver(self.name)(self.dest_srs, width=width, height=height) mapserver.zoom_to_bbox(*tile_bbox) mimetype = 'image/%s' % self.extension # Calling the mapserver instance gives the raw bytestream # of the tile image tile.data = mapserver(mimetype) return tile.data
def render_locator_map(city_slug, size=(75,75), extension='png'): map_srs = SpatialReference(settings.SPATIAL_REF_SYS) bbox = city_extent_in_map_srs(city_slug) mapserver = get_mapserver('locator')(map_srs.proj4, width=size[0], height=size[1]) mapserver.zoom_to_bbox(*bbox) return mapserver(extension)
def get_citywide_mapserver(maptype, size=(75,75), extension=None): map_srs = SpatialReference(settings.SPATIAL_REF_SYS) mapserver = get_mapserver(maptype)(map_srs.proj4, width=size[0], height=size[1]) return mapserver