Example:
>>> from mapnik import *
>>> im = Image(200,200)
>> save_to_file('test.png',im) # Guess image type from file extension
>> save_to_file('test.png,'jpeg',im) # Explicitly save as JPEG
>>> from mapnik import *
>>> for name in FontEngine.instance().face_names():
... print name
...
DejaVu Sans Bold
DejaVu Sans Bold Oblique
....
2. std::vector<std::string> is reflected as mapnik_.Names object
TODO: test if there are more then one face in the file
2. PostGIS plug-in - optional 'multiple_geometries' parameter to control how Multi* geometries built.
3. MarkersSymbolizer (work in progress) to render vector shapes (markers) alonh a path with collision detection.
- libxml2 support
- strict error handling while parsing XML map files
- implemented save_map()
- removed some duplicate defaults
- all symbolizers with icons share a common base class now
(FIXME : label_spacing is still, too slow!!)
2. Re-use some agg objects.
3. placement_finder cleanups!
4. Added support for 'building_symbolizer' - extruded polygons
plugins/input/postgis/SConscript:
- added boost_thread-mt to darwin builds
demo/c++/rundemo.cpp:
- setBackground() is now set_background()
bindings/python/SConscript:
- added boost_thread-mt to darwin builds
- changed builder to LoadableModule which builds a so called "bundle"
on darwin and a shared library on all other systems.
- LDMODULEPREFIX = ''
SConstruct:
- freetype-config is now searched in the path.
Shield symbolizer is now a subclass of text symbolizer.
Some small improvements to text rendering.
Fixed up placement finder for horizontal placement.
Cleaned up placement finder.
2. Pass resolution to bbox query
3. Use variant<int,double,string> as parameter value e.g in Python:
ds = Raster(file="/path/to/file",lox = 12312.4,.....)
Added extractor facility to work with mapnik::parameter (C++):
mapnik::parameters params;
params["parameter0"] = 123.456;
params["parameter1"] = "123.456"; // initialize with string extract double later
boost::optional<double> val0 = params.get<double>("parameter0");
if (val0)
{
std::cout << *val0;
}
// with default value. NOTE: there is no 'parameter2' in params
boost::optional<double> val2 = params.get<double>("parameter2",654.321);
std::cout << * val2;
//
4. Added Gdal factory method in __init__.py
ds = Gdal(file="/tmp/file.tiff")
>>> for f in m.query_point([ layer.name for layer in m.layers ].index('world'),51,0):
... print f
...
feature (
f_code:FA001
fac_id:193
id:3147
na2:UK
na3:E
nam:ENGLAND
tile_id:10
)
>>>
fs = m.query_map_point(x,y) # Map (screen) coordinates
for feature in fs:
print feature
TODO: provide interface to feature in Python, at the moment only __str__ implemented which dumps attributes
ds = Shapefile(file="/../..")
for f in ds.features_at_point(Coord(-2,51)):
print f
TODO:
1.access to Feature properties
2.feature_at_point to accept screen coordinates
3.apply hit_test for geometries.
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')
bool hit_test(double x, double y, double tol);
2. added image_view(unsigned x, unsigned y, unsigned width, unsigned height)
allowing to select region from image data e.g (in Python):
im = Image(2048,2048)
view = im.view(0,0,256,256)
save_to_file(filename,type, view)
3. changed envelope method to return vy value in datasource classes
4. features_at_point impl for shape and postgis plug-ins