本文整理汇总了Python中mapnik2.mapnik_version函数的典型用法代码示例。如果您正苦于以下问题:Python mapnik_version函数的具体用法?Python mapnik_version怎么用?Python mapnik_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mapnik_version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: serialize
def serialize(xml, options):
try:
try:
import mapnik2 as mapnik
except ImportError:
import mapnik
except ImportError:
sys.exit(color_text(1, "Error: saving xml requires Mapnik python bindings to be installed"))
m = mapnik.Map(1, 1)
if options.from_string:
mapnik.load_map_from_string(m, xml, True)
else:
mapnik.load_map(m, xml, True)
if options.output:
mapnik.save_map(m, options.output)
else:
if hasattr(mapnik, "mapnik_version") and mapnik.mapnik_version() >= 700:
print mapnik.save_map_to_string(m)
else:
sys.exit(
color_text(
1,
"Minor error: printing XML to stdout requires Mapnik >=0.7.0, please provide a second argument to save the output to a file",
)
)
开发者ID:cuu508,项目名称:mapnik-stylesheets,代码行数:25,代码来源:generate_xml.py
示例2: render_tile
def render_tile(self, tile_uri, x, y, z):
# Calculate pixel positions of bottom-left & top-right
p0 = (x * 256, (y + 1) * 256)
p1 = ((x + 1) * 256, y * 256)
# Convert to LatLong (EPSG:4326)
l0 = self.tileproj.fromPixelToLL(p0, z)
l1 = self.tileproj.fromPixelToLL(p1, z)
# Convert to map projection (e.g. mercator co-ords EPSG:900913)
c0 = self.prj.forward(mapnik.Coord(l0[0], l0[1]))
c1 = self.prj.forward(mapnik.Coord(l1[0], l1[1]))
# Bounding box for the tile
if hasattr(mapnik, "mapnik_version") and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x, c0.y, c1.x, c1.y)
else:
bbox = mapnik.Envelope(c0.x, c0.y, c1.x, c1.y)
render_size = 256
self.m.resize(render_size, render_size)
self.m.zoom_to_box(bbox)
self.m.buffer_size = 128
# Render image with default Agg renderer
im = mapnik.Image(render_size, render_size)
mapnik.render(self.m, im)
# Ensure the tile isn't blank before saving
if not im.tostring("png") == self.blankTileStr:
im.save(tile_uri, "png256")
# Return True if the tile was saved
return True
else:
return False
开发者ID:Cribstone,项目名称:Transit-Board-Hotel,代码行数:34,代码来源:generate_tiles.py
示例3: render_legend
def render_legend(mapfile, tile_uri):
m = mapnik.Map(1024, 2048)
# Load style XML
mapnik.load_map(m, mapfile, True)
# Obtain <Map> projection
prj = mapnik.Projection(m.srs)
# Projects between tile pixel co-ordinates and LatLong (EPSG:4326)
tileproj = GoogleProjection(20)
# Convert to map projection (e.g. mercator co-ords EPSG:900913)
c0 = prj.forward(mapnik.Coord(14.4503,50.0673))
c1 = prj.forward(mapnik.Coord(14.457,50.0678))
# Bounding box for the tile
if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x,c0.y, c1.x,c1.y)
else:
bbox = mapnik.Envelope(c0.x,c0.y, c1.x,c1.y)
render_size_x = 1024
render_size_y = 1500
m.resize(render_size_x, render_size_y)
m.zoom_to_box(bbox)
m.buffer_size = 128
# Render image with default Agg renderer
im = mapnik.Image(render_size_x, render_size_y)
mapnik.render(m, im)
im.save(tile_uri, 'png256')
surface = cairo.SVGSurface('legend.svg', render_size_x, render_size_y)
mapnik.render(m, surface)
surface.finish()
开发者ID:auto-mat,项目名称:rendering-PNK-ZM,代码行数:32,代码来源:generate_legend.py
示例4: render_tile
def render_tile(self, x, y, z):
# Calculate pixel positions of bottom-left & top-right
p0 = (x * TILE_SIZE, (y + 1) * TILE_SIZE)
p1 = ((x + 1) * TILE_SIZE, y * TILE_SIZE)
# Convert to LatLong (EPSG:4326)
l0 = self.tileproj.fromPixelToLL(p0, z)
l1 = self.tileproj.fromPixelToLL(p1, z)
# Convert to map projection (e.g. mercator co-ords EPSG:900913)
c0 = self.prj.forward(mapnik.Coord(l0[0], l0[1]))
c1 = self.prj.forward(mapnik.Coord(l1[0], l1[1]))
# Bounding box for the tile
if hasattr(mapnik, "mapnik_version") and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x, c0.y, c1.x, c1.y)
else:
bbox = mapnik.Envelope(c0.x, c0.y, c1.x, c1.y)
render_size = TILE_SIZE
self.m.resize(render_size, render_size)
self.m.zoom_to_box(bbox)
self.m.buffer_size = 128
# Render image with default Agg renderer
im = mapnik.Image(render_size, render_size)
mapnik.render(self.m, im)
self.writer.write(x, y, z, im)
开发者ID:RevathiZoho,项目名称:mapnik-stylesheets,代码行数:27,代码来源:polytiles.py
示例5: render_tile
def render_tile(self, tile_uri, x, y, z):
# Calculate pixel positions of bottom-left & top-right
p0 = (x * 256, (y + 1) * 256)
p1 = ((x + 1) * 256, y * 256)
# Convert to LatLong (EPSG:4326)
l0 = self.tileproj.fromPixelToLL(p0, z);
l1 = self.tileproj.fromPixelToLL(p1, z);
# Convert to map projection (e.g. mercator co-ords EPSG:900913)
c0 = self.prj.forward(mapnik.Coord(l0[0],l0[1]))
c1 = self.prj.forward(mapnik.Coord(l1[0],l1[1]))
# Bounding box for the tile
if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x,c0.y, c1.x,c1.y)
else:
bbox = mapnik.Envelope(c0.x,c0.y, c1.x,c1.y)
render_size = 256
self.m.resize(render_size, render_size)
self.m.zoom_to_box(bbox)
if(self.m.buffer_size < 128):
self.m.buffer_size = 128
# Render image with default Agg renderer
im = mapnik.Image(render_size, render_size)
mapnik.render(self.m, im)
im.save(tile_uri, 'png256')
开发者ID:zachatrocity,项目名称:mapnik-fork,代码行数:28,代码来源:generate_tiles_multiprocess.py
示例6: generate_map_tile
def generate_map_tile(self, m, filename, z, x, y):
# Code taken from OSM generate_tiles.py
proj = GoogleProjection()
mprj = mapnik.Projection(m.srs)
p0 = (x * 256, (y + 1) * 256)
p1 = ((x + 1) * 256, y * 256)
l0 = proj.fromPixelToLL(p0, z);
l1 = proj.fromPixelToLL(p1, z);
c0 = mprj.forward(mapnik.Coord(l0[0], l0[1]))
c1 = mprj.forward(mapnik.Coord(l1[0], l1[1]))
if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x, c0.y, c1.x, c1.y)
else:
bbox = mapnik.Envelope(c0.x, c0.y, c1.x, c1.y)
m.resize(256, 256)
m.zoom_to_box(bbox)
im = mapnik.Image(256, 256)
mapnik.render(m, im)
# See https://github.com/mapnik/mapnik/wiki/OutputFormats for output
# formats and special parameters. The default here is 32 bit PNG with 8
# bit per component and alpha channel.
if mapnik_version == 2:
im.save(str(filename), "png32")
else:
im.save(str(filename), "png")
开发者ID:hrpt-se,项目名称:hrpt,代码行数:29,代码来源:models.py
示例7: kml_hex_to_mapnik_color
def kml_hex_to_mapnik_color(key_color):
"""Convert a kml color string to a mapnik.Color"""
c = str(key_color)
a,b,g,r = tuple(map(lambda s: int(s, 16),(c[:2],c[2:4],c[4:6],c[6:])))
if mapnik.mapnik_version() >= 800:
pass #a *= 255
#print a,b,g,r
#return (r,g,b)
return mapnik.Color(r,g,b,a)
开发者ID:springmeyer,项目名称:kml-escape,代码行数:9,代码来源:utils.py
示例8: GetFeatureInfo
def GetFeatureInfo(self, params, querymethodname='query_point'):
m = self._buildMap(params)
if params['info_format'] == 'text/plain':
writer = TextFeatureInfo()
elif params['info_format'] == 'text/xml':
writer = XMLFeatureInfo()
if params['query_layers'] and params['query_layers'][0] == '__all__':
for layerindex, layer in enumerate(m.layers):
featureset = getattr(m, querymethodname)(layerindex, params['i'], params['j'])
features = featureset.features
if features:
writer.addlayer(layer.name)
for feat in features:
writer.addfeature()
if mapnik_version() >= 800:
for prop in feat:
writer.addattribute(prop[0], prop[1])
else:
for prop in feat.properties:
writer.addattribute(prop[0], prop[1])
else:
for layerindex, layername in enumerate(params['query_layers']):
if layername in params['layers']:
# TODO - pretty sure this is bogus, we can't pull from m.layers by the layerindex of the
# 'query_layers' subset, need to pull from:
# self.mapfactory.layers[layername]
if m.layers[layerindex].queryable:
featureset = getattr(m, querymethodname)(layerindex, params['i'], params['j'])
features = featureset.features
if features:
writer.addlayer(m.layers[layerindex].name)
for feat in features:
writer.addfeature()
if mapnik_version() >= 800:
for prop in feat:
writer.addattribute(prop[0], prop[1])
else:
for prop in feat.properties:
writer.addattribute(prop[0], prop[1])
else:
raise OGCException('Requested query layer "%s" is not marked queryable.' % layername, 'LayerNotQueryable')
else:
raise OGCException('Requested query layer "%s" not in the LAYERS parameter.' % layername)
return Response(params['info_format'], str(writer))
开发者ID:johnewart,项目名称:OGCServer,代码行数:44,代码来源:common.py
示例9: render_to_file
def render_to_file(mapnik_map,output,format):
# get the full path for a users directory
if '~' in output:
output = os.path.expanduser(output)
# mapnik won't create directories so
# we have to make sure they exist first...
dirname = os.path.dirname(output)
if not os.path.exists(dirname):
os.makedirs(dirname)
# render out to the desired format
if format in ('png','png256','jpeg') or (hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 700):
try:
mapnik.render_to_file(mapnik_map,output,format)
except Exception, e:
return (False,e)
开发者ID:drnextgis,项目名称:quantumnik,代码行数:17,代码来源:render_wrapper.py
示例10: render_tile
def render_tile(self, tile_uri, x, y, z):
# Calculate pixel positions of bottom-left & top-right
p0 = (x * 256, (y + 1) * 256)
p1 = ((x + 1) * 256, y * 256)
# Convert to LatLong (EPSG:4326)
l0 = self.tileproj.fromPixelToLL(p0, z);
l1 = self.tileproj.fromPixelToLL(p1, z);
# Convert to map projection (e.g. mercator co-ords EPSG:900913)
c0 = self.prj.forward(mapnik.Coord(l0[0],l0[1]))
c1 = self.prj.forward(mapnik.Coord(l1[0],l1[1]))
# Bounding box for the tile
if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x,c0.y, c1.x,c1.y)
else:
bbox = mapnik.Envelope(c0.x,c0.y, c1.x,c1.y)
render_size = 256
self.m.resize(render_size, render_size)
self.m.zoom_to_box(bbox)
self.m.buffer_size = 128
# Render image with default Agg renderer
im = mapnik.Image(render_size, render_size)
mapnik.render(self.m, im)
im.save(tile_uri, 'png256')
grid_uri = tile_uri.replace('.png','.grid.json')
# new mapnik.Grid api, works like mapnik.Image
# with the exception that you can only render one
# layer to it with the mapnik.render_layer function
# create grid as same size as map/image
grid = mapnik.Grid(render_size, render_size)
# render a layer to that grid array
mapnik.render_layer(self.m,grid,layer=0,fields=['POP2005','NAME'])
# then encode the grid array as utf, resample to 1/4 the size, and dump features
grid_utf = grid.encode('utf',resolution=4,add_features=True)
# below is the old grid api - will be removed soon, don't use
#grid_utf = mapnik.render_grid(self.m,0,key='__id__',resolution=4,fields=['POP2005','NAME'])
# client code uses jsonp, so fake by wrapping in grid() callback
open(grid_uri,'wb').write('grid(' + json.dumps(grid_utf) + ')')
开发者ID:seanlee928,项目名称:gridsforkids,代码行数:45,代码来源:generate_tiles.py
示例11: render_image
def render_image(start_time, end_time):
ll = (30.708, -27.414, 32.179, -25.652)
prj = mapnik.Projection("+init=epsg:900913")
c0 = prj.forward(mapnik.Coord(ll[0], ll[1]))
c1 = prj.forward(mapnik.Coord(ll[2], ll[3]))
z = 3
imgx = 336 * z
imgy = 450 * z
m = mapnik.Map(imgx, imgy)
mapnik.load_map(m, "gpx-nolayer.xml")
db_params = dict(
dbname="gpx-merc",
user="gpx",
password="gpx",
host="localhost",
port=5433,
estimate_extent=False,
extent="3390650.221286806, -3163145.87245787, 3609898.596229789, -2956043.104540316",
)
lyr = Layer("points", "+init=epsg:900913")
db_params["table"] = (
"(select gps_points.geom as geom, gpx_files.gps_name as gps_name from gps_points INNER join gpx_files on gpx_files.id = gps_points.gpx_id where gps_points.timestamp >= '"
+ start_time
+ "' and gps_points.timestamp < '"
+ end_time
+ "') as points"
)
lyr.datasource = PostGIS(**db_params)
lyr.styles.append("points")
m.layers.append(lyr)
if hasattr(mapnik, "mapnik_version") and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x, c0.y, c1.x, c1.y)
else:
bbox = mapnik.Envelope(c0.x, c0.y, c1.x, c1.y)
m.zoom_to_box(bbox)
im = mapnik.Image(imgx, imgy)
mapnik.render(m, im)
view = im.view(0, 0, imgx, imgy) # x,y,width,height
view.save("frames/" + start_time + ".png", "png")
开发者ID:mikelmaron,项目名称:MICS-GPX,代码行数:45,代码来源:generate_images.py
示例12: complexRun
def complexRun(image, stylesheet, extent, size):
mapfile = stylesheet
map_uri = image
imgx = size[0]
imgy = size[1]
m = mapnik.Map(imgx,imgy)
mapnik.load_map(m,mapfile)
if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(extent[0],extent[2],extent[1],extent[3])
else:
bbox = mapnik.Envelope(extent[0],extent[2],extent[1],extent[3])
m.zoom_to_box(bbox)
im = mapnik.Image(imgx,imgy)
mapnik.render(m, im)
view = im.view(0,0,imgx,imgy) # x,y,width,height
view.save(map_uri,'png')
开发者ID:RaKl,项目名称:MapRoj,代码行数:19,代码来源:functions.py
示例13: ogc_filter_to_mapnik
def ogc_filter_to_mapnik(ogc_filter):
if hasattr(ogc_filter,'PropertyIsGreaterThan'):
prop = ogc_filter.PropertyIsGreaterThan
operator = '>'
#cql = "[%s] > %s" % (prop.PropertyName,prop.Literal)
elif hasattr(ogc_filter,'PropertyIsLessThan'):
prop = ogc_filter.PropertyIsLessThan
operator = '<'
elif hasattr(ogc_filter,'PropertyIsEqualTo'):
prop = ogc_filter.PropertyIsEqualTo
operator = '='
elif hasattr(ogc_filter,'PropertyIsNotEqualTo'):
prop = ogc_filter.PropertyIsNotEqualTo
operator = '!='
if is_number(prop.Literal.text):
cql = "[%s] %s %s" % (prop.PropertyName,operator,prop.Literal)
else:
cql = "[%s] %s '%s'" % (prop.PropertyName,operator,prop.Literal.text)
if mapnik.mapnik_version() >= 800:
return mapnik.Expression(str(cql))
else:
return mapnik.Filter(str(cql))
开发者ID:cschissler,项目名称:geotools2mapnik,代码行数:22,代码来源:geotools2mapnik.py
示例14: render_tile
def render_tile(self, tile_uri, x, y, z):
# Calculate pixel positions of bottom-left & top-right
p0 = (x * TILES_SIZE, (y + 1) * TILES_SIZE)
p1 = ((x + 1) * TILES_SIZE, y * TILES_SIZE)
# Convert to LatLong (EPSG:4326)
l0 = self.tileproj.fromPixelToLL(p0, z);
l1 = self.tileproj.fromPixelToLL(p1, z);
# Convert to map projection (e.g. mercator co-ords EPSG:900913)
c0 = self.prj.forward(mapnik.Coord(l0[0],l0[1]))
c1 = self.prj.forward(mapnik.Coord(l1[0],l1[1]))
# Bounding box for the tile
if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x,c0.y, c1.x,c1.y)
else:
bbox = mapnik.Envelope(c0.x,c0.y, c1.x,c1.y)
render_size = TILES_SIZE
self.m.resize(render_size, render_size)
self.m.zoom_to_box(bbox)
self.m.buffer_size = 128
if FORMAT == 'grid':
grid = mapnik.Grid(render_size, render_size)
# mapnik.render_layer(self.m, grid, layer=64, fields=['name'])
for n, l in enumerate(self.m.layers):
if l.name != 'admin-012345678':
if 'name' in l.datasource.fields():
mapnik.render_layer(self.m, grid, layer=n, fields=['name'])
utfgrid = grid.encode('utf', resolution=4)
f = open(tile_uri + '.' + FILE_EXTENSION, 'w')
f.write(json.dumps(utfgrid))
f.close()
else:
# Render image with default Agg renderer
im = mapnik.Image(render_size, render_size)
mapnik.render(self.m, im)
im.save(tile_uri + '.' + FILE_EXTENSION, FORMAT)
开发者ID:sbrunner,项目名称:map,代码行数:39,代码来源:generate_tiles_1024.py
示例15: generate_map_tile
def generate_map_tile(self, m, filename, z, x, y):
# Code taken from OSM generate_tiles.py
proj = GoogleProjection()
mprj = mapnik.Projection(m.srs)
p0 = (x * 256, (y + 1) * 256)
p1 = ((x + 1) * 256, y * 256)
l0 = proj.fromPixelToLL(p0, z);
l1 = proj.fromPixelToLL(p1, z);
c0 = mprj.forward(mapnik.Coord(l0[0], l0[1]))
c1 = mprj.forward(mapnik.Coord(l1[0], l1[1]))
if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x, c0.y, c1.x, c1.y)
else:
bbox = mapnik.Envelope(c0.x, c0.y, c1.x, c1.y)
m.resize(256, 256)
m.zoom_to_box(bbox)
im = mapnik.Image(256, 256)
mapnik.render(m, im)
im.save(str(filename), "png256")
开发者ID:sbfnk,项目名称:epiwork-website,代码行数:23,代码来源:models.py
示例16: str
###
# center of the image
label_x = xmin + ((xmax - xmin) / 2)
# bottom of the image
label_y = ymin + ((ymax - ymin) / 30)
# create PointDatasource
pds = mapnik2.PointDatasource()
# place scale at the bottom-center of the map
pds.add_point(label_x, label_y, 'Name', "Scale: 1:" + str(m.scale_denominator()))
# create label symbolizers
if mapnik2.mapnik_version() >= 800:
text = mapnik2.TextSymbolizer(mapnik2.Expression('[Name]'),'DejaVu Sans Bold',12,mapnik2.Color('black'))
else:
text = mapnik2.TextSymbolizer('Name','DejaVu Sans Bold',12,mapnik2.Color('black'))
s3 = mapnik2.Style()
r3 = mapnik2.Rule()
r3.symbols.append(text)
s3.rules.append(r3)
lyr3 = mapnik2.Layer('Memory Datasource')
lyr3.datasource = pds
lyr3.styles.append('Style')
m.layers.append(lyr3)
m.append_style('Style',s3)
开发者ID:zehpunktbarron,项目名称:iOSMAnalyzer,代码行数:30,代码来源:c6_map_untouched_lines.py
示例17: int
# A4 Landscape
imgx_cm = 20.0
imgy_cm = 14.0
img_dpi = 300.0
mapnik_scale_factor = img_dpi / 92.
imgx = int(imgx_cm * img_dpi / 2.54)
imgy = int(imgy_cm * img_dpi / 2.54)
print "generating map...."
m = mapnik.Map(imgx,imgy)
mapnik.load_map(m,xmlmapfile)
prj = mapnik.Projection("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m [email protected] +no_defs +over")
c0 = prj.forward(mapnik.Coord(ll[0],ll[1]))
c1 = prj.forward(mapnik.Coord(ll[2],ll[3]))
if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
bbox = mapnik.Box2d(c0.x,c0.y,c1.x,c1.y)
else:
bbox = mapnik.Envelope(c0.x,c0.y,c1.x,c1.y)
m.zoom_to_box(bbox)
im = mapnik.Image(imgx,imgy)
mapnik.render(m, im,mapnik_scale_factor)
view = im.view(0,0,imgx,imgy) # x,y,width,height
view.save(map_uri,'png')
print "done - image stored as %s" % map_uri
开发者ID:jones139,项目名称:Mapnik-OSM-Styles,代码行数:28,代码来源:make_map_cartoStyle.py
示例18: mercator
except:
import mapnik
import sys, os
# Set up projections
# spherical mercator (most common target map projection of osm data imported with osm2pgsql)
merc = mapnik.Projection('+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m [email protected] +no_defs +over')
# long/lat in degrees, aka ESPG:4326 and "WGS 84"
longlat = mapnik.Projection('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
# can also be constructed as:
#longlat = mapnik.Projection('+init=epsg:4326')
# ensure minimum mapnik version
if not hasattr(mapnik,'mapnik_version') and not mapnik.mapnik_version() >= 600:
raise SystemExit('This script requires Mapnik >=0.6.0)')
if __name__ == "__main__":
try:
mapfile = os.environ['MAPNIK_MAP_FILE']
except KeyError:
mapfile = "osm.xml"
map_uri = "image.png"
#---------------------------------------------------
# Change this to the bounding box you want
#
bounds = (-6.5, 49.5, 2.1, 59)
#---------------------------------------------------
开发者ID:CloCkWeRX,项目名称:mapnik-stylesheets,代码行数:31,代码来源:generate_image.py
示例19: toposmInfo
def toposmInfo():
print "Using mapnik version:", mapnik.mapnik_version()
print "Has Cairo:", mapnik.has_cairo()
print "Fonts:"
for face in mapnik.FontEngine.face_names():
print "\t", face
开发者ID:calvinmetcalf,项目名称:TopOSM,代码行数:6,代码来源:toposm.py
示例20: str
import sys, os
import mapnik2
import cairo
import json
import argparse
import tempfile
import shutil
from globalmaptiles import GlobalMercator
from tileloader import GoogleTileLoader, TMSTileLoader, FTileLoader
# sys.stdout.write("areas: '" + str(areas) + "'\n")
# sys.stdout.write("pois: '" + str(areas) + "'\n")
# sys.exit(0)
# ensure minimum mapnik version
if not hasattr(mapnik2, "mapnik_version") and not mapnik2.mapnik_version() >= 600:
raise SystemExit("This script requires Mapnik >=0.6.0)")
# Google bounds toString() gives following string:
# ((61.477925877956785, 21.768811679687474), (61.488948601502614, 21.823743320312474))
def googleBoundsToBox2d(google_bounds):
parts = google_bounds.split(",")
strip_str = "() "
min_lat = float(parts[0].strip(strip_str))
min_lng = float(parts[1].strip(strip_str))
max_lat = float(parts[2].strip(strip_str))
max_lng = float(parts[3].strip(strip_str))
return (min_lng, min_lat, max_lng, max_lat)
class TileSourceParser:
开发者ID:iqqmuT,项目名称:toe,代码行数:31,代码来源:render.py
注:本文中的mapnik2.mapnik_version函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论