tl.geodrawing.controller

Functions

tl.geodrawing.controller.inverse_mercator(y)

Inverse Mercator projection. inverse_mercator(1) is roughly 85.

>>> abs(inverse_mercator(0)) < 1e-6
True
>>> inverse_mercator(1)
85.05112...
>>> inverse_mercator(-1)
-85.05112...
tl.geodrawing.controller.mercator(latitude)

Mercator projection. mercator(85) is roughly 1.

>>> abs(mercator(0)) < 1e-6
True
>>> mercator(85.05113)
1.00000...
>>> mercator(-85.05113)
-1.00000...

Classes

class tl.geodrawing.controller.GeoCoordinateCM(controller, ctx)

Bases: object

Context manager that transforms a cairo context to geo-coordinates.

A GeoSurfaceController applies a geo-coordinate transformation to a cairo context when the context manager is entered. Upon exit, the context’s transformation matrix is reset to what it was before.

class tl.geodrawing.controller.GeoSurfaceController(update_callback=<function <lambda> at 0x9ccbae4>, tile_source=None)

Bases: object

State and background controller for a geodrawing cairo surface.

abs2geo(x, y)
center
center_xy
create_surface()
draw_frame(ctx)
expose(ctx)
geo2abs(longitude, latitude)
geo2px(longitude, latitude)
Calculate the pixel that contains a geo-coordinate pair.
height
max_zoom
move_rel(x, y)
px2geo(x, y)
Calculate geo coordinates at the center of a pixel.
tiles()
transform_for_geo(ctx)

Transform a cairo context to geo-coordinates.

After this, the associated surface’s pixels are addressed by an appropriate interval of Mercator-transformed geo-coordinates.

transformed_for_geo(ctx)
Return a GeoCoordinateCM applied to a cairo context.
update_surface()
view(x0, y0, x1, y1, padding=0)
width
zoom
zoom_rel(x, y, dz)
class tl.geodrawing.controller.TransformSurfaceProperty(func)
Bases: object

Table Of Contents

Previous topic

tl.geodrawing.demo

Next topic

tl.geodrawing.tile

This Page