mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
to be rendered. This allows for a large extent (larger than can be
rendered into a single image in memory) to be rendered out as tiles.
Since the full extent is used for the placement calculations text
crossing tile boundaries will be consistent.
This method is a little inefficient when a large number of labels need
placed, an improved method would be to cache these placements between
tiles, but the attached is a start.
c++ users should simple call the render method with a start X and Y
coordinate specified,
for (int TileX = 0;TileX < 5;++TileX)
{
for(int TileY = 0;TileY < 5; ++TileY)
{
int TileSize=250;
int StartX = TileX*TileSize;
int StartY = TileY*TileSize;
Image32 buf(TileSize,TileSize);
agg_renderer<Image32> ren(m,buf,StartX,StartY);
ren.apply();
char name[324];
sprintf(name,"tile_%d_%d.png",TileX,TileY);
ImageUtils::save_to_file(name,"png",buf);
}
}
python users should call render_tile_to_file
for y in range(tile_count_y):
for x in range(tile_count_x):
if not os.path.exists("tiles/%d/%d/" % (map_scale, y)):
os.makedirs("tiles/%d/%d/" % (map_scale, y))
render_tile_to_file(m, x*tile_size, y*tile_size, tile_size, tile_size,
'tiles/%d/%d/%d.png' % (map_scale,y,x), 'png')
See INSTALL file for installation instructions Mapnik is an OpenSource C++/Python toolkit for developing GIS (Geographic Information Systems) applications. At the core is a C++ shared library providing algorithms/patterns for spatial data access and visualization. Essentially a collection of geographic objects (map, layer, datasource, feature, geometry), the library doesn't rely on "windowing systems" and can be deployed in any server environment. It is intended to play fair in a multi-threaded environment and is aimed primarily, but not exclusively, at web-based development. High-level Python bindings (boost.python) facilitate rapid application development, targeting zope3, django etc. Mapnik is a free software and is released under LGPL (GNU Lesser General Public Licence) (see COPYING)
Description
Languages
C++
94.7%
Python
3.2%
CMake
1.2%
Shell
0.5%
CSS
0.1%