cleanups
parent
43be9ff2a1
commit
b58904050a
3 changed files with 12 additions and 98 deletions
|
@ -28,8 +28,7 @@ _The Mapnik Team_
|
|||
|
||||
* *What is Mapnik?*
|
||||
* MapnikOverview | DemoGallery | [mapnik.org](http://mapnik.org/)
|
||||
* Commit Timeline at [Ohloh](https://www.ohloh.net/projects/mapnik):
|
||||
[[Image(http://www.ohloh.net/p/mapnik/analyses/latest/commits_spark.png)]]
|
||||
* Commit Timeline at [Ohloh](https://www.ohloh.net/projects/mapnik)
|
||||
|
||||
* *Installing Mapnik*
|
||||
* MapnikInstallation - Guides for installing Mapnik
|
||||
|
|
|
@ -16,20 +16,11 @@ The AGG renderer ([Antigrain Geometry](http://antigrain.com)) is the primary ren
|
|||
* Version 2.3 of the AGG C++ library is included/embedded within the source tree of Mapnik and compiled automatically during the Scons process.
|
||||
* Because the primary developer of AGG has moved on to other endeavors, we happily maintain our own version of AGG with bugfixes.
|
||||
* Mapnik can also build against a system version of AGG, but this is NOT RECOMMENDED since packaged versions have likely not been updated with critical bug fixes
|
||||
* Use the INTERNAL_LIBAGG option as a scons flag:
|
||||
|
||||
INTERNAL_LIBAGG=False
|
||||
}}}
|
||||
* The need for this option is due in part to [http://www.nabble.com/Statically-linking-against-bundled-libagg-td18803411.html concerns about packaging].
|
||||
|
||||
While Mapnik was the first to use AGG rendering for mapping, the AGG renderer is also now an optional rendering engine in the [http://mapserver.gis.umn.edu/docs/howto/agg-rendering-specifics MapServer] and [http://trac.osgeo.org/mapguide/wiki/MapGuideRfc40 MapGuide] projects.
|
||||
|
||||
Due to licensing issues much discussion exists in the !MapServer and !MapGuide communities about the now GPL-licensed AGG:
|
||||
* http://www.nabble.com/MapGuide-fork-of-AGG-tt13321313.html#a13406886
|
||||
* http://www.nabble.com/Re%3A-MapGuide-fork-of-AGG-p13359220.html
|
||||
While Mapnik was the first to use AGG rendering for mapping, the AGG renderer is also now an optional rendering engine in the [http://mapserver.gis.umn.edu/docs/howto/agg-rendering-specifics MapServer] and [http://trac.osgeo.org/mapguide/wiki/MapGuideRfc40 MapGuide] projects.
|
||||
|
||||
|
||||
== cairo_renderer | Cairographics ==
|
||||
## cairo_renderer | Cairographics
|
||||
|
||||
The [http://cairographics.org/ Cairo] renderer is an auxiliary renderer in Mapnik.
|
||||
* Cairo was added in r656 due to its similar reputation for high quality graphics output to various formats
|
||||
|
@ -39,9 +30,7 @@ The AGG renderer ([Antigrain Geometry](http://antigrain.com)) is the primary ren
|
|||
* You can demo the PNG, JPEG, SVG, PDF, and PS formats using the [http://openstreetmap.org/export/ OSM export tool]
|
||||
* Cairo is optional during Mapnik Scons build process but is enabled automatically if found (using pkg-config).
|
||||
* Pkg-config must find libcairo as well as Cairomm(C++ bindings) and Pycairo (python bindings)
|
||||
* If Pkg-config is successful you will see the added compiler flags
|
||||
{{{
|
||||
-DHAVE_CAIRO -DHAVE_PYCAIRO
|
||||
* If Pkg-config is successful you will see the added compiler flags: `-DHAVE_CAIRO -DHAVE_PYCAIRO`
|
||||
|
||||
|
||||
### Python Example Code
|
||||
|
@ -49,7 +38,7 @@ The AGG renderer ([Antigrain Geometry](http://antigrain.com)) is the primary ren
|
|||
Writing to SVG with Mapnik's Cairo renderer:
|
||||
|
||||
|
||||
#!python
|
||||
```python
|
||||
import mapnik
|
||||
import cairo
|
||||
|
||||
|
@ -70,7 +59,7 @@ Writing to SVG with Mapnik's Cairo renderer:
|
|||
surface = cairo.PDFSurface('mapfile.pdf', mapnik_map.width, mapnik_map.height)
|
||||
mapnik.render(mapnik_map, surface)
|
||||
surface.finish()
|
||||
|
||||
```
|
||||
|
||||
* Note: Cairo can also write to PostScript and other image formats
|
||||
* Note: 'mapnik.render()' can also render to Cairo Contexts
|
||||
|
@ -92,10 +81,9 @@ The client javascript library that works with all major javascript mapping APIs
|
|||
|
||||
It should be noted that while the mbtiles spec also talks about leveraging sqlite as a tile cache the interaction and grid.json should work absolutely fine with any caching format on the filesystem. However, at this time the WAX client javascript code (for legacy reasons) assumes that the tile scheme is [TMS](http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification), which is basically the same as the OSM/Google scheme except that the [Y axis is flipped](http://lists.osgeo.org/pipermail/tiling/2010-September/000015.html) (or the origin is [lower left](http://wiki.osgeo.org/wiki/File:Tms.png) not top left). Luckily it is pretty easy to "flip" the y with code like:
|
||||
|
||||
|
||||
#!python
|
||||
y = (2**z-1) - y
|
||||
|
||||
```python
|
||||
y = (2**z-1) - y
|
||||
```
|
||||
|
||||
|
||||
## Further References
|
||||
|
|
75
Nik2Img.md
75
Nik2Img.md
|
@ -1,8 +1,3 @@
|
|||
<!-- Name: Nik2Img -->
|
||||
<!-- Version: 12 -->
|
||||
<!-- Last-Modified: 2009/10/10 17:37:57 -->
|
||||
<!-- Author: springmeyer -->
|
||||
|
||||
# Mapnik Maps on the Command-Line
|
||||
|
||||
*Nik2img* is a _third-party_ program that allows you to easily generate mapnik graphics from Mapnik xml or Cascadenik mml.
|
||||
|
@ -14,76 +9,8 @@
|
|||
* Like Mapnik, it should run on both Mac, Linux, and Windows
|
||||
|
||||
To Install:
|
||||
|
||||
* Download from http://code.google.com/p/mapnik-utils/
|
||||
* Or use easy_install:
|
||||
|
||||
$ sudo easy_install -U nik2img
|
||||
|
||||
*Note:* These instructions are for the nik2img 0.3.0 release or above.
|
||||
|
||||
[[/images/states.png]]
|
||||
|
||||
### If you want to render your XML mapfile just do:
|
||||
|
||||
|
||||
#!python
|
||||
$ nik2img.py your_mapfile.xml your_map_rendered.png
|
||||
* ,,*Note*: The nik2img.py default output is a 600,300 pixel png, rendered at the maximum extent of all your layers
|
||||
|
||||
### And say you want to see your map reprojected ('--srs') to [Google Spherical Mercator](http://spatialreference.org/ref/user/6/), use the url (or an epsg:code):
|
||||
|
||||
#!python
|
||||
$ nik2img.py map.xml map.png --srs http://spatialreference.org/ref/user/6/
|
||||
* ,,*Note*: the above projection can also be called with '--srs 900913',,
|
||||
|
||||
### Or you want to test all the output formats ('-f all') of Mapnik's AGG and Cairo renderers and see Verbose debugging output ('-v'):
|
||||
|
||||
|
||||
#!python
|
||||
$ nik2img.py map.xml maps/ -f all -v
|
||||
|
||||
### Or you want to run in 'Dry Run' mode('-n') and output no maps, but step through each part of the rendering process using 2 second pauses ('--pause') at each step to watch the progress, and finally set a python debugger trace ('--trace-steps') at step 5 to enter interactive mode:
|
||||
|
||||
Well, admit you are _crazy_, but do it like:
|
||||
|
||||
|
||||
#!python
|
||||
$ nik2img.py map.xml maps -n --pause 2 --trace-step 5 # in this case the pdb_trace() is set immediately following load_map()
|
||||
* ,,*Note*: The python debugger tool emulates your map being loaded and rendered by a custom python script within the python interpreter, allowing you to play around and learn the Mapnik python bindings like:,,
|
||||
|
||||
#!python
|
||||
STEP: 5 // --> BBOX (max extent of all layers) is: Envelope(-180.0,-93.188202,180.0,86.811798)
|
||||
Total time: 6.58748102188 seconds | Last step: 5.00679016113e-06 seconds
|
||||
|
||||
>>> Entering PDB interpreter
|
||||
--Return--
|
||||
> /usr/local/bin/nik2img.py(131)set_trace()->None
|
||||
-> pdb.set_trace()
|
||||
|
||||
(Pdb) self.map
|
||||
<mapnik_utils.metaclass_injectors.Map object at 0x40ef30>
|
||||
(Pdb) self.map.scale()
|
||||
0.096269288333333425
|
||||
(Pdb) self.map.envelope()
|
||||
Envelope(-124.731422,17.9099933333,-66.969849,56.4177086667)
|
||||
(Pdb) self.map.envelope().center()
|
||||
Coord(-95.8506355,37.163851)
|
||||
(Pdb) self.map.background
|
||||
<mapnik._mapnik.Color object at 0x454bc8>
|
||||
(Pdb) print(self.map.background)
|
||||
rgb(140,182,211)
|
||||
(Pdb) self.map.srs
|
||||
'+proj=latlong +datum=WGS84'
|
||||
}}}
|
||||
* ,,Then do:,,
|
||||
{{{
|
||||
#!python
|
||||
(Pdb) continue # will leave the pdb intepreter
|
||||
}}}
|
||||
|
||||
|
||||
=== And for all the options available do: ===
|
||||
|
||||
{{{
|
||||
#!python
|
||||
$ nik2img.py -h
|
||||
|
|
Loading…
Reference in a new issue