No description provided.
[springmeyer] Plan here would be to add resolution parameter to the mapnik::Map class to represent ppi (pixels/inch) (should we specify in microns instead?).
Any a custom resolution provided would be compared against the assummed OGC pixel size of .28 m (see https://trac.mapnik.org/browser/trunk/src/scale_denominator.cpp) to generate a scaling factor that would then be passed to the renderer and used to increase or decrease font and symbol sizes, line widths, and dash-array spacing.
(see also #190 for history on this discussion)
[springmeyer] Okay, during sessions here at Where 2.0 I've got a first implementation working of this. Looking for testing of both AGG and Cairo from anyone interested. The scale factor seems to be working fairly well (given an assumed ~91.x default pixel size), but road casings are getting a bit to thick on first glance.
Here is a basic testing script that depends on the current release 0.3.0 of nik2img and an OSM stylesheet:
from mapnik_utils import Compose as c
m = c('/Users/spring/mapnik/osm.xml', width=3300, height=5100, extent=(-13619265.6938,6002718.44462,-13609481.7542,6012502.38416))
m.image = '92ppi.png'
m.image = '92ppi.pdf'
m.map.resolution = 300
m.image = '300ppi.png'
m.image = '300ppi.pdf'
[springmeyer] Note: the attached patch only scales symbol graphics in the AGG symbolizer. This really needs to be done in all renderers using SVG symbols, so tying this feature into Craig's work will be key.
[springmeyer] FYI: a ruby script to modify XML in place - will be good to test against the output from xml modified with this script: http://www.ancalime.de/images/scalestyle.rb
[springmeyer] see also #155 ad #320 which include code for scaling raster and vector symbols.
[springmeyer] For anyone following this, this patch is waiting on #320, since scaling support is being worked out nicely there. Once #320 lands I'll take a look at revising this patch.
[springmeyer] likely won't get to this till 0.7.0, pushing
[springmeyer] see also #389
[grahamjones139] Replying to [comment:5 springmeyer]:
The script to re-scale a style file is now stored at [http://www.ancalime.de/download/scalestyle.rb] rather than the link given in Comment 5.
[carlos.lopez.garces] Mr. Springmeyer, have you run the script of comment #2 with the osm.xml of the latest openstreetmap release from svn trunk? I ask you this because I had to make many modifications to the xml file to eliminate some xml validation errors that the Compose object was throwing.
[springmeyer] Carlos. No I have not run that script recently so I am not surprised there were some issues. However, the Mapnik_utils stuff is just a wrapper around Mapnik so the validation errors are likely coming from load_map.cpp or ptree_helpers.cpp. It may be that mapnik2 is simply not compatible with latest osm.xml which we should fix if so. I am on the road right now but back around tomorrow. Great progress so far!
[carlos.lopez.garces] I've commited a first implementation of this. Please see the comment I left here: http://trac.mapnik.org/changeset/1834.
The implementation can be tested compiling the code of branch: svn.mapnik.org/branches/mapnik_resolution/, revision 1834 or by applying the patch I'm attaching to revision 1833. The effect can seen by comparing the following two images: original (http://redmine.openpapermaps.com/attachments/download/16) and scaled by a factor of 1.5 (http://redmine.openpapermaps.com/attachments/download/15).
This implementation covers:
The implementation contains one thing I don't like, which is that class cairo_context was modified to achieve the scaling of a polygon and a line. The best, in my opinion would be to reposition the vertices that make up the path of polygons and lines, before passing them to cairo_context's add_path function.
Finally, the implementation can also be tested with a code I placed in: http://svn.mapnik.org/branches/mapnik_resolution/demo/c++/sandbox/, called scale_test.cpp, which produces the same output as rundemo.cpp. A shell script called compile.sh is also in that directory; you can modify it and run it in the same directory to compile the code. To run it, execute: ./scale_test [name of output image file] [width of map] [height of map] [positive scale factor], and the result image will be placed in the img directory. For example: ./scale_test map 800 600 1.5, will scale the map by a factor of 1.5.
[springmeyer] lots of good discussions here, closing as dupe of new, clarified ticket at #695