| |
- builtins.object
-
- ImageManager
-
- PILImageManager
- PygameImageManager
- OSMManager
class ImageManager(builtins.object) |
|
Simple abstract interface for creating and manipulating images, to be used
by an OSMManager object. |
|
Methods defined here:
- __init__(self)
- Initialize self. See help(type(self)) for accurate signature.
- create_image(self, width, height)
- To be overridden.
Create and return image with specified dimensions
- destroy_image(self)
- Destroys internal representation of the image, if it was
ever created.
- getImage(self)
- Deprecated, use lower case version instead.
- get_image(self)
- Returns some representation of the internal image. The returned value
is not for use by the OSMManager.
- load_image_file(self, imagef)
- To be overridden.
Loads specified image file into image object and returns it.
- paste_image(self, img, xy)
- To be overridden.
Given an already-loaded file, paste it into the internal image
at the specified top-left coordinate.
- paste_image_file(self, imagef, xy)
- Given the filename of an image, and the x, y coordinates of the
location at which to place the top left corner of the contents
of that image, pastes the image into this object's internal image.
- prepare_image(self, width, height)
- Create and internally store an image whose dimensions
are those specified by width and height.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class OSMManager(builtins.object) |
|
OSMManager(**kwargs)
An OSMManager manages the retrieval and storage of Open Street Map
images. The basic utility is the create_osm_image() method which
automatically gets all the images needed, and tiles them together
into one big image. |
|
Methods defined here:
- __init__(self, **kwargs)
- Creates an OSMManager.
Arguments:
cache - path (relative or absolute) to directory where tiles downloaded
from OSM server should be saved. Default "/tmp".
server - URL of OSM server from which to retrieve OSM tiles. This
should be fully qualified, including the protocol.
Default "https://tile.openstreetmap.org"
url - Full URL template from which to retrieve OSM tiles. This should
be fully qualified, including the protocol, and should
contain placeholders for zoom ('{z}'), coordinate x and y
('{x}' and '{y}'), and optionally scale ('{s}') for high-
resolution tile retrieval.
Note: when specified, the server parameter is ignored.
Default: server with "/{z}/{x}/{y}.png" appended
scale - Scale to use for high-resolution tiles. Note that both URL and
scale must be set correctly for correct high-resolution
support. Standard tile size is 256 pixels, high-resolution
tiles are scale times 256 pixels (e.g., 512 pixels when
scale is 2).
Default 1 (standard resolution)
image_manager - ImageManager instance which will be used to do all
image manipulation. You must provide this.
- createOSMImage(self, bounds, zoom)
- Deprecated, use lower case version instead.
- create_osm_image(self, bounds, zoom)
- Given bounding lat_lons (in degrees), and an OSM zoom level,
creates an image constructed from OSM tiles.
Returns (img, bounds) where img is the constructed image (as returned
by the image manager's "get_image()" method),
and bounds is the (min_lat, max_lat, min_lon, max_lon) bounding box
which the tiles cover.
- getLocalTileFilename(self, tile_coord, zoom)
- Deprecated, use lower case version instead.
- getTileCoord(self, lon_deg, lat_deg, zoom)
- Deprecated, use lower case version instead.
- getTileURL(self, tile_coord, zoom)
- Deprecated, use lower case version instead.
- get_local_tile_filename(self, tile_coord, zoom)
- Given x, y coord of the tile, and the zoom level,
returns the filename to which the file would be saved
if it was downloaded. That way we don't have to kill
the osm server every time the thing runs.
- get_tile_coord(self, lon_deg, lat_deg, zoom)
- Given lon, lat coords in DEGREES, and a zoom level,
returns the (x, y) coordinate of the corresponding tile #.
(https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python)
- get_tile_url(self, tile_coord, zoom)
- Given x, y coord of the tile to download, and the zoom level,
returns the URL from which to download the image.
- retrieveTileImage(self, tile_coord, zoom)
- Deprecated, use lower case version instead.
- retrieve_tile_image(self, tile_coord, zoom)
- Given x, y coord of the tile, and the zoom level,
retrieves the file to disk if necessary and
returns the local filename.
- tileNWLatlon(self, tile_coord, zoom)
- Deprecated, use lower case version instead.
- tile_nw_lat_lon(self, tile_coord, zoom)
- Given x, y coord of the tile, and the zoom level,
returns the (lat, lon) coordinates of the upper
left corner of the tile.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class PILImageManager(ImageManager) |
|
PILImageManager(mode)
An ImageManager which works with PIL images. |
|
- Method resolution order:
- PILImageManager
- ImageManager
- builtins.object
Methods defined here:
- __init__(self, mode)
- Constructs a PIL Image Manager.
Arguments:
mode - the PIL mode in which to create the image.
- create_image(self, width, height)
- To be overridden.
Create and return image with specified dimensions
- load_image_file(self, imagef)
- To be overridden.
Loads specified image file into image object and returns it.
- paste_image(self, img, xy)
- To be overridden.
Given an already-loaded file, paste it into the internal image
at the specified top-left coordinate.
Methods inherited from ImageManager:
- destroy_image(self)
- Destroys internal representation of the image, if it was
ever created.
- getImage(self)
- Deprecated, use lower case version instead.
- get_image(self)
- Returns some representation of the internal image. The returned value
is not for use by the OSMManager.
- paste_image_file(self, imagef, xy)
- Given the filename of an image, and the x, y coordinates of the
location at which to place the top left corner of the contents
of that image, pastes the image into this object's internal image.
- prepare_image(self, width, height)
- Create and internally store an image whose dimensions
are those specified by width and height.
Data descriptors inherited from ImageManager:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class PygameImageManager(ImageManager) |
|
An ImageManager which works with Pygame images. |
|
- Method resolution order:
- PygameImageManager
- ImageManager
- builtins.object
Methods defined here:
- __init__(self)
- Initialize self. See help(type(self)) for accurate signature.
- create_image(self, width, height)
- To be overridden.
Create and return image with specified dimensions
- load_image_file(self, imagef)
- To be overridden.
Loads specified image file into image object and returns it.
- paste_image(self, img, xy)
- To be overridden.
Given an already-loaded file, paste it into the internal image
at the specified top-left coordinate.
Methods inherited from ImageManager:
- destroy_image(self)
- Destroys internal representation of the image, if it was
ever created.
- getImage(self)
- Deprecated, use lower case version instead.
- get_image(self)
- Returns some representation of the internal image. The returned value
is not for use by the OSMManager.
- paste_image_file(self, imagef, xy)
- Given the filename of an image, and the x, y coordinates of the
location at which to place the top left corner of the contents
of that image, pastes the image into this object's internal image.
- prepare_image(self, width, height)
- Create and internally store an image whose dimensions
are those specified by width and height.
Data descriptors inherited from ImageManager:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |