if __name__ == '__main__': import renderers import coords from ocitysmap import i18n # Hack to fake gettext try: _(u"Test gettext") except NameError: __builtins__.__dict__["_"] = lambda x: x logging.basicConfig(level=logging.DEBUG) bbox = coords.BoundingBox(48.8162, 2.3417, 48.8063, 2.3699) zoom = 16 renderer_cls = renderers.get_renderer_class_by_name('plain') papers = renderer_cls.get_compatible_paper_sizes(bbox, zoom) print 'Compatible paper sizes:' for p in papers: print ' * %s (%.1fx%.1fcm)' % (p[0], p[1]/10.0, p[2]/10.0) print 'Using first available:', papers[0] class StylesheetMock: def __init__(self): # self.path = '/home/sam/src/python/maposmatic/mapnik-osm/osm.xml' self.path = '/mnt/data1/common/home/d2/Downloads/svn/mapnik-osm/osm.xml' self.grid_line_color = 'black'
def _inverse_envelope(self, envelope): """Inverse the given cartesian envelope (in 900913) back to a 4002 bounding box.""" c0 = self._proj.inverse(mapnik.Coord(envelope.minx, envelope.miny)) c1 = self._proj.inverse(mapnik.Coord(envelope.maxx, envelope.maxy)) return coords.BoundingBox(c0.y, c0.x, c1.y, c1.x)