예제 #1
0
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)
예제 #2
0
    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
예제 #3
0
파일: tile.py 프로젝트: frankk00/openblock
    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
예제 #4
0
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)
예제 #5
0
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