initial autoconversion of wiki pages using https://gist.github.com/1286682
parent
dbf6fc18be
commit
fb34b267e8
148 changed files with 13593 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.DS_Store
|
58
AlsoFilter.md
Normal file
58
AlsoFilter.md
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<!-- Name: AlsoFilter -->
|
||||||
|
<!-- Version: 4 -->
|
||||||
|
<!-- Last-Modified: 2011/08/30 00:55:41 -->
|
||||||
|
<!-- Author: MaZderMind -->
|
||||||
|
# AlsoFilter
|
||||||
|
A Rule containing an `<AlsoFilter />` is evaluated if and only if at least one other Rule in the current Style matched (according to its ScaleDenominator and Filter).
|
||||||
|
|
||||||
|
Mapnik evaluates all Rules in a Style sequentially from top to bottom, testing each Rule's Filter against the current Object. When all Rules have been evaluated and at least one Filter matched the current Object, the Rules containing an `<AlsoFilter />` are evaluated.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
An `<AlsoFilter />` is useful when you want to draw a bunch of similar things (like POI-Icons) and you would want to add another Symbolizer to each and every Rule in the style. Using a separate `<AlsoFilter />`-Rule avoids duplicating the other Symbolizer over and over.
|
||||||
|
|
||||||
|
Please note, that there are different methods of creating such combined styles, each having their own pros and cons. One possibility would be using [wiki:ShieldSymbolizer]s, which would keep the Icon and the Text together and would never lead to an icon without text or vice versa. In complex styles it's sometimes necessary to place the [wiki:PointSymbolizer]s into a different Style then the [wiki:TextSymbolizer]s in order to gain grater control about the drawing order.
|
||||||
|
|
||||||
|
## Behavior regarding filter-mode="first"
|
||||||
|
With #706 the new `filter-mode` attribute was introduced to the Style object. Setting `filter-mode="first"` in conjunction with an `<AlsoFilter />`-Rule will apply only the first matching Rule of the Style. If a Rule matched, all `<AlsoFilter />`-Rules are applied, too. If no Rule matched, all `<ElseFilter />`-Rules are evaluated.
|
||||||
|
|
||||||
|
## Example in XML
|
||||||
|
For each Object read from the Datasource Mapnik checks if the current ScaleDenominator matches the Min- and Max-Conditions of the first Rule and it the Object has an attribute "amenity" with a value of "restaurant" or "pub".
|
||||||
|
* If the Object _passes_ these tests, the according rule is evaluated. After all normal Rules have been evaluated, the Rules containing an `<AlsoFilter />` are also evaluated.
|
||||||
|
* If the Object _misses_ these tests, none of the rules is evaluated.
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Style name="contours">
|
||||||
|
<Rule>
|
||||||
|
<Filter>[amenity] = 'restaurant'</Filter>
|
||||||
|
|
||||||
|
<MaxScaleDenominator>25000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>100</MinScaleDenominator>
|
||||||
|
|
||||||
|
<PointSymbolizer file="restaurant.png" />
|
||||||
|
</Rule>
|
||||||
|
|
||||||
|
<Filter>[amenity] = 'pub'</Filter>
|
||||||
|
|
||||||
|
<MaxScaleDenominator>25000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>100</MinScaleDenominator>
|
||||||
|
|
||||||
|
<PointSymbolizer file="pub.png" />
|
||||||
|
</Rule>
|
||||||
|
|
||||||
|
<Rule>
|
||||||
|
<AlsoFilter />
|
||||||
|
|
||||||
|
<TextSymbolizer name="[name]" fontset-name="book-fonts" size="9" fill="black" dy="9" halo-radius="1" wrap-width="0" />
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
## Example in Python
|
||||||
|
|
||||||
|
#!python
|
||||||
|
rule = mapnik.Rule()
|
||||||
|
rule.set_also(True) # instead of rule.filter(...)
|
||||||
|
|
||||||
|
## See also
|
||||||
|
* The normal [wiki:Filter]
|
||||||
|
* The (other) special ElseFilter
|
32
ArchInstallation.md
Normal file
32
ArchInstallation.md
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!-- Name: ArchInstallation -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2010/10/27 19:40:25 -->
|
||||||
|
<!-- Author: ajashton -->
|
||||||
|
# Installing Mapnik on Arch Linux
|
||||||
|
|
||||||
|
## Stable version
|
||||||
|
|
||||||
|
The stable release of Mapnik (and all of its dependencies, of course) are available from the Arch Community repository. Install it with Pacman:
|
||||||
|
|
||||||
|
|
||||||
|
$ sudo pacman -S mapnik
|
||||||
|
|
||||||
|
## Mapnik Trunk (aka Mapnik2)
|
||||||
|
|
||||||
|
Installing Mapnik2 will require building a couple packages from source. It is highly recommended you do this using the Arch Build System. If you are unfamiliar with this process read more about it on the Arch Wiki: https://wiki.archlinux.org/index.php/Arch_Build_System . With the ABS and tools like Yaourt, building custom packages for Arch is usually an easy process.
|
||||||
|
|
||||||
|
### Installation from AUR with Yaourt
|
||||||
|
|
||||||
|
If you use Yaourt (or perhaps a similar AUR frontend) installation is greatly simplified. Just install the 'mapnik2-svn' package and Yaourt will handle building and installing Mapnik and its dependencies:
|
||||||
|
|
||||||
|
|
||||||
|
$ yaourt -S mapnik2-svn
|
||||||
|
|
||||||
|
This will build a custom version of Boost against ICU, and pull any other uninstalled dependencies from the Arch 'extra' and 'community' repositories. More info about Yaourt can be found here: https://wiki.archlinux.org/index.php/Yaourt
|
||||||
|
|
||||||
|
### Manual ABS installation
|
||||||
|
|
||||||
|
Details coming soon. For now look at these packages in the AUR:
|
||||||
|
|
||||||
|
* boost-icu: https://aur.archlinux.org/packages.php?ID=42259
|
||||||
|
* mapnik2-svn: https://aur.archlinux.org/packages.php?ID=42260
|
42
BoundsClipping.md
Normal file
42
BoundsClipping.md
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<!-- Name: BoundsClipping -->
|
||||||
|
<!-- Version: 11 -->
|
||||||
|
<!-- Last-Modified: 2011/08/11 10:02:57 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# BoundsClipping
|
||||||
|
|
||||||
|
This is a page to document bounding box clipping in the Mapnik codebase.
|
||||||
|
|
||||||
|
Clipping is used primarily to ensure `valid` and appropriate coordinate bounds are sent to layer datasource plugins when fetching features to render, and is necessary when checking for intersection between a map bbox and its layers when projections differ (since proj4 will fail if invalid extents are used for a given projection).
|
||||||
|
|
||||||
|
Clipping can interact in subtle and important ways with a variety of other map and layer level parameters, and became more error prone (but powerful) with the introduction of support for Proj4 in r330.
|
||||||
|
|
||||||
|
Tickets related to bounding box clipping over time include:
|
||||||
|
* #127 - BBox clipping fails when there's no intersection
|
||||||
|
* #204 - map.buffer_size() does not seem to fetch data within buffer zone
|
||||||
|
* #308 - Mapnik bug when features with invalid coordinates for target projection are encountered
|
||||||
|
* #402 - Some points from PointDatasource get lost on reprojection
|
||||||
|
* #486 - Bounds clipping likely to fail if using map_buffer after r1348
|
||||||
|
* #506 - Add a Map level custom extent or max_extent to enhance clipping ability
|
||||||
|
* #548 - Layer query bbox not correct on Lambert Map
|
||||||
|
* #549 - Problem with local projections and worldwide data extent
|
||||||
|
* #751 - Better handling of bounding box transform (avoids need for 'maximum-extent').
|
||||||
|
|
||||||
|
Key Changesets include:
|
||||||
|
* r522 - initial impl of clipping in feature_style_processor.hpp
|
||||||
|
* r770 - conditional use of proj_transform and clipping
|
||||||
|
* r789 - Check for layer intersection
|
||||||
|
* r851 - ensure clipping always happens against layer extent
|
||||||
|
* r853 - switched to use the buffered map extent (map bbox + map.buffer_size)
|
||||||
|
* r1348 - changed bounds clipping to buffered map extent, created #486
|
||||||
|
* r2776 - added maximum-extent attribute to map (#506)
|
||||||
|
* r2782 - if maximum-extent is provided, clip map query to it (#506), which provides one potential, performant, solution to #549
|
||||||
|
* r2784 - *switch* to first attempt to clip and intersect against map extent, then falling back to layer extent
|
||||||
|
* The fallback to layer clipping should now be rarely needed except where a map buffer pushes potential map extent outside of valid bounds but this can now be solved by supplying 'maximum-extent' (#506)
|
||||||
|
* r2785 - skip rendering specific coordinates which cannot be back projected from the layer srs into the map srs, avoiding the previous outcome of full skipping of features (this is at the cost of potentially odd looking polygons, but should not impact performance)
|
||||||
|
* r3048 - fixed bug in fallback intersection checking that lead to false positive and uneeded clip
|
||||||
|
|
||||||
|
|
||||||
|
IRC discussions:
|
||||||
|
|
||||||
|
Discussion of fixing clipping after addition of map_buffer to avoid truncated text at tile edges:
|
||||||
|
* http://mapnik.dbsgeo.com/mapnik_logs/2009/02/01/ - prediction of #486
|
179
BrokenExceptions.md
Normal file
179
BrokenExceptions.md
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
<!-- Name: BrokenExceptions -->
|
||||||
|
<!-- Version: 6 -->
|
||||||
|
<!-- Last-Modified: 2010/12/02 14:53:05 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
In rare cases boost pythons exception handling breaks.
|
||||||
|
|
||||||
|
I've seen this twice: once with early versions (~ sept 2010) of clang, and also with 64 bit open solaris.
|
||||||
|
|
||||||
|
What happens is that instead of getting a runtime error with some nice message you get a segfault.
|
||||||
|
|
||||||
|
Here are the steps to try to guess what is actually causing the problem:
|
||||||
|
|
||||||
|
## Using GDB
|
||||||
|
|
||||||
|
Run the python executable in gdb:
|
||||||
|
|
||||||
|
( in this example we use the full path to apps for clarity, your system will differ )
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ gdb /usr/bin/amd64/python
|
||||||
|
|
||||||
|
You should get some basic gdb startup output:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
GNU gdb 6.8
|
||||||
|
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
|
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||||
|
This is free software: you are free to change and redistribute it.
|
||||||
|
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
|
||||||
|
and "show warranty" for details.
|
||||||
|
This GDB was configured as "i386-pc-solaris2.11"...
|
||||||
|
(no debugging symbols found)
|
||||||
|
|
||||||
|
Now you have a gdb prompt and you need to run your actual program that is crashing. The goal here is to get a backtrace that may indicate the place where the crash is happening.
|
||||||
|
|
||||||
|
For example, is it happening in a datasource plugin? If so that would point toward a problem configuring the paths to shapefiles or the database connections for postgres.
|
||||||
|
|
||||||
|
Below we run nik2img by typing 'r' then the path to the command and its arguments:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
(gdb) r /usr/bin/nik2img.py osm.xml image.png
|
||||||
|
|
||||||
|
|
||||||
|
You should see a bunch of output like:
|
||||||
|
|
||||||
|
Starting program: /usr/bin/amd64/python /usr/bin/nik2img.py osm.xml t.png
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
warning: Lowest section in /lib/amd64/libdl.so.1 is .dynamic at 00000000000000b0
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
warning: Lowest section in /lib/amd64/libintl.so.1 is .dynamic at 00000000000000b0
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
(no debugging symbols found)
|
||||||
|
warning: Lowest section in /lib/amd64/librt.so.1 is .dynamic at 00000000000000b0
|
||||||
|
warning: Lowest section in /lib/amd64/libpthread.so.1 is .dynamic at 00000000000000b0
|
||||||
|
warning: Lowest section in /lib/amd64/libthread.so.1 is .dynamic at 00000000000000b0
|
||||||
|
|
||||||
|
|
||||||
|
And then if you hit the crash you should see a line like:
|
||||||
|
|
||||||
|
|
||||||
|
Program received signal SIGSEGV, Segmentation fault.
|
||||||
|
|
||||||
|
|
||||||
|
Now, type 'bt' in the interpreter to get the backtrace:
|
||||||
|
|
||||||
|
|
||||||
|
(gdb) bt
|
||||||
|
#0 0x0000000000053735 in ?? ()
|
||||||
|
#1 0xfffffd7fff2ec5d1 in _Unwind_RaiseException_Body () from /usr/lib/amd64/libc.so.1
|
||||||
|
#2 0xfffffd7fff2ec855 in _Unwind_RaiseException () from /usr/lib/amd64/libc.so.1
|
||||||
|
#3 0xfffffd7ffc25bb39 in __cxa_throw (obj=<value optimized out>, tinfo=0x1, dest=0x474e5543432b2b00)
|
||||||
|
at ../../../../.././libstdc++-v3/libsupc++/eh_throw.cc:78
|
||||||
|
#4 0xfffffd7ffaaaa1c8 in shape_datasource::bind () from /usr/local/lib/mapnik/input/shape.input
|
||||||
|
#5 0xfffffd7ffaaaadb5 in shape_datasource::shape_datasource () from /usr/local/lib/mapnik/input/shape.input
|
||||||
|
#6 0xfffffd7ffaaaae80 in create () from /usr/local/lib/mapnik/input/shape.input
|
||||||
|
#7 0xfffffd7ffc4bfa51 in mapnik::datasource_cache::create () from /usr/local/lib/libmapnik.so
|
||||||
|
#8 0xfffffd7ffc459d1b in mapnik::map_parser::parse_layer () from /usr/local/lib/libmapnik.so
|
||||||
|
#9 0xfffffd7ffc469b00 in mapnik::map_parser::parse_map () from /usr/local/lib/libmapnik.so
|
||||||
|
#10 0xfffffd7ffc46b0b7 in mapnik::load_map () from /usr/local/lib/libmapnik.so
|
||||||
|
#11 0xfffffd7ffc76b12a in load_map_overloads::non_void_return_type::gen<boost::mpl::vector4<void, mapnik::Map&, std::string const&, bool> >::func_0 () from /usr/local/lib/python2.6/site-packages/mapnik/64/_mapnik.so
|
||||||
|
#12 0xfffffd7ffc770950 in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (*)(mapnik::Map&, std::string const&), boost::python::default_call_policies, boost::mpl::vector3<void, mapnik::Map&, std::string const&> > >::operator()
|
||||||
|
() from /usr/local/lib/python2.6/site-packages/mapnik/64/_mapnik.so
|
||||||
|
#13 0xfffffd7ffc2db47c in boost::python::objects::function::call () from /usr/local/lib/libboost_python.so.1.44.0
|
||||||
|
#14 0xfffffd7ffc2db730 in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke () from /usr/local/lib/libboost_python.so.1.44.0
|
||||||
|
#15 0xfffffd7ffc2e3053 in boost::python::detail::exception_handler::operator() () from /usr/local/lib/libboost_python.so.1.44.0
|
||||||
|
#16 0xfffffd7ffc76b2e2 in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<mapnik::config_error, void (*)(mapnik::config_error const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(mapnik::config_error const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke () from /usr/local/lib/python2.6/site-packages/mapnik/64/_mapnik.so
|
||||||
|
#17 0xfffffd7ffc2e2e25 in boost::python::handle_exception_impl () from /usr/local/lib/libboost_python.so.1.44.0
|
||||||
|
#18 0xfffffd7ffc2d7d50 in function_call () from /usr/local/lib/libboost_python.so.1.44.0
|
||||||
|
#19 0xfffffd7ffd309aad in PyObject_Call () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#20 0xfffffd7ffd3ac1c0 in do_call () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#21 0xfffffd7ffd3ab672 in call_function () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#22 0xfffffd7ffd3a810d in PyEval_EvalFrameExReal () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#23 0xfffffd7ffd3a4d9d in PyEval_EvalFrameEx () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#24 0xfffffd7ffd3abb95 in fast_function () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#25 0xfffffd7ffd3ab68a in call_function () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#26 0xfffffd7ffd3a810d in PyEval_EvalFrameExReal () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#27 0xfffffd7ffd3a4d9d in PyEval_EvalFrameEx () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#28 0xfffffd7ffd3abb95 in fast_function () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
#29 0xfffffd7ffd3ab68a in call_function () from /usr/lib/amd64/libpython2.6.so.1.0
|
||||||
|
|
||||||
|
|
||||||
|
The most important lines are the top ones:
|
||||||
|
|
||||||
|
Basically in this case it clearly indicates that the problem happened in the 'shape.input' or the Shapefile datasource plugin, and specifically the 'bind()' function.
|
||||||
|
|
||||||
|
We know the bind function is basically the call to create the datasource, so at creation time one of the values must be wrong. A likely possibility is that the path to a shapefile was wrong and mapnik is throwing a datasource exception to tell us this, but because this exception is not caught we cannot know for sure.
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
#0 0x0000000000053735 in ?? ()
|
||||||
|
#1 0xfffffd7fff2ec5d1 in _Unwind_RaiseException_Body () from /usr/lib/amd64/libc.so.1
|
||||||
|
#2 0xfffffd7fff2ec855 in _Unwind_RaiseException () from /usr/lib/amd64/libc.so.1
|
||||||
|
#3 0xfffffd7ffc25bb39 in __cxa_throw (obj=<value optimized out>, tinfo=0x1, dest=0x474e5543432b2b00)
|
||||||
|
at ../../../../.././libstdc++-v3/libsupc++/eh_throw.cc:78
|
||||||
|
#4 0xfffffd7ffaaaa1c8 in shape_datasource::bind () from /usr/local/lib/mapnik/input/shape.input
|
||||||
|
#5 0xfffffd7ffaaaadb5 in shape_datasource::shape_datasource () from /usr/local/lib/mapnik/input/shape.input
|
||||||
|
|
||||||
|
To leave gdb do:
|
||||||
|
|
||||||
|
|
||||||
|
quit
|
||||||
|
|
||||||
|
It is a sad thing, but perhaps the only definitive way to figure out what is wrong without being able to fix the ultimate problem is to replace any `throw`s with std::exit like:
|
||||||
|
|
||||||
|
|
||||||
|
#!cpp
|
||||||
|
Index: plugins/input/shape/shape.cpp
|
||||||
|
===================================================================
|
||||||
|
--- plugins/input/shape/shape.cpp (revision 2441)
|
||||||
|
+++ plugins/input/shape/shape.cpp (working copy)
|
||||||
|
@@ -54,8 +54,13 @@
|
||||||
|
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8"))
|
||||||
|
{
|
||||||
|
boost::optional<std::string> file = params.get<std::string>("file");
|
||||||
|
- if (!file) throw datasource_exception("missing <file> parameter");
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+ if (!file)
|
||||||
|
+ {
|
||||||
|
+ std::clog << "missing <file> parameter\n";
|
||||||
|
+ std::exit(1);
|
||||||
|
+///throw datasource_exception("missing <file> parameter");
|
||||||
|
+}
|
||||||
|
boost::optional<std::string> base = params.get<std::string>("base");
|
||||||
|
if (base)
|
||||||
|
shape_name_ = *base + "/" + *file;
|
||||||
|
@@ -76,7 +81,8 @@
|
||||||
|
|
||||||
|
if (!boost::filesystem::exists(shape_name_ + ".shp"))
|
||||||
|
{
|
||||||
|
- throw datasource_exception("shapefile '" + shape_name_ + ".shp' does not exist");
|
||||||
|
+ std::clog << "shapefile '" << shape_name_ << ".shp' does not exist";
|
||||||
|
+ std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (boost::filesystem::is_directory(shape_name_ + ".shp"))
|
201
BuildBot.md
Normal file
201
BuildBot.md
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
<!-- Name: BuildBot -->
|
||||||
|
<!-- Version: 9 -->
|
||||||
|
<!-- Last-Modified: 2009/10/18 14:54:16 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
## Mapnik BuildBot
|
||||||
|
|
||||||
|
### How it works
|
||||||
|
|
||||||
|
Mapnik developer Beau Gunderson hosts a "master" buildbot instance here:
|
||||||
|
|
||||||
|
http://miranda.nwcr.net:8010/waterfall
|
||||||
|
|
||||||
|
This instance watches Mapnik svn for new commits and re-builds mapnik with each code change.
|
||||||
|
|
||||||
|
Currently on the main 'miranda' server we have both a "slave" that tests Mapnik compile/build/tests on freebsd and another that does it Ubuntu8.10
|
||||||
|
|
||||||
|
### Setting up a new Slave
|
||||||
|
|
||||||
|
If you have a machine that has good network connectivity and at least 500 MB available ram (no static IP needed) then adding it as a "slave" is easy:
|
||||||
|
|
||||||
|
We are looking for all possible unix, linux, and mac osx flavors and various boost versions (especially 1_34 and the latest releases)
|
||||||
|
|
||||||
|
Install buildbot:
|
||||||
|
|
||||||
|
|
||||||
|
# or use package management...
|
||||||
|
# easy_install twisted
|
||||||
|
# easy_install buildbot
|
||||||
|
# easy_install nose
|
||||||
|
|
||||||
|
Add a unix user called 'mapnikslave':
|
||||||
|
|
||||||
|
# adduser mapnikslave
|
||||||
|
|
||||||
|
Email Beau (beau - at - beaugunderson.com) with your desired <slave name> (essentially a username),<password>, and desired 'Builder' name.
|
||||||
|
|
||||||
|
Builder names should be descriptive, like 'springmeyer-Ubuntu-8.10-i686', including something like 'person-platform-version-arch'.
|
||||||
|
|
||||||
|
Beau will set up a 'Builder' record for you that is associated with your slavename/password.
|
||||||
|
|
||||||
|
Then create this instance (you can also do this before and edit the details later):
|
||||||
|
|
||||||
|
# buildbot create-slave /home/mapnikslave/Buildbot miranda.nwcr.net:9989 <slave name> <password>
|
||||||
|
|
||||||
|
This will create a Buildbot folder and config files that look like:
|
||||||
|
|
||||||
|
|
||||||
|
$ more Buildbot/buildbot.tac
|
||||||
|
|
||||||
|
from twisted.application import service
|
||||||
|
from buildbot.slave.bot import BuildSlave
|
||||||
|
|
||||||
|
basedir = r'/home/mapnikslave/Buildbot'
|
||||||
|
buildmaster_host = 'miranda.nwcr.net'
|
||||||
|
port = 9989
|
||||||
|
slavename = 'SLAVENAME'
|
||||||
|
passwd = 'PASSWORD'
|
||||||
|
keepalive = 60
|
||||||
|
usepty = 1
|
||||||
|
umask = None
|
||||||
|
|
||||||
|
application = service.Application('buildslave')
|
||||||
|
s = BuildSlave(buildmaster_host, port, slavename, passwd, basedir,
|
||||||
|
keepalive, usepty, umask=umask)
|
||||||
|
s.setServiceParent(application)
|
||||||
|
|
||||||
|
To start the server then do:
|
||||||
|
|
||||||
|
|
||||||
|
cd ~/
|
||||||
|
buildbot start Buildbot
|
||||||
|
|
||||||
|
This process should daemonize (and talk with the master) and you'll only need to restart it when you reboot
|
||||||
|
|
||||||
|
## To Do
|
||||||
|
|
||||||
|
Currently the Master setup is a bit hardcoded and requires a 'user' named 'mapnikslave' in a /home directory common on linux.
|
||||||
|
|
||||||
|
But, this does not work for systems without /home directories (like OS X), so we need to investigate making the primary build master config a bit more flexible (http://buildbot.net/trac/ticket/541)
|
||||||
|
|
||||||
|
Also, it would be cool to be able to kick off, and get results back from #mapnik irc.
|
||||||
|
|
||||||
|
Currently the 'master.cfg' looks like:
|
||||||
|
|
||||||
|
|
||||||
|
If you can figure out a way to have buildbot put the files in the same
|
||||||
|
place on both our machines without specifying it like that I would be
|
||||||
|
more than willing to set it up!
|
||||||
|
|
||||||
|
I will attach the current 'master.cfg' for the build master--have a
|
||||||
|
look and see if there's anything we can add to the build to make a
|
||||||
|
relative path work, maybe? I tried that and scons installed files
|
||||||
|
relative to where they were compiled from and not from a single
|
||||||
|
directory relative to the path scons was run from.
|
||||||
|
|
||||||
|
Here it is:
|
||||||
|
|
||||||
|
c = BuildmasterConfig = {}
|
||||||
|
|
||||||
|
####### BUILDSLAVES
|
||||||
|
|
||||||
|
from buildbot.buildslave import BuildSlave
|
||||||
|
c['slaves'] = [
|
||||||
|
BuildSlave("miranda", "SECRET", max_builds=2),
|
||||||
|
BuildSlave("dane", "SECRET", max_builds=2),
|
||||||
|
]
|
||||||
|
|
||||||
|
c['slavePortnum'] = 9989
|
||||||
|
|
||||||
|
####### CHANGESOURCES
|
||||||
|
|
||||||
|
svnroot = "http://svn.mapnik.org/trunk/"
|
||||||
|
|
||||||
|
from buildbot.changes.pb import PBChangeSource
|
||||||
|
from buildbot.changes.svnpoller import SVNPoller
|
||||||
|
c['change_source'] = [PBChangeSource(), SVNPoller(svnurl=svnroot,
|
||||||
|
pollinterval=60*10, svnbin="/usr/local/bin/svn")]
|
||||||
|
|
||||||
|
####### SCHEDULERS
|
||||||
|
|
||||||
|
from buildbot.scheduler import Scheduler
|
||||||
|
c['schedulers'] = []
|
||||||
|
c['schedulers'].append(Scheduler(name="all", branch=None,
|
||||||
|
treeStableTimer=5*60,
|
||||||
|
builderNames=["mapnik-freebsd"]))
|
||||||
|
|
||||||
|
####### BUILDERS
|
||||||
|
|
||||||
|
from buildbot.process import factory
|
||||||
|
from buildbot.steps.source import SVN
|
||||||
|
from buildbot.steps.shell import Compile, Configure, Test,
|
||||||
|
WarningCountingShellCommand, ShellCommand
|
||||||
|
|
||||||
|
class Install(WarningCountingShellCommand):
|
||||||
|
name = "install"
|
||||||
|
haltOnFailure = 1
|
||||||
|
flunkOnFailure = 1
|
||||||
|
description = ["installing"]
|
||||||
|
descriptionDone = ["installed"]
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
f1 = factory.BuildFactory()
|
||||||
|
|
||||||
|
f1.addStep(SVN(svnurl=svnroot))
|
||||||
|
f1.addStep(Configure(command=["python", "scons/scons.py", "configure",
|
||||||
|
"INPUT_PLUGINS=all", "COLOR_PRINT=false",
|
||||||
|
"PYTHON_PREFIX=/home/mapnikslave/install",
|
||||||
|
"PREFIX=/home/mapnikslave/install"]))
|
||||||
|
f1.addStep(Compile(command=["python", "scons/scons.py"]))
|
||||||
|
f1.addStep(Install(command=["python", "scons/scons.py", "install"]))
|
||||||
|
f1.addStep(Test(command=["python", "tests/run_tests.py",
|
||||||
|
"--prefix=/home/mapnikslave/install"]))
|
||||||
|
|
||||||
|
b1 = {
|
||||||
|
'name': "mapnik-freebsd",
|
||||||
|
'slavename': "miranda",
|
||||||
|
'builddir': "freebsd",
|
||||||
|
'factory': f1,
|
||||||
|
'env': { 'LD_LIBRARY_PATH': '/home/mapnikslave/install/lib' }
|
||||||
|
}
|
||||||
|
|
||||||
|
b2 = {
|
||||||
|
'name': "mapnik-linux",
|
||||||
|
'slavename': "dane",
|
||||||
|
'builddir': "linux",
|
||||||
|
'factory': f1,
|
||||||
|
'env': { 'LD_LIBRARY_PATH': '/home/mapnikslave/install/lib' }
|
||||||
|
}
|
||||||
|
|
||||||
|
c['builders'] = [b1, b2]
|
||||||
|
|
||||||
|
####### STATUS TARGETS
|
||||||
|
|
||||||
|
c['status'] = []
|
||||||
|
|
||||||
|
from buildbot.status import html
|
||||||
|
c['status'].append(html.WebStatus(http_port=8010, allowForce=True))
|
||||||
|
|
||||||
|
# from buildbot.status import mail
|
||||||
|
# c['status'].append(mail.MailNotifier(fromaddr="buildbot@localhost",
|
||||||
|
# extraRecipients=["builds@example.com"],
|
||||||
|
# sendToInterestedUsers=False))
|
||||||
|
#
|
||||||
|
# from buildbot.status import words
|
||||||
|
# c['status'].append(words.IRC(host="irc.example.com", nick="bb",
|
||||||
|
# channels=["#example"]))
|
||||||
|
#
|
||||||
|
# from buildbot.status import client
|
||||||
|
# c['status'].append(client.PBListener(9988))
|
||||||
|
|
||||||
|
####### DEBUGGING OPTIONS
|
||||||
|
|
||||||
|
#c['debugPassword'] = "mapmapbuild"
|
||||||
|
|
||||||
|
####### PROJECT IDENTITY
|
||||||
|
|
||||||
|
c['projectName'] = "Mapnik"
|
||||||
|
c['projectURL'] = "http://www.mapnik.org/"
|
||||||
|
|
||||||
|
c['buildbotURL'] = "http://miranda.nwcr.net:8010/"
|
109
BuildingOnWindows.md
Normal file
109
BuildingOnWindows.md
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
<!-- Name: BuildingOnWindows -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2011/02/23 14:19:34 -->
|
||||||
|
<!-- Author: roel_v -->
|
||||||
|
To build mapnik on Windows with Visual Studio you need experience with Visual Studio and C++ development experience in general. Mapnik has a relatively large list of dependencies. I've tried to automate a large part of the process with the batch file below. I've only tested with the versions of the libraries listed below. Boost is not included here, it needs to be build separately.
|
||||||
|
|
||||||
|
This build includes all libraries statically. That way you can make one self-contained binary.
|
||||||
|
|
||||||
|
To build under MSVC, you need to patch the code a bit (as of mapnik 0.7.1). Search the trac for patches by me (roel_v), there are 4 of them.
|
||||||
|
|
||||||
|
For the libraries where no build system is available out of the box, you can download the project files from the mapnik php extension at https://github.com/roel-v/php_mapnik .
|
||||||
|
|
||||||
|
This setup assumes a directory structure where all libraries are stored under a 'thirdparty' directory, where the .lib files will be copied to.
|
||||||
|
|
||||||
|
Working as of Januari 2011. Don't just blindly copy and paste, it's more a recipe for the steps to take than an actual working script. You still need to follow the instructions in the comments.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
rem Script to build all prereq libraries for mapnik on Windows
|
||||||
|
rem using msvc, with as little external dependencies as possible.
|
||||||
|
rem For all these libraries, build the static version.
|
||||||
|
|
||||||
|
"c:\program files\microsoft visual Studio\vc\bin\vcvars32.bat"
|
||||||
|
|
||||||
|
cd thirdparty
|
||||||
|
|
||||||
|
rem zlib - www.zlib.org, 1.2.5
|
||||||
|
rem Uses standard makefile, build with nmake
|
||||||
|
rem Add to win32/Makefile.msc: LOC = -DGAS_COFF
|
||||||
|
rem Output: zlib.lib
|
||||||
|
cd zlib-1.2.5
|
||||||
|
nmake -f win32/Makefile.msc zlib.lib
|
||||||
|
copy zlib.lib ..
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rem freetype
|
||||||
|
rem Uses arcane Makefile (not sure what format) or jam. PITA
|
||||||
|
rem to get working, use own project. Check docs\INSTALL.ANY
|
||||||
|
rem because for some reason some files cannot be included in
|
||||||
|
rem the build.
|
||||||
|
rem Output: freetype.lib
|
||||||
|
cd freetype-2.4.4
|
||||||
|
copy ..\..\vs_project\Debug\freetype.lib ..
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rem icu
|
||||||
|
rem Uses autotools or MSVC 10 project files. Use own project.
|
||||||
|
rem Output: icu.lib
|
||||||
|
cd icu\source
|
||||||
|
|
||||||
|
cd data
|
||||||
|
nmake -f makedata.mak ICUMAKE="C: \tmp\mapnik-0.7.1\thirdparty\icu\source\data"
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
copy ..\..\..\vs_project\Debug\icu.lib ..\..
|
||||||
|
cd ..\..
|
||||||
|
|
||||||
|
rem libjpeg
|
||||||
|
rem Makefile-based, provides VC version.
|
||||||
|
rem Output: libjpeg.lib
|
||||||
|
cd jpeg-8b
|
||||||
|
copy jconfig.vc jconfig.h
|
||||||
|
nmake -f makefile.vc
|
||||||
|
copy libjpeg.lib ..
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rem libxml2
|
||||||
|
rem Used an autotool emulation file based on cscript.
|
||||||
|
rem Note that it seems to have a bug, and the Makefile.msvc needs to
|
||||||
|
rem be edited to remove a + from some lines.
|
||||||
|
rem Output: bin.msvc\libxml2_a.lib
|
||||||
|
cd libxml2-2.7.8
|
||||||
|
cd win32
|
||||||
|
cscript configure.js zlib=yes icu=yes debug=yes static=yes iconv=no include=..\..\icu\source\common;..\..\zlib-1.2.5
|
||||||
|
nmake -f Makefile.msvc libxmla
|
||||||
|
copy bin.msvc\libxml2_a.lib ..\..
|
||||||
|
cd ..
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rem libpng
|
||||||
|
rem Uses hardcoded zlib header path in makefile.vcwin32, edit as needed
|
||||||
|
rem Output: libpng.lib
|
||||||
|
cd lpng145
|
||||||
|
nmake -f scripts/makefile.vcwin32 libpng.lib
|
||||||
|
copy libpng.lib ..
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rem proj4
|
||||||
|
rem Make-based system
|
||||||
|
rem Output: proj.lib
|
||||||
|
cd proj-4.7.0
|
||||||
|
nmake -f makefile.vc
|
||||||
|
copy src\proj.lib ..
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rem libtiff
|
||||||
|
rem Make based
|
||||||
|
rem Output:
|
||||||
|
cd tiff-3.9.4
|
||||||
|
nmake -f Makefile.vc
|
||||||
|
copy libtiff\libtiff.lib ..
|
||||||
|
cd..
|
||||||
|
|
||||||
|
rem Back into root directory
|
||||||
|
cd ..
|
||||||
|
|
44
BuildingSymbolizer.md
Normal file
44
BuildingSymbolizer.md
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<!-- Name: BuildingSymbolizer -->
|
||||||
|
<!-- Version: 3 -->
|
||||||
|
<!-- Last-Modified: 2009/02/06 07:56:36 -->
|
||||||
|
<!-- Author: jamierob -->
|
||||||
|
## Configuration Options for BuildingSymbolizer
|
||||||
|
|
||||||
|
` A BuildingSymbolizer is used to create a pseudo 3D effect on polygons. `
|
||||||
|
|
||||||
|
|| *parameter* || *value* || *default* ||
|
||||||
|
|| fill || CSS colour || "FIXME" ||
|
||||||
|
|| fill-opacity || integer || "FIXME" ||
|
||||||
|
|| height || integer || "FIXME" ||
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Default
|
||||||
|
|
||||||
|
` FIXME: Add image `
|
||||||
|
|
||||||
|
#### XML
|
||||||
|
|
||||||
|
{{{
|
||||||
|
#!xml
|
||||||
|
<BuildingSymbolizer>
|
||||||
|
<CssParameter name="fill">#000000</CssParameter>
|
||||||
|
<CssParameter name="fill-opacity">1</CssParameter>
|
||||||
|
<CssParameter name="height">8</CssParameter>
|
||||||
|
</BuildingSymbolizer>
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#### Python
|
||||||
|
|
||||||
|
` FIXME `
|
||||||
|
|
||||||
|
#### C++
|
||||||
|
|
||||||
|
` FIXME `
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Example output:
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
[[Image(BuildingSymbolizer.png)]]
|
68
BuildingwithAutotools.md
Normal file
68
BuildingwithAutotools.md
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<!-- Name: BuildingwithAutotools -->
|
||||||
|
<!-- Version: 7 -->
|
||||||
|
<!-- Last-Modified: 2009/04/04 15:13:42 -->
|
||||||
|
<!-- Author: audifahrer -->
|
||||||
|
# Building with Autotools
|
||||||
|
|
||||||
|
If you get Mapnik from SVN or don't have a bootstrapped package (no _configure_ script in the package root) than you need to generate the Autotools Makefiles before you could configure your build. Just do a
|
||||||
|
|
||||||
|
|
||||||
|
$ ./bootstrap
|
||||||
|
|
||||||
|
You need various developer tool installed to finish this process successful. If tools are missing then the _bootstrap_ script will tell you about.
|
||||||
|
|
||||||
|
Latest at this point you have a _configure_ script available in the package root directory. Just execute it with
|
||||||
|
|
||||||
|
|
||||||
|
$ ./configure --help
|
||||||
|
|
||||||
|
to see a short help description about each possible switch. The important part is here:
|
||||||
|
|
||||||
|
|
||||||
|
--enable-debug=no/yes enables debug build (default=no)
|
||||||
|
--enable-profiling=no/yes enables profiling build (default=no)
|
||||||
|
--enable-tracing=no/yes enables tracing build (default=no)
|
||||||
|
--enable-included-agg=no/yes enables included libagg build (default=yes)
|
||||||
|
--enable-libxml2=no/yes enables libxml2 support (default=no)
|
||||||
|
--enable-cairo=no/yes enables cairo support (default=yes)
|
||||||
|
|
||||||
|
More specific information about this switches will follow below. At first you could call the configure script without any additional parameters.
|
||||||
|
|
||||||
|
|
||||||
|
$ ./configure
|
||||||
|
|
||||||
|
*Hint: * Alternative you could use the _autogen.sh_ script to do the same as with the _configure_ script, but automatically bootstrap the environment:
|
||||||
|
|
||||||
|
|
||||||
|
% ./autogen.sh
|
||||||
|
|
||||||
|
If any required dependencies are failing, then the _configure_ script will stop and tell you about it. If it runs through with success than you'll see a print out like this:
|
||||||
|
|
||||||
|
|
||||||
|
Build configuration:
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Library support:
|
||||||
|
cairo ......................... yes
|
||||||
|
build included agg library..... yes
|
||||||
|
libxml2 loader ................ no
|
||||||
|
|
||||||
|
Plugin support:
|
||||||
|
build plugin (input/postgis)... yes
|
||||||
|
build plugin (input/gdal)...... yes
|
||||||
|
build plugin (input/ogr)....... yes
|
||||||
|
build plugin (input/osm)....... no
|
||||||
|
build plugin (input/sqlite).... yes
|
||||||
|
|
||||||
|
Utility support:
|
||||||
|
build shapeindex............... yes
|
||||||
|
build pgsql2sqlite............. yes
|
||||||
|
|
||||||
|
Debugging support:
|
||||||
|
debugger (gdb)................. no
|
||||||
|
profiling (gprof).............. no
|
||||||
|
tracing (log output)........... no
|
||||||
|
|
||||||
|
Some features are activated simply by installing some packages and autodetect. Others need to be activated with the switches above.
|
||||||
|
|
||||||
|
*TODO: Describe the switches! *
|
18
CairoVersions.md
Normal file
18
CairoVersions.md
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<!-- Name: CairoVersions -->
|
||||||
|
<!-- Version: 5 -->
|
||||||
|
<!-- Last-Modified: 2011/09/06 11:25:01 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Cairo Version
|
||||||
|
|
||||||
|
|
||||||
|
## Ubuntu Natty 11.04
|
||||||
|
|
||||||
|
We recommend following ubuntu versions.
|
||||||
|
|
||||||
|
* Cairo: 1.10.2
|
||||||
|
* Cairomm: 1.9.8
|
||||||
|
* libsigc++: 1.0.4
|
||||||
|
* libpixman: 0.20.2
|
||||||
|
* libfontconfig: 2.8.0
|
||||||
|
* freetype2: 2.4.4
|
||||||
|
* pycairo - 1.8.8
|
27
CamelCase.md
Normal file
27
CamelCase.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<!-- Name: CamelCase -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2006/12/11 18:32:26 -->
|
||||||
|
<!-- Author: trac -->
|
||||||
|
# CamelCase
|
||||||
|
New words created by smashing together capitalized words.
|
||||||
|
|
||||||
|
CamelCase is the original wiki convention for creating hyperlinks, with the additional requirement that the capitals are followed by a lower-case letter; hence “AlabamA” and “ABc” will not be links.
|
||||||
|
|
||||||
|
## Customizing the Wiki behavior
|
||||||
|
|
||||||
|
Some people dislike linking by CamelCase. While Trac remains faithful to the original Wiki style, it provides a number of ways to accomodate users with different preferences:
|
||||||
|
* There's an option (`ignore_missing_pages` in `[wiki]`) to simply ignore links to missing pages when the link is written using the CamelCase style, instead of that word being replaced by a gray link followed by a question mark.[[BR]]
|
||||||
|
That can be useful when CamelCase style is used to name code artifacts like class names and there's no corresponding page for them.
|
||||||
|
* There's an option (`split_page_names` in `[wiki]`) to automatically insert space characters between the words of a CamelCase link when rendering the link.
|
||||||
|
* Creation of explicit Wiki links is also easy, see WikiPageNames for details.
|
||||||
|
* In addition, Wiki formatting can be disabled completely in some places (e.g. when rendering commit log messages)
|
||||||
|
|
||||||
|
See TracIni for more information on the available options.
|
||||||
|
|
||||||
|
## More information on CamelCase
|
||||||
|
|
||||||
|
* http://c2.com/cgi/wiki?WikiCase
|
||||||
|
* http://en.wikipedia.org/wiki/CamelCase
|
||||||
|
|
||||||
|
----
|
||||||
|
See also: WikiPageNames, WikiNewPage, WikiFormatting, TracWiki
|
90
CentOS_RHEL.md
Normal file
90
CentOS_RHEL.md
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
<!-- Name: CentOS/RHEL -->
|
||||||
|
<!-- Version: 6 -->
|
||||||
|
<!-- Last-Modified: 2010/09/28 06:25:41 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# CentOS/RHEL Installation
|
||||||
|
|
||||||
|
*Note:* These instructions are out of date. Until these are updated better references are:
|
||||||
|
* http://svn.osgeo.org/osgeo/foss4g/benchmarking/mapnik/scripts/install_mapnik_rhel_5.5.sh
|
||||||
|
* http://krisarnold.com/2010/07/14/installing-mapnik-on-centos-5/
|
||||||
|
|
||||||
|
## Installation Notes
|
||||||
|
See also: https://lists.berlios.de/pipermail/mapnik-users/2010-March/003034.html
|
||||||
|
|
||||||
|
Some tips and hints for installing Mapnik on CentOS 5.2, default "Server" install.
|
||||||
|
|
||||||
|
All this is done as root. You don't HAVE to be root, but doing it as a regular user is much more complicated and I'm not going to document it here.
|
||||||
|
|
||||||
|
You will need to add, at the very LEAST, the following development packages:
|
||||||
|
|
||||||
|
|
||||||
|
# yum install freetype-devel
|
||||||
|
# yum install libtool-ltdl-devel
|
||||||
|
# yum install libpng-devel
|
||||||
|
# yum install libtiff-devel
|
||||||
|
# yum install libjpeg-devel
|
||||||
|
# yum install gcc-c++
|
||||||
|
# yum install libicu-devel
|
||||||
|
# yum install python-devel
|
||||||
|
# yum install bzip2-devel
|
||||||
|
|
||||||
|
This will install all necessary dependencies also!
|
||||||
|
|
||||||
|
Although CentOS comes with a version of Boost, it is not complete, and it's unclear as to whether it was compiled with multi-threaded support.
|
||||||
|
|
||||||
|
Therefore, I decided to download and compile my own (1.37 as of this writing).
|
||||||
|
|
||||||
|
You can get the latest version [here](http://www.boost.org/users/download/).
|
||||||
|
|
||||||
|
Installing it is fairly trivial, using the usual paradigm, though compilation can take a while.
|
||||||
|
|
||||||
|
I did:
|
||||||
|
|
||||||
|
|
||||||
|
# ./configure --with-libraries=all
|
||||||
|
# make
|
||||||
|
# make install
|
||||||
|
|
||||||
|
Then, obtain compile and install [PROJ.4](http://trac.osgeo.org/proj/). Again the usual paradigm of "configure", "make", "make install" works great.
|
||||||
|
|
||||||
|
You will need to make sure /usr/local/lib is in the path to the linker so all these now libraries will be found. You do this by adding a file in:
|
||||||
|
|
||||||
|
/etc/ld.so.conf.d
|
||||||
|
|
||||||
|
that contains:
|
||||||
|
|
||||||
|
/usr/local/lib
|
||||||
|
|
||||||
|
and then run "ldconfig". Do this now, after installing Boost and PROJ.4.
|
||||||
|
|
||||||
|
You can now download and install Mapnik.
|
||||||
|
|
||||||
|
Once you've extracted the source tree from the archive you downloaded, run:
|
||||||
|
|
||||||
|
|
||||||
|
# python scons/scons.py BOOST_INCLUDES=/usr/local/include/boost-1_37/ BOOST_TOOLKIT=gcc41 install
|
||||||
|
|
||||||
|
This will build and install the Mapnik library, the default fonts, the input plugins and the Python bindings.
|
||||||
|
|
||||||
|
Run "ldconfig" once more to make sure the linker sees the new Mapnik stuff.
|
||||||
|
|
||||||
|
And finally, run the python demo, just to make sure everything works OK. The demo is in the source tree, under demo/python.
|
||||||
|
|
||||||
|
|
||||||
|
# cd /path/to/source/demo/python
|
||||||
|
# python rundemo.py
|
||||||
|
|
||||||
|
|
||||||
|
Three maps have been rendered in the current directory:
|
||||||
|
- demo.jpg
|
||||||
|
- demo.png
|
||||||
|
- demo256.png
|
||||||
|
|
||||||
|
Have a look!
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
If you see that output, no errors, and find those 3 images in the current directory, all went well.
|
||||||
|
|
||||||
|
Otherwise, time to debug, or ask the mailing list for help!
|
5
ChangeLog.md
Normal file
5
ChangeLog.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!-- Name: ChangeLog -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2009/04/02 13:44:30 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[ReST(/trunk/CHANGELOG)]]
|
62
CodingStandards.md
Normal file
62
CodingStandards.md
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<!-- Name: CodingStandards -->
|
||||||
|
<!-- Version: 5 -->
|
||||||
|
<!-- Last-Modified: 2009/11/09 09:21:05 -->
|
||||||
|
<!-- Author: artem -->
|
||||||
|
# Coding Standards
|
||||||
|
|
||||||
|
There are no coding standards yet defined for this project. This is an initial attempt to create some.
|
||||||
|
|
||||||
|
This needs to be discussed, since the current document is just a single person's draft.
|
||||||
|
|
||||||
|
## C++
|
||||||
|
|
||||||
|
* Trailing whitespace is never allowed. This includes lines with nothing but spaces or tabs in them, as well as spaces or tabs being the last characters on a line with non-whitespace characters.
|
||||||
|
* Indentation is four spaces.
|
||||||
|
* Case statements?
|
||||||
|
* Public and private declarations?
|
||||||
|
* Line continuation?
|
||||||
|
* Should a maximum line limit be enforced?
|
||||||
|
* Single spaces should surround all binary operators (e.g. +, -. =, /, <<, >>).
|
||||||
|
* Parenthesis should not contain padding spaces:
|
||||||
|
* Acceptable: (a == b)
|
||||||
|
* Not Acceptable: ( a == b )
|
||||||
|
* Function definitions should not be separated from their arguments:
|
||||||
|
* Acceptable: void foo(int a) { ... }
|
||||||
|
* Not Acceptable: void foo (int a) { ... }
|
||||||
|
* Keywords should be separated from their arguments by a single space:
|
||||||
|
* Acceptable: if (a == b)
|
||||||
|
* Not Acceptable: if(a == b)
|
||||||
|
* Braces should always be on a separate line, and indented to the same level as the line that they're associated with.
|
||||||
|
* Functions should be separated from each other by a single blank line.
|
||||||
|
* Comma-separated lists should have spaces after each comma.
|
||||||
|
|
||||||
|
(Emacs C++ mode - copy & paste into .emacs file)
|
||||||
|
|
||||||
|
;; mapnik c++
|
||||||
|
|
||||||
|
(setq c-default-style "bsd")
|
||||||
|
;; no tabs please
|
||||||
|
(setq indent-tabs-mode nil)
|
||||||
|
;; ident by four spaces
|
||||||
|
(setq c-basic-offset 4)
|
||||||
|
;; don't ident inside namespace decl
|
||||||
|
(c-set-offset 'innamespace 0)
|
||||||
|
;;
|
||||||
|
(c-set-offset 'template-args-cont 'c-lineup-template-args)
|
||||||
|
|
||||||
|
|
||||||
|
## Python
|
||||||
|
|
||||||
|
It would probably be best to follow Guido van Rossum's preferred coding style, as documented in [PEP 8](http://www.python.org/dev/peps/pep-0008/).
|
||||||
|
|
||||||
|
* Trailing whitespace is never allowed. This includes lines with nothing but spaces or tabs in them, as well as spaces or tabs being the last characters on a line with non-whitespace characters.
|
||||||
|
* Indentation is four spaces.
|
||||||
|
|
||||||
|
## Tools
|
||||||
|
|
||||||
|
We will need some tools to automatically reformat the code before a commit is done. The initial run of these tools will likely result in a massive commit that only contains formatting changes.
|
||||||
|
|
||||||
|
Candidates:
|
||||||
|
* [astyle](http://astyle.sourceforge.net/)
|
||||||
|
* [GC GreatCode](http://sourceforge.net/projects/gcgreatcode/)
|
||||||
|
* [indent](http://www.gnu.org/software/indent/)
|
28
Compositing.md
Normal file
28
Compositing.md
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!-- Name: Compositing -->
|
||||||
|
<!-- Version: 3 -->
|
||||||
|
<!-- Last-Modified: 2010/09/26 04:40:59 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Compositing examples (work in progress)
|
||||||
|
|
||||||
|
See brainstorming at Ideas/Compositing in terms of a potential syntax....
|
||||||
|
|
||||||
|
Below are tests that artem did using agg composing functions.
|
||||||
|
|
||||||
|
## Multiply
|
||||||
|
[[Image(htdocs:/images/compositing/multiply.png)]]
|
||||||
|
== Colour burn ==
|
||||||
|
[[Image(htdocs:/images/compositing/color_burn.png)]]
|
||||||
|
== Color dodge ==
|
||||||
|
[[Image(htdocs:/images/compositing/color_dodge.png)]]
|
||||||
|
## Contrast
|
||||||
|
[[Image(htdocs:/images/compositing/contrast.png)]]
|
||||||
|
## Difference
|
||||||
|
[[Image(htdocs:/images/compositing/difference.png)]]
|
||||||
|
## Exclusion
|
||||||
|
[[Image(htdocs:/images/compositing/exclusion.png)]]
|
||||||
|
== Hard Light ==
|
||||||
|
[[Image(htdocs:/images/compositing/hard_light.png)]]
|
||||||
|
== Soft Light ==
|
||||||
|
[[Image(htdocs:/images/compositing/soft_light.png)]]
|
||||||
|
|
||||||
|
TODO
|
115
DebianInstallation.md
Normal file
115
DebianInstallation.md
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
<!-- Name: DebianInstallation -->
|
||||||
|
<!-- Version: 14 -->
|
||||||
|
<!-- Last-Modified: 2011/06/08 10:41:44 -->
|
||||||
|
<!-- Author: phispi -->
|
||||||
|
## Building Mapnik on Debian
|
||||||
|
|
||||||
|
## Dependencies for Debian 6: Squeeze (stable)
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
sudo apt-get install \
|
||||||
|
g++-4.4 cpp \
|
||||||
|
libicu-dev libicu44 \
|
||||||
|
python2.6-dev \
|
||||||
|
libboost-system1.42-dev \
|
||||||
|
libboost-filesystem1.42-dev \
|
||||||
|
libboost-iostreams1.42-dev \
|
||||||
|
libboost-thread1.42-dev \
|
||||||
|
libboost-python1.42-dev \
|
||||||
|
libboost-program-options1.42-dev \
|
||||||
|
libboost-regex1.42-dev \
|
||||||
|
libxml2 libxml2-dev \
|
||||||
|
libfreetype6 libfreetype6-dev \
|
||||||
|
libjpeg62 libjpeg62-dev \
|
||||||
|
libpng12-0 libpng12-dev \
|
||||||
|
libtiff4 libtiff4-dev \
|
||||||
|
libltdl7 libltdl-dev \
|
||||||
|
libproj0 libproj-dev \
|
||||||
|
libcairo2 libcairo2-dev python-cairo python-cairo-dev \
|
||||||
|
libcairomm-1.0-1 libcairomm-1.0-dev \
|
||||||
|
ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-unifont \
|
||||||
|
postgresql-8.4 postgresql-server-dev-8.4 postgresql-contrib-8.4 \
|
||||||
|
libgdal1-dev python-gdal \
|
||||||
|
postgresql-8.4-postgis libsqlite3-dev \
|
||||||
|
subversion build-essential python-nose
|
||||||
|
|
||||||
|
*Note:* We use libjpeg62 instead of libjpeg8 above because libtiff package still depends on 62.
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies for Debian 5: Lenny
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
sudo apt-get install -y g++ cpp \
|
||||||
|
libboost-system1.35-dev \
|
||||||
|
libboost-filesystem1.35-dev \
|
||||||
|
libboost-iostreams1.35-dev \
|
||||||
|
libboost-thread1.35-dev \
|
||||||
|
libboost-python1.35-dev \
|
||||||
|
libboost-program-options1.35-dev \
|
||||||
|
libboost-regex1.35-dev \
|
||||||
|
libxml2 libxml2-dev \
|
||||||
|
libfreetype6 libfreetype6-dev \
|
||||||
|
libjpeg62 libjpeg62-dev \
|
||||||
|
libltdl3 libltdl3-dev \
|
||||||
|
libpng12-0 libpng12-dev \
|
||||||
|
libgeotiff-dev libtiff4 libtiff4-dev \
|
||||||
|
libcairo2 libcairo2-dev python-cairo python-cairo-dev \
|
||||||
|
libcairomm-1.0-1 libcairomm-1.0-dev \
|
||||||
|
ttf-dejavu ttf-dejavu-core ttf-dejavu-extra \
|
||||||
|
libgdal1-dev python-gdal \
|
||||||
|
postgresql-8.3-postgis postgresql-8.3 \
|
||||||
|
postgresql-server-dev-8.3 postgresql-contrib-8.3 \
|
||||||
|
libsqlite3-dev \
|
||||||
|
subversion build-essential python-nose
|
||||||
|
|
||||||
|
Install Mapnik 0.7.1
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
svn co http://svn.mapnik.org/tags/release-0.7.1/ mapnik-0.7.1
|
||||||
|
cd mapnik-0.7.1
|
||||||
|
python scons/scons.py configure INPUT_PLUGINS=all \
|
||||||
|
OPTIMIZATION=3 \
|
||||||
|
SYSTEM_FONTS=/usr/share/fonts/truetype/
|
||||||
|
python scons/scons.py
|
||||||
|
sudo python scons/scons.py install
|
||||||
|
sudo ldconfig
|
||||||
|
|
||||||
|
or Mapnik trunk:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
svn co http://svn.mapnik.org/trunk mapnik-trunk
|
||||||
|
cd mapnik-trunk
|
||||||
|
python scons/scons.py configure INPUT_PLUGINS=all \
|
||||||
|
OPTIMIZATION=3 \
|
||||||
|
SYSTEM_FONTS=/usr/share/fonts/truetype/
|
||||||
|
python scons/scons.py
|
||||||
|
sudo python scons/scons.py install
|
||||||
|
sudo ldconfig
|
||||||
|
|
||||||
|
|
||||||
|
### Optional: Build and install mapnik without root permissions
|
||||||
|
The development libraries have to be present as described above. In the following example `/home/$USER/mapnik_svn` (`$DIR_MAPNIK_SVN`) is the directory where you want to check out the source and `/home/$USER/mapnik_inst` (`$DIR_MAPNIK_INSTALL`) is the directory you want to use for installation.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
DIR_MAPNIK_SRC=/home/$USER/mapnik_svn
|
||||||
|
DIR_MAPNIK_INSTALL=/home/$USER/mapnik_inst
|
||||||
|
|
||||||
|
svn co http://svn.mapnik.org/trunk $DIR_MAPNIK_SVN
|
||||||
|
cd $DIR_MAPNIK_SVN
|
||||||
|
|
||||||
|
python scons/scons.py configure INPUT_PLUGINS=all \
|
||||||
|
OPTIMIZATION=3 \
|
||||||
|
SYSTEM_FONTS=/usr/share/fonts/truetype/ttf-dejavu/ \
|
||||||
|
PREFIX=$DIR_MAPNIK_INSTALL \
|
||||||
|
PYTHON_PREFIX=$DIR_MAPNIK_INSTALL
|
||||||
|
python scons/scons.py
|
||||||
|
python scons/scons.py install
|
||||||
|
|
||||||
|
# append the following lines to /home/$USER/.bashrc
|
||||||
|
DIR_MAPNIK_INSTALL=/home/$USER/mapnik_inst
|
||||||
|
export LD_LIBRARY_PATH=$DIR_MAPNIK_INSTALL/lib
|
||||||
|
export PYTHONPATH=$DIR_MAPNIK_INSTALL/lib/python2.6/site-packages
|
44
DebuggingMapnik.md
Normal file
44
DebuggingMapnik.md
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<!-- Name: DebuggingMapnik -->
|
||||||
|
<!-- Version: 4 -->
|
||||||
|
<!-- Last-Modified: 2009/10/05 12:49:44 -->
|
||||||
|
<!-- Author: phispi -->
|
||||||
|
This page exists to discuss the best way for developers to debug Mapnik.
|
||||||
|
|
||||||
|
Currently I have these questions:
|
||||||
|
|
||||||
|
* What's the best way to get a Python build with debugging symbols? Will adding -g suffice? Is --with-pydebug needed?
|
||||||
|
* Do we need to compile the Boost libraries with debugging symbols as well?
|
||||||
|
* Is anything different for FreeBSD?
|
||||||
|
|
||||||
|
|
||||||
|
## Eclipse
|
||||||
|
Here I try to describe my setup. I'm sure there are better ways but this works for me:
|
||||||
|
* Checkout the newest trunk version of the repository: `svn checkout http://svn.mapnik.org/trunk mapnik_trunk`[[BR]]
|
||||||
|
This has the advantages that
|
||||||
|
* you always have the newest version (`svn update`)
|
||||||
|
* you can quickly add test code and remove it again (`svn revert`)
|
||||||
|
* you can easily create patches (`svn diff`)
|
||||||
|
* Compile it as described in the INSTALL file provided in the root directory of the checkout. I have the following variables in my `config.py`:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
DEBUG = True
|
||||||
|
XML_DEBUG = True
|
||||||
|
INPUT_PLUGINS = 'gdal,ogr,osm,postgis,raster,shape,sqlite'
|
||||||
|
PREFIX = '/home/philipp/usr'
|
||||||
|
PYTHON_PREFIX = '/home/philipp/usr'
|
||||||
|
BOOST_INCLUDES = '/usr/include'
|
||||||
|
BOOST_LIBS = '/usr/lib'
|
||||||
|
BINDINGS = 'all'
|
||||||
|
DEMO = True
|
||||||
|
* Download and install the [Eclipse IDE for C/C++ Developers (79 MB)](http://www.eclipse.org/downloads/)
|
||||||
|
* Create a new Makefile-C++-Project using the existing `mapnik_trunk` path where you have checked out the working copy.
|
||||||
|
* Create a debug configuration e.g. specifying the c++ demo application `rundemo` in `demo/c++`.
|
||||||
|
* You can got through the program now step by step and make breakpoints. In the default behavior, Eclipse tries (and fails) to compile the project itself and ask to start anyway. Just say yes.
|
||||||
|
* If you change a file, recompile the project from the command line by just typing `python scons/scons.py`.
|
||||||
|
* It is possible (but not necessary) to fine-tune Eclipse so that it does not try to build the project by itself and that is uses scons to do successfully do so.
|
||||||
|
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
* http://wiki.python.org/moin/DebuggingWithGdb
|
||||||
|
* http://www.boost.org/libs/python/doc/v2/faq.html#debugging
|
34
DemoGallery.md
Normal file
34
DemoGallery.md
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<!-- Name: DemoGallery -->
|
||||||
|
<!-- Version: 26 -->
|
||||||
|
<!-- Last-Modified: 2011/03/07 05:13:22 -->
|
||||||
|
<!-- Author: artem -->
|
||||||
|
# Demo Gallery
|
||||||
|
|
||||||
|
Have a look at some online uses of Mapnik!
|
||||||
|
|
||||||
|
* [OpenStreetMap (Main Site)](http://www.openstreetmap.org/index.html)
|
||||||
|
* [Cycle Map](http://www.gravitystorm.co.uk/osm/)
|
||||||
|
* [Freemap](http://www.free-map.org.uk/)
|
||||||
|
* [People's Map](http://www.peoplesmap.com)
|
||||||
|
* [EveryBlock.com: A news feed for your block](http://www.everyblock.com/) ([blog post](http://blog.everyblock.com/2008/feb/18/maps/))
|
||||||
|
|
||||||
|
* [Bulgarianmaps.com - Свободна Карта на Велико Търново](http://www.bulgarianmaps.com/)
|
||||||
|
* [Heritage Walks - The Engineering Heritage of Auckland](http://www.heritagewalks.co.nz/rw/aklhistoric/)
|
||||||
|
* [OSM+London tube](http://media.mapnik.org/osm-tube.html)
|
||||||
|
* [Космоснимки](http://kosmosnimki.ru/)
|
||||||
|
* [By Land and Sea](http://www.bylandandsea.org/map/) - Ongoing motorcycle trip
|
||||||
|
* [Oxford, UK](http://mapnik.org/tiling/oxford/)
|
||||||
|
* [Vancouver, Canada](http://mapnik.org/tiling/vancouver/)
|
||||||
|
* [Australia](http://au.search.yahoo.com/maps)
|
||||||
|
* [University of Montana Campus Map](http://map.umt.edu/)
|
||||||
|
* http://teczno.com/cascadenik-openstreetmap-II/
|
||||||
|
* http://afghanistanelectiondata.org/data
|
||||||
|
|
||||||
|
* [Pandemic Preparedness: When Data Visualization and Workflow Matter](http://www.developmentseed.org/blog/2008/jun/25/data-visualization-for-pandemic-preparedness) (Drupal + Mapnik)
|
||||||
|
* http://patch-maps.com/
|
||||||
|
* http://magic.cyclopath.org/
|
||||||
|
* [http://5411.info/]
|
||||||
|
* [Mapnik & OpenLayers](http://gallery.openlayers.org/?tag=mapnik) - Example sites using Mapnik in the OpenLayers Gallery
|
||||||
|
* http://hikebikemap.de
|
||||||
|
* [Карта Дрогобыча и Трускавца. Бизнес справочник на карте](http://nadoloni.com/)
|
||||||
|
* [MapQuest Open](http://open.mapquest.com/)
|
7
DevFeature.md
Normal file
7
DevFeature.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<!-- Name: DevFeature -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2010/10/05 11:23:25 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<div style="border-style: solid;padding:5px;color:red;width:55%">Note: New feature in development.. help test beta snapshot here: <a href="http://trac.mapnik.org/wiki/Mapnik2">Mapnik2</a></div>
|
22
DeveloperTodo.md
Normal file
22
DeveloperTodo.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<!-- Name: DeveloperTodo -->
|
||||||
|
<!-- Version: 10 -->
|
||||||
|
<!-- Last-Modified: 2009/12/11 12:21:41 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
*Mapnik features that need fixing* (also see the Tickets page):
|
||||||
|
|
||||||
|
If you have a plan for any of these items, remove them from here and add them as tickets!
|
||||||
|
|
||||||
|
## Python bindings
|
||||||
|
* Project is in need of a set of visual unit tests
|
||||||
|
|
||||||
|
## Code/API Documentation
|
||||||
|
* More C++ classes and parameters need to be documented!
|
||||||
|
* We need to generate Doxygen output
|
||||||
|
|
||||||
|
## Unexpected behavior
|
||||||
|
|
||||||
|
* "Nil" extents don't work as one might expect (they are initialized to have negative length and negative width, but do not properly support expand_to_include etc.)
|
||||||
|
|
||||||
|
## Wishlist
|
||||||
|
* Ruby binding :)
|
||||||
|
* Mixed imperative / declarative DSL (domain-specific language) for mapping, in the spirit of jQuery, Rails, or Haml-quality design
|
62
DeveloperTopics.md
Normal file
62
DeveloperTopics.md
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<!-- Name: DeveloperTopics -->
|
||||||
|
<!-- Version: 11 -->
|
||||||
|
<!-- Last-Modified: 2011/02/23 14:09:27 -->
|
||||||
|
<!-- Author: roel_v -->
|
||||||
|
# Development Ideas and Topics
|
||||||
|
|
||||||
|
Please use this wiki page to share ideas, sketch plans, and discuss features.
|
||||||
|
|
||||||
|
Any specific feature request or bug report should be created as a [new ticket](http://trac.mapnik.org/newticket).
|
||||||
|
|
||||||
|
## Guidelines
|
||||||
|
|
||||||
|
CodingStandards
|
||||||
|
|
||||||
|
StableMergeQueue - Mapnik stable releases
|
||||||
|
|
||||||
|
PackageBuilding - Resources
|
||||||
|
|
||||||
|
DevelopingPlugins - Writing new datasource plugins
|
||||||
|
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
FasterCompiling
|
||||||
|
|
||||||
|
InternationalText
|
||||||
|
|
||||||
|
BoundsClipping
|
||||||
|
|
||||||
|
BuildingwithAutotools
|
||||||
|
|
||||||
|
BuildBot
|
||||||
|
|
||||||
|
DebuggingMapnik -- TODO!
|
||||||
|
|
||||||
|
BuildingOnWindows
|
||||||
|
|
||||||
|
## TODO notes / Wish List
|
||||||
|
|
||||||
|
Ideas around compositing images: wiki:Ideas/Compositing
|
||||||
|
|
||||||
|
Ideas for the future: wiki:Ideas/FutureMapnik
|
||||||
|
|
||||||
|
DeveloperTodo
|
||||||
|
|
||||||
|
[Tickets by owner](https://trac.mapnik.org/report/8) - Your tickets
|
||||||
|
|
||||||
|
|
||||||
|
## Sandbox
|
||||||
|
|
||||||
|
[wiki:GSOC2010]
|
||||||
|
|
||||||
|
[wiki:Mapnik2] - notes on getting running with the experimental Mapnik2 code
|
||||||
|
|
||||||
|
[wiki:Compositing] Compositing modes
|
||||||
|
|
||||||
|
[wiki:Legending]
|
||||||
|
|
||||||
|
XmlFormatDiscussion -- freeform discussion on Mapnik's XML format
|
||||||
|
|
||||||
|
ShieldSymbolizerTests
|
||||||
|
|
60
DevelopingPlugins.md
Normal file
60
DevelopingPlugins.md
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<!-- Name: DevelopingPlugins -->
|
||||||
|
<!-- Version: 3 -->
|
||||||
|
<!-- Last-Modified: 2010/10/27 20:21:46 -->
|
||||||
|
<!-- Author: rcoup -->
|
||||||
|
# Developing Mapnik Plugins
|
||||||
|
|
||||||
|
## Understanding the Architecture
|
||||||
|
|
||||||
|
Plugins can be used from C++ to read in different kinds of files. Here's an example of C++ code that implicitly uses the _shape_ plugin to read in a ESRI Shapefile:
|
||||||
|
|
||||||
|
|
||||||
|
#!C
|
||||||
|
std::string mapnik_dir(argv[1]); // assume mapnik home directory, such as "~/src/mapnik" passed in
|
||||||
|
std::string plugins_dir(mapnik_dir + "/plugins/input/");
|
||||||
|
datasource_cache::instance()->register_datasources(plugins_dir + "shape"); // ESRI SHP support
|
||||||
|
datasource_cache::instance()->register_datasources(plugins_dir + "postgis"); // PostGIS integration
|
||||||
|
|
||||||
|
and used like so,
|
||||||
|
|
||||||
|
|
||||||
|
#!C
|
||||||
|
{
|
||||||
|
parameters p;
|
||||||
|
p["type"]="shape";
|
||||||
|
p["file"]="../data/statesp020"; // State Boundaries of the United States [SHP]
|
||||||
|
|
||||||
|
Layer lyr("Cali");
|
||||||
|
lyr.set_datasource(datasource_cache::instance()->create(p)); // Note use of datasource_cache factory method here!
|
||||||
|
lyr.add_style("cali"); // style.xml
|
||||||
|
lyr.add_style("elsewhere"); // this file
|
||||||
|
m.addLayer(lyr);
|
||||||
|
}
|
||||||
|
|
||||||
|
Let's drill-down into what's actually going on. We constructed a [parameter object](http://trac.mapnik.org/browser/trunk/include/mapnik/params.hpp) and passed it to a factory method (datasource_cache::instance()->create(p)). It then returned a shared pointer to a datasource object, which was then passed on a new Layer object.
|
||||||
|
|
||||||
|
In C++, the parameters object is-a param_map (a std::map from string keys to "value_holder"s, where a value_holder is a [boost::variant](http://www.boost.org/doc/libs/1_36_0/doc/html/variant.html#variant.intro) that can either hold a double or a string. In other words, "parameters p" is a semi-generic parameter hash, then passed to and read by a factory method.
|
||||||
|
|
||||||
|
To specify the kind of datasource, note that we specified p's "type" as "shape". Other options might be "osm", "postgis", or "raster".
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
See [browser:trunk/plugins/input/templates] in the source tree, and specifically the [browser:trunk/plugins/input/templates/helloworld HelloWorld] plugin.
|
||||||
|
|
||||||
|
## Required functions
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
## The Query object
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
## Writing a SConscript file
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
## Gochas
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
|
63
ElseFilter.md
Normal file
63
ElseFilter.md
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<!-- Name: ElseFilter -->
|
||||||
|
<!-- Version: 6 -->
|
||||||
|
<!-- Last-Modified: 2011/08/30 00:55:11 -->
|
||||||
|
<!-- Author: MaZderMind -->
|
||||||
|
# ElseFilter
|
||||||
|
A Rule containing an `<ElseFilter />` is evaluated if and only if no other Rule in the current Style matched (either because of the ScaleDenominator or the Filter).
|
||||||
|
|
||||||
|
Mapnik evaluates all Rules in a Style sequentially from top to bottom, testing each Rule's Filter against the current Object. When all Rules have been evaluated but no Filter matched the current Object, the Rules containing an `<ElseFilter />` are evaluated.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
An `<ElseFilter />` is usually used when you want to draw _all_ Objects read from the Datasource but some of them Different. In this case you place as many Rules with [Filters](/wiki:Filter/) in your Style and add a last Rule with an `<ElseFilter />` that matches every Object not matched by the specific Rules. In such a scenario setting `filter-mode="first"` on the Style may be desired, so that always exactly one Rule from the Style gets evaluated.
|
||||||
|
|
||||||
|
## Example in XML
|
||||||
|
For each Object read from the Datasource Mapnik checks if the current ScaleDenominator matches the Min- and Max-Conditions of the first Rule and it the Object has an attribute "major" with a value of "1".
|
||||||
|
* If the Object _passes_ these tests, the first Rule is evaluated painted to the map. The two other Rules are ignored in this case.
|
||||||
|
* If the Object _misses_ these tests, the two Rules with an `<ElseFilter />` are evaluated according to their Min- and MaxScaleDenominator.
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Style name="contours">
|
||||||
|
<Rule>
|
||||||
|
<Filter>[major] = 1</Filter>
|
||||||
|
|
||||||
|
<MaxScaleDenominator>25000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>100</MinScaleDenominator>
|
||||||
|
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">#fb9b67</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
|
||||||
|
<Rule>
|
||||||
|
<ElseFilter/>
|
||||||
|
|
||||||
|
<MaxScaleDenominator>25000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>5000</MinScaleDenominator>
|
||||||
|
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">#f45906</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
|
||||||
|
<Rule>
|
||||||
|
<ElseFilter/>
|
||||||
|
|
||||||
|
<MaxScaleDenominator>5000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>100</MinScaleDenominator>
|
||||||
|
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">#f4062A</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
## Example in Python
|
||||||
|
|
||||||
|
#!python
|
||||||
|
rule = mapnik.Rule()
|
||||||
|
rule.set_else(True) # instead of rule.filter(...)
|
||||||
|
|
||||||
|
## See also
|
||||||
|
* The normal [wiki:Filter]
|
||||||
|
* The (other) special AlsoFilter
|
78
ExampleCode.md
Normal file
78
ExampleCode.md
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
<!-- Name: ExampleCode -->
|
||||||
|
<!-- Version: 11 -->
|
||||||
|
<!-- Last-Modified: 2009/11/10 17:42:39 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# Example Code
|
||||||
|
The Mapnik source comes with some example code in the [mapnik/demo](https://trac.mapnik.org/browser/trunk/demo) directory.
|
||||||
|
|
||||||
|
Here are some other sets of Example Code to learn from.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## C++ Code
|
||||||
|
|
||||||
|
### California
|
||||||
|
* *Name*: `cali.cpp`
|
||||||
|
* *Description*: A sample program, adapted from demo/c++/rundemo.cpp which demonstrates how one might use the Mapnik C++ API to render the state of California from USGS Shapefile data.
|
||||||
|
* *Source*: http://gist.github.com/5009
|
||||||
|
* *Tested On*: Mac OS 10.5
|
||||||
|
* *Added by:* lwu
|
||||||
|
|
||||||
|
### Servers
|
||||||
|
* http://svn.openstreetmap.org/applications/utils/mod_tile/
|
||||||
|
|
||||||
|
### C++ profiling tests
|
||||||
|
* http://github.com/jflemer/mapnik-glitz-demo
|
||||||
|
* http://bitbucket.org/mishok13/mapnik-perf-testing/
|
||||||
|
|
||||||
|
### FreeMap
|
||||||
|
* http://svn.openstreetmap.org/applications/rendering/fmapgen/
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## Python Code
|
||||||
|
|
||||||
|
### Hello World
|
||||||
|
* *Name*: `world_map_and_styles.py`, `world_map.py`
|
||||||
|
* *Description*: A mirror of the GettingStarted tutorial along with sample data.
|
||||||
|
* *Source*:
|
||||||
|
* [Pure Python example](http://mapnik-utils.googlecode.com/svn/example_code/hello_world/pure_python/)
|
||||||
|
* [Python with XML Mapfile](http://mapnik-utils.googlecode.com/svn/example_code/hello_world/xml_config)
|
||||||
|
* [Sample Data for each example](http://mapnik-utils.googlecode.com/svn/example_code/hello_world/data/)
|
||||||
|
* *Tested On*: Mac OS 10.5
|
||||||
|
* *Added by:* (original mapnik tutorial)
|
||||||
|
|
||||||
|
### World Population
|
||||||
|
* *Name*: `world_population.py`
|
||||||
|
* *Description*: A mirror of the [XmlGettingStarted](/wiki:XMLGettingStarted/) tutorial along with sample data.
|
||||||
|
* *Source*: [Python Script, XML Mapfile, and data](http://mapnik-utils.googlecode.com/svn/example_code/world_population)
|
||||||
|
* *Tested On*: Mac OS 10.5
|
||||||
|
* *Added by:* springmeyer
|
||||||
|
|
||||||
|
### Cairo Renderer
|
||||||
|
[MapnikRenderers#PythonExampleCode Code samples] for writing to SVG and PDF
|
||||||
|
|
||||||
|
### mapnik-utils
|
||||||
|
|
||||||
|
The mapnik-utils project includes some example code as well: http://code.google.com/p/mapnik-utils/
|
||||||
|
|
||||||
|
### ShieldSymbolizer
|
||||||
|
|
||||||
|
An e-mail on [Mapnik ShieldSymbolizer](http://groups.google.com/group/cugos/browse_thread/thread/b62b4890e1933bba). Also describes use of
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
$ python
|
||||||
|
>>>import mapnik
|
||||||
|
>>>dir(mapnik)
|
||||||
|
>>>help(mapnik)
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ pydoc -p 8080
|
||||||
|
and then open a browser and go to :
|
||||||
|
http://localhost:8080/mapnik.html
|
154
FasterCompiling.md
Normal file
154
FasterCompiling.md
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
<!-- Name: FasterCompiling -->
|
||||||
|
<!-- Version: 11 -->
|
||||||
|
<!-- Last-Modified: 2011/08/11 07:29:20 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# Compiling Mapnik Faster
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<a href="http://imgs.xkcd.com/comics/compiling.png"><img src="http://imgs.xkcd.com/comics/compiling.png"></a>
|
||||||
|
|
||||||
|
When you are tired of sword fighting, its time to actually figure out how to compile Mapnik faster.
|
||||||
|
|
||||||
|
|
||||||
|
The use of SCons, templates, and particularly boost::spirit2 grammars, means that for a fairly lightweight library like Mapnik things take a long time to compile.
|
||||||
|
|
||||||
|
Mapnik trunk has increased usage of boost::spirit2 and default compile times have gone from around 7-10 minutes to 15-20 (on dual core machine, 4GB mem) using g++ 4.2
|
||||||
|
|
||||||
|
But, there are several things you can do to speed things up:
|
||||||
|
|
||||||
|
## Trigger SCons to compile in parallel
|
||||||
|
If you have enough memory (> 2 GB) and >2 cores, tell SCons to compile stuff in parallel:
|
||||||
|
|
||||||
|
*Note*: on some systems this may not help will overall speed unless you have >4 GB memory
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py install -j2
|
||||||
|
|
||||||
|
## Upgrade your compiler
|
||||||
|
The more recent compiler you are using, likely the faster the compile. g++ 4.5 should be faster than 4.2 for example, and the new clang++/llvm compilers are about twice as fast.
|
||||||
|
|
||||||
|
Here is how to build the latest clang++
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# grab llvm and clang from svn
|
||||||
|
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
|
||||||
|
cd llvm/tools
|
||||||
|
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
|
||||||
|
cd ..
|
||||||
|
./configure --enable-optimized
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
then compile Mapnik like:
|
||||||
|
|
||||||
|
*Note:* this requires the boost >= 1.44. You should be able to use a version of boost compiled with g++, but for the advanced users you should also be able to compile boost with clang. See: http://blog.llvm.org/2010/05/clang-builds-boost.html
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py install CXX="clang++"
|
||||||
|
|
||||||
|
Be aware that clang provides more warnings that gcc, and this can clog your terminal sometimes when the boost guys get careless. To silence most of the clang warnings that come from boost headers you can do:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py install WARNING_CXXFLAGS="-Wno-unused-function -Wno-uninitialized -Wno-array-bounds -Wno-parentheses -Wno-char-subscripts"
|
||||||
|
|
||||||
|
## Use Precompiled Headers
|
||||||
|
|
||||||
|
Read up on precompiled headers [here](http://clang.llvm.org/docs/UsersManual.html#precompiledheaders) and [here](http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Precompiled-Headers.html)
|
||||||
|
|
||||||
|
If done right this can save about 1/4 of the compile time, sometimes a bit more. On my machine this dropped compilation of libmapnik.dylib from 6 minutes to 4 minutes.
|
||||||
|
|
||||||
|
The basic idea here is to determine one or many headers that are not changing, expensive to compile, and frequently includes (directly or indirectly).
|
||||||
|
|
||||||
|
So, in the case of Mapnik, boost spirit headers fit this. Boost spirit is all about compile time optimization through C++ templates for fast parsing. It is only used in a few places in mapnik, but the headers that use spirit are then included in many other files, which are includes by other files.... and so on.
|
||||||
|
|
||||||
|
Then, the goal is to precompile some or all of boost spirit so that each time a mapnik cpp file is compiled all the references to boost spirit will be pulled from a single pre-compiled header instead of compiled every time.
|
||||||
|
|
||||||
|
First we need to develop a list of boost spirit headers and dump them into a single header:
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
from glob import glob
|
||||||
|
|
||||||
|
hpps = glob('include/mapnik/*hpp')
|
||||||
|
hpps.extend(glob('include/mapnik/svg/*hpp'))
|
||||||
|
hpps.extend(glob('include/mapnik/grid/*hpp'))
|
||||||
|
hpps.extend(glob('include/mapnik/wkt/*hpp'))
|
||||||
|
hpps.extend(glob('src/*cpp'))
|
||||||
|
hpps.extend(glob('src/svg/*cpp'))
|
||||||
|
hpps.extend(glob('src/wkt/*cpp'))
|
||||||
|
hpps.extend(glob('src/grid/*cpp'))
|
||||||
|
includes = []
|
||||||
|
|
||||||
|
for h in hpps:
|
||||||
|
f_ = open(h,'r')
|
||||||
|
for l in f_.readlines():
|
||||||
|
i = l.strip()
|
||||||
|
if i.startswith('#include <boost/spirit') or i.startswith('#include <boost/fusion'):
|
||||||
|
if not i in includes:
|
||||||
|
includes.append(i)
|
||||||
|
|
||||||
|
|
||||||
|
sorted(includes)
|
||||||
|
print '\n'.join(includes)
|
||||||
|
|
||||||
|
Save that script as `parse_spirit_headers.py` and run like:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
python parse_spirit_headers.py > spirit.h
|
||||||
|
|
||||||
|
Then compile that header:
|
||||||
|
|
||||||
|
Note: a tricky issue here is that the -DEFINES used to compile this header must exactly match those to compile mapnik, which is not always going to be the case.
|
||||||
|
|
||||||
|
To get the right defines, start compiling normal and copy/paste the defined from the first src/mapnik*.cpp compiled, and save these in a $CFLAGS variable in the shell.
|
||||||
|
|
||||||
|
Then compile the header:
|
||||||
|
|
||||||
|
clang++ -x c++-header $CFLAGS spirit.h -o mapnik.h.pch
|
||||||
|
|
||||||
|
|
||||||
|
Next, in src/SConscript on the line below `lib_env = env.Close()` do:
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
lib_env['CXX'] = "clang++ -include-pch mapnik.h.pch"
|
||||||
|
|
||||||
|
Finally, compile mapnik as normal.
|
||||||
|
|
||||||
|
## Use ccache
|
||||||
|
|
||||||
|
*Note*: it appears the with recent clang version ccache has no real benefit.
|
||||||
|
|
||||||
|
[ccache](http://ccache.samba.org/) is a compiler cache. Basically it a program that runs in front of your existing compiler and tries to help speed it up. It should be able to quarter your compile times after it warms up. E.g. the first compile will be slower but if you are doing development then recompiles afterword should be much faster.
|
||||||
|
|
||||||
|
To use ccache, first install it, then compile Mapnik like:
|
||||||
|
|
||||||
|
If using clang, you should do:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py install CXX="ccache clang++ -Qunused-arguments -fcolor-diagnostics"
|
||||||
|
|
||||||
|
Or with gcc do:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py install CXX="ccache g++"
|
||||||
|
|
||||||
|
|
||||||
|
## Using ccache with clang++
|
||||||
|
|
||||||
|
One a 13-inch 2.66 GHz Intel Core 2 Duo 4GB macbook using both ccache and clang++ compiled Mapnik from scratch in *15 minutes* the first run, then *5* minutes the second.
|
||||||
|
|
||||||
|
|
||||||
|
## Reduce latency in SCons
|
||||||
|
Scons is really good - almost too good - at scanning for dependency trees, to ensure quality builds. For example, you could make no change to your Mapnik code checkout, but if you re-install the boost libraries, when you return to install Mapnik likely all of Mapnik will be triggered for recompile. This is a good thing for consistent binaries, but it means that it takes SCons a long time to get started actually sending commands to the compiler.
|
||||||
|
|
||||||
|
There are a [variety of tricks](http://www.scons.org/wiki/GoFastButton) but the easiest, and should be safe, is to send the FAST=True flag to Scons, which will slightly lessen its hunger for scanning and should reduce the time it takes to start compiling:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ scons FAST=True
|
||||||
|
|
54
Filter.md
Normal file
54
Filter.md
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<!-- Name: Filter -->
|
||||||
|
<!-- Version: 10 -->
|
||||||
|
<!-- Last-Modified: 2011/08/29 09:04:20 -->
|
||||||
|
<!-- Author: MaZderMind -->
|
||||||
|
# Filter
|
||||||
|
Each Style-Rule can optionally have a Filter attached. Mapnik walks through all Rules of a Style and checks if it has a Filter specified and if this Filter matches the Object currently rendered. Filters compare an Objects Key-Value Information against the specified rules. When the Datasource is a Postgis Database, the Filter operates on the tables columns, for Shapefiles the Attributes are used.
|
||||||
|
|
||||||
|
In XML [character entities](http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references) are used to construct filters. You can use the following characters to specify value-comparisons:
|
||||||
|
* Greater Than: `>`
|
||||||
|
* Greater Then or Equal: `>=`
|
||||||
|
* Less Than: `<`
|
||||||
|
* Less Than or Equal: `<=`
|
||||||
|
* Equal: `=`
|
||||||
|
|
||||||
|
Filters can be combined with the following operators:
|
||||||
|
* A `and` B
|
||||||
|
* A `or` B
|
||||||
|
* `not` A
|
||||||
|
|
||||||
|
And be combined to complex rules using brackets: `(` and `)`.
|
||||||
|
|
||||||
|
Missing Attributes are treated as empty strings. Attributes can be compared against [Regular expressions](http://en.wikipedia.org/wiki/Regular_expression) using the `.match` operator.
|
||||||
|
|
||||||
|
|
||||||
|
## Examples in XML
|
||||||
|
Matches all Objects that have an attribute "amenity" with a value of "restaurant":
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Filter>[amenity] = 'restaurant'</Filter>
|
||||||
|
|
||||||
|
Matches all Objects that have an attribute "CARTO" with a value that compares greater or equal 2 and lower then 5:
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Filter>[CARTO] >= 2 and [CARTO] < 5</Filter>
|
||||||
|
|
||||||
|
Matches all Objects that have an attribute "waterway" with a value of "canal" a) without a "tunnel" attribute or b) with a "tunnel" attribute that has a value different from "yes" and "true".
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Filter>[waterway] = 'canal' and not ([tunnel] = 'yes' or [tunnel] = 'true')</Filter>
|
||||||
|
|
||||||
|
Example using an Regular expression, matching all Objects with an attribute "place" with a value of "town" and an attribute "population" with a value consisting of exactly 5 characters where the first one is one of 5, 6, 7 or 8 and the remaining 4 characters are digits.
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Filter>[place] = 'town' and [population].match('[5-9]\d\d\d\d')</Filter>
|
||||||
|
|
||||||
|
## Examples in Python
|
||||||
|
In python filters can be set using the following syntax:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
f = Filter("[name] = 'value'")
|
||||||
|
|
||||||
|
## See also
|
||||||
|
* The [OpenStreetMap Stylesheet](http://trac.openstreetmap.org/browser/applications/rendering/mapnik/osm.xml?rev=9228) which uses Filters in many ways.
|
||||||
|
* The special Filters ElseFilter and AlsoFilter
|
33
FontSet.md
Normal file
33
FontSet.md
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<!-- Name: FontSet -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2009/01/28 20:44:31 -->
|
||||||
|
<!-- Author: Beau Gunderson -->
|
||||||
|
The FontSet element defines a group of fonts to be used in cases where it is desirable to support more characters than exist in a single font (also referred to as "fallback fonts" support).
|
||||||
|
|
||||||
|
For example, on a layer with both English and Chinese names, one could specify fonts with a high level of legibility for English letters as well as a fallback font for Chinese characters that don't exist in the English font.
|
||||||
|
|
||||||
|
Here's a small example:
|
||||||
|
|
||||||
|
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map>
|
||||||
|
<Map srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
|
||||||
|
<FontSet name="my-fonts">
|
||||||
|
<Font face_name="DejaVu Sans Book" />
|
||||||
|
<Font face_name="TSC FMing S TT Regular" />
|
||||||
|
</FontSet>
|
||||||
|
|
||||||
|
<Style name="font-test">
|
||||||
|
<Rule>
|
||||||
|
<TextSymbolizer name="NAME" fontset_name="my-fonts" size="15" fill="black" />
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Layer name="font-test" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
|
||||||
|
<StyleName>font-test</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="type">shape</Parameter>
|
||||||
|
<Parameter name="file">Font_Test</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
</Map>
|
36
FreeBSDInstallation.md
Normal file
36
FreeBSDInstallation.md
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<!-- Name: FreeBSDInstallation -->
|
||||||
|
<!-- Version: 3 -->
|
||||||
|
<!-- Last-Modified: 2010/11/23 09:40:38 -->
|
||||||
|
<!-- Author: bcrosby -->
|
||||||
|
## Installing on FreeBSD
|
||||||
|
|
||||||
|
In most cases the FreeBSD port of Mapnik (located in /usr/ports/graphics/mapnik) will work. However, if the port is broken, or you'd like to install another version the following instructions will help.
|
||||||
|
|
||||||
|
You will need to install the following ports/packages to ensure that mapnik will compile for you:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
graphics/png
|
||||||
|
graphics/tiff
|
||||||
|
graphics/jpeg
|
||||||
|
graphics/proj
|
||||||
|
devel/icu
|
||||||
|
print/freetype2
|
||||||
|
graphics/cairo
|
||||||
|
graphics/cairomm
|
||||||
|
devel/pkg-config
|
||||||
|
graphics/py-cairo
|
||||||
|
devel/boost-python-libs
|
||||||
|
devel/libtool22
|
||||||
|
devel/libltdl22
|
||||||
|
|
||||||
|
If you want postgres support, ensure that the postgres libs are installed:
|
||||||
|
|
||||||
|
|
||||||
|
database/postgresqlXX-client (where XX is the version of Postgres libs you'd like to install)
|
||||||
|
|
||||||
|
Once these libs are installed, you should be able to compile/install source by doing:
|
||||||
|
|
||||||
|
|
||||||
|
python scons/scons.py configure
|
||||||
|
python scons/scons.py install
|
93
GDAL.md
Normal file
93
GDAL.md
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
<!-- Name: GDAL -->
|
||||||
|
<!-- Version: 18 -->
|
||||||
|
<!-- Last-Modified: 2010/11/13 10:18:41 -->
|
||||||
|
<!-- Author: kunitoki -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
Mapnik's PluginArchitecture supports the use of different input formats.
|
||||||
|
|
||||||
|
This plugin supports the [GDAL](http://www.gdal.org/) library in order to read a lot of spatial geo raster data from multiple formats.
|
||||||
|
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
Make sure that running _python scons/scons.py _ shows the following line
|
||||||
|
|
||||||
|
Checking for gdal-config --libs... yes
|
||||||
|
Checking for gdal-config --cflags... yes
|
||||||
|
|
||||||
|
To check if the gdal plugin built and was installed correctly you can do:
|
||||||
|
|
||||||
|
>>> from mapnik import DatasourceCache as c
|
||||||
|
>>> 'gdal' in c.plugin_names()
|
||||||
|
True
|
||||||
|
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
|
||||||
|
|| *parameter* || *value* || *description* || *default* ||
|
||||||
|
|| file || string || file of the raster to be read || ||
|
||||||
|
|| base || string || base path where to search for file parameter || ||
|
||||||
|
|| shared || boolean || wheter to open the dataset in shared mode (allowing save of resources when using multiple access to the same files) or not || false ||
|
||||||
|
|| band || integer || request for a specific raster band index, -1 means all bands || -1 ||
|
||||||
|
|| filter_factor || double || filter to use when querying for raster data || 0.0 ||
|
||||||
|
|
||||||
|
|
||||||
|
# Styling
|
||||||
|
|
||||||
|
To style a layer from GDAL use the RasterSymbolizer
|
||||||
|
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
This plugin in Mapnik >= 0.7.0 supports reading overviews created with http://www.gdal.org/gdaladdo.html
|
||||||
|
|
||||||
|
## Python
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
style=Style()
|
||||||
|
rule=Rule()
|
||||||
|
rule.symbols.append(RasterSymbolizer())
|
||||||
|
style.rules.append(rule)
|
||||||
|
map.append_style('Raster Style',style)
|
||||||
|
lyr = Layer('GDAL Layer from TIFF file')
|
||||||
|
lyr.datasource = Gdal(base='/path/to/your/data',file='raster.tif')
|
||||||
|
lyr.styles.append('Raster Style')
|
||||||
|
|
||||||
|
See the docstring at: http://svn.mapnik.org/trunk/docs/api_docs/python/mapnik-module.html#Gdal
|
||||||
|
|
||||||
|
## XML
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<!-- NOTE: must be in the same SRS as your map-->
|
||||||
|
<Layer name="GDAL Layer from TIFF file">
|
||||||
|
<StyleName>raster</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="type">gdal</Parameter>
|
||||||
|
<Parameter name="file">/path/to/your/data/raster.tiff</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
## C++
|
||||||
|
|
||||||
|
Plugin datasource initialization example code can be found on PluginArchitecture.
|
||||||
|
|
||||||
|
A GDAL datasource may be created as follows:
|
||||||
|
|
||||||
|
|
||||||
|
#!C
|
||||||
|
{
|
||||||
|
parameters p;
|
||||||
|
p["type"]="gdal";
|
||||||
|
p["file"]="/path/to/your/data/raster.tiff";
|
||||||
|
|
||||||
|
set_datasource(datasource_cache::instance()->create(p));
|
||||||
|
|
||||||
|
Layer lyr("GDAL Layer from TIFF file");
|
||||||
|
lyr.add_style("raster");
|
||||||
|
m.addLayer(lyr);
|
||||||
|
}
|
||||||
|
|
||||||
|
## Further References
|
94
GEOS.md
Normal file
94
GEOS.md
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
<!-- Name: GEOS -->
|
||||||
|
<!-- Version: 6 -->
|
||||||
|
<!-- Last-Modified: 2011/08/10 13:41:42 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<h2 style="text-align: left; color: red">WARNING: experimental !</h1>
|
||||||
|
|
||||||
|
Mapnik's PluginArchitecture supports the use of different input formats.
|
||||||
|
|
||||||
|
One such plugin supports writing inline [WKT](http://en.wikipedia.org/wiki/Well-known_text) geometries directly in XML files or python, thus allowing to design geometries directly into mapnik withouth the need to access separate files or database. This is extremely useful to build legends, or layer styles images to put in layers controls widgets, or eventually visualize fixed geometries in your maps.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation (On Linux)
|
||||||
|
|
||||||
|
Check if you have the GEOS library installed:
|
||||||
|
|
||||||
|
|
||||||
|
$ geos-config --version
|
||||||
|
3.2.0
|
||||||
|
|
||||||
|
If not, install it from [here](http://trac.osgeo.org/geos/) or use your package system on your distro.
|
||||||
|
|
||||||
|
If scons is unable to find the needed headers and library, make sure you define where they are in _config.py_:
|
||||||
|
|
||||||
|
|
||||||
|
GEOS_INCLUDES='/usr/local/include'
|
||||||
|
GEOS_LIBS='/usr/local/lib'
|
||||||
|
|
||||||
|
Make sure that running _python scons/scons.py DEBUG=y_ shows the following line
|
||||||
|
|
||||||
|
Checking for C library geos_c... yes
|
||||||
|
|
||||||
|
To check if the geos plugin built and was installed correctly, try the usual Python _from mapnik import *_ on a DEBUG=y build, and look for the following debug line
|
||||||
|
|
||||||
|
registered datasource : geos
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
|| *parameter* || *value* || *description* || *default* ||
|
||||||
|
|| wkt || string || valid Well-Known-Text string describing the geometry to display || ||
|
||||||
|
|| extent || string || extent of the passed geometry || determined by the WKT geometry ||
|
||||||
|
|| gid || integer || specify the geometry id, useful if you need to give it an id and display it with a TextSymbolizer || 0 ||
|
||||||
|
|| field_data || string || additional text of the geometry, if you need to give it an id and display it with a TextSymbolizer || ||
|
||||||
|
|| field_name || string || name of the field to use in a TextSymbolizer to display the "field_data" value || name ||
|
||||||
|
|| multiple_geometries || boolean || wheter to use multiple different objects or a single one when dealing with multi-objects (this is mainly related to how the label are used in the map, one label for a multi-polygon or one label for each polygon of a multi-polygon)|| false ||
|
||||||
|
|| encoding || string || internal file encoding || utf-8 ||
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Python
|
||||||
|
|
||||||
|
Instantiate a datasource like:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
lyr = Layer('WKT Rectangle')
|
||||||
|
lyr.datasource = Geos(wkt='POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))')
|
||||||
|
|
||||||
|
### XML
|
||||||
|
|
||||||
|
If you are using XML mapfiles to style your data, then using a datasource looks like:
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Layer name="WKT Rectangle" status="on">
|
||||||
|
<StyleName>RectangleStyle</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="wkt">POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
|
||||||
|
### C++
|
||||||
|
|
||||||
|
Plugin datasource initialization example code can be found on PluginArchitecture.
|
||||||
|
|
||||||
|
A datasource may be created as follows:
|
||||||
|
|
||||||
|
|
||||||
|
#!C
|
||||||
|
{
|
||||||
|
parameters p;
|
||||||
|
p["type"]="geos";
|
||||||
|
p["wkt"]="POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))";
|
||||||
|
p["extent"]="0,0,10,10"; // optional
|
||||||
|
|
||||||
|
set_datasource(datasource_cache::instance()->create(p));
|
||||||
|
|
||||||
|
Layer lyr("WKT Rectangle");
|
||||||
|
lyr.add_style("RectangleStyle");
|
||||||
|
m.addLayer(lyr);
|
||||||
|
}
|
37
GSOC2010.md
Normal file
37
GSOC2010.md
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<!-- Name: GSOC2010 -->
|
||||||
|
<!-- Version: 16 -->
|
||||||
|
<!-- Last-Modified: 2011/04/29 17:59:56 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Google Summer of Code 2010
|
||||||
|
|
||||||
|
|
||||||
|
# IS OVER! See the wiki:GSOC2011
|
||||||
|
|
||||||
|
|
||||||
|
## Welcome!
|
||||||
|
|
||||||
|
### 2010 will is the inaugural year of the Mapnik project's involvement in GSOC.
|
||||||
|
|
||||||
|
*We were accepted as an organization for 2010 program! *
|
||||||
|
|
||||||
|
### Help make it amazing
|
||||||
|
|
||||||
|
* Keep a close eye on the schedule: http://socghop.appspot.com/document/show/gsoc_program/google/gsoc2010/faqs#timeline
|
||||||
|
|
||||||
|
* *If you are a potential student*:
|
||||||
|
* Review, comment, and add to the list of ideas at wiki:GSOC2010/Ideas
|
||||||
|
* Sign up for the [mapnik-users](http://lists.berlios.de/mailman/listinfo/mapnik-users) mailing list and introduce yourself and your interests
|
||||||
|
* Start compiling, running, and learning about the Mapnik codebase and most of all start asking questions!
|
||||||
|
|
||||||
|
* *If you are a potential mentor*:
|
||||||
|
* Create a profile at the gsoc site: http://socghop.appspot.com/document/show/gsoc_program/google/gsoc2010/userguide#quick_all
|
||||||
|
* Start adding to wiki:GSOC2010/Ideas (and list your info)
|
||||||
|
* Make note if you are interested in reviewing applications
|
||||||
|
* Need an idea, see Steve8's: http://trac.mapnik.org/wiki/Ideas
|
||||||
|
|
||||||
|
### Administrator
|
||||||
|
|
||||||
|
* [Dane Springmeyer](http://dbsgeo.com) (Also acting as organization administrator)
|
||||||
|
* please feel free to contact with any questions by email: dbsgeo@gmail.com
|
||||||
|
* Here was the wiki:GSOC2010/Application, submitted March 11th.
|
||||||
|
|
124
GSOC2010_Application.md
Normal file
124
GSOC2010_Application.md
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
<!-- Name: GSOC2010/Application -->
|
||||||
|
<!-- Version: 3 -->
|
||||||
|
<!-- Last-Modified: 2010/03/12 10:59:40 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Google Summer of Code 2010 Application
|
||||||
|
|
||||||
|
*** Submitted Fri Mar 12 18:58:29 UTC 2010 ***
|
||||||
|
|
||||||
|
*** Changes can be made until Friday, 12. March 2010 11:00PM ***
|
||||||
|
|
||||||
|
* Submitted at: http://socghop.appspot.com/gsoc/org_app/take/gsoc_program/google/gsoc2010/orgapp
|
||||||
|
|
||||||
|
## Link ID
|
||||||
|
mapnik
|
||||||
|
|
||||||
|
## Organization Name (required)
|
||||||
|
Mapnik
|
||||||
|
|
||||||
|
## Description (required)
|
||||||
|
Mapnik is a cross-platform mapping toolkit focused on making beautiful maps. It is the rendering engine behind sites like OpenStreetMap.org, Everyblock.org, Cloudmade.com, and Kosmosnimki.ru, and powers emerging tools for the web like MapBox.com, TileDrawer.com, and MapOSMatic.org.
|
||||||
|
|
||||||
|
|
||||||
|
## Home Page (required)
|
||||||
|
http://mapnik.org/
|
||||||
|
|
||||||
|
## What license does your organization use? (required)
|
||||||
|
LGPLv2
|
||||||
|
|
||||||
|
|
||||||
|
## Why is your organization applying to participate in GSoC 2010? What do you hope to gain by participating? (required)
|
||||||
|
|
||||||
|
The Mapnik project seeks to advance the role of beautiful cartography and advanced visualization on the web by growing the community of developers capabable of contributing to the Mapnik rendering engine. We want to see the graphics problems inherent in using and displaying complex datasets become easier solve through Mapnik, by adding support for things like better multi-resolution printing and scaling, sophisticated compositing of layers, and the ability to to visualize the logic inside the Mapnik engine in graphical front-ends. Also we want to further the possibilities and examples of using Mapnik with other projects like QGIS, Cairo, Django, and think that many of the potential projects we have in mind could further cross-collaboration with other prominent mentor organizations like OSGEO.
|
||||||
|
|
||||||
|
|
||||||
|
## Did your organization participate in past GSoCs? If so, please summarize your involvement and the successes and challenges of your participation.
|
||||||
|
|
||||||
|
No, this is our first year!
|
||||||
|
|
||||||
|
## If your organization participated in past GSoCs, please let us know the ratio of students passing to students allocated, e.g. 2006: 3/6 for 3 out of 6 students passed in 2006.
|
||||||
|
|
||||||
|
Not applicable.
|
||||||
|
|
||||||
|
## Add a Comment (optional):
|
||||||
|
Not applicable.
|
||||||
|
|
||||||
|
## What is the URL for your ideas page? (required)
|
||||||
|
http://trac.mapnik.org/wiki/GSOC2010/Ideas
|
||||||
|
|
||||||
|
## What is the main development mailing list for your organization? This question will be shown to students who would like to get more information about applying to your organization for GSoC 2010. If your organization uses more than one list, please make sure to include a description of the list so students know which to use. (required)
|
||||||
|
|
||||||
|
mapnik-devel - http://lists.berlios.de/mailman/listinfo/mapnik-devel
|
||||||
|
|
||||||
|
|
||||||
|
## What is the main IRC channel for your organization? (required)
|
||||||
|
|
||||||
|
#mapnik on the irc.freenode.net.
|
||||||
|
|
||||||
|
## Add a Comment (optional)
|
||||||
|
|
||||||
|
## Does your organization have an application template you would like to see students use? (required)
|
||||||
|
*Name:*
|
||||||
|
|
||||||
|
*Country:*
|
||||||
|
|
||||||
|
*School and degree:*
|
||||||
|
|
||||||
|
*Email:*
|
||||||
|
|
||||||
|
*Phone:*
|
||||||
|
|
||||||
|
*Title:*
|
||||||
|
|
||||||
|
*Describe your idea*
|
||||||
|
# Introduction
|
||||||
|
# Background
|
||||||
|
# The idea
|
||||||
|
# Project plan (how do you plan to spend your summer?)
|
||||||
|
# Future ideas / How can your idea be expanded?
|
||||||
|
|
||||||
|
*Explain how your SoC task would benefit the the Mapnik community and what other projects might benefit directly or by example:*
|
||||||
|
|
||||||
|
*Please provide details of previous experience with C++, python:*
|
||||||
|
|
||||||
|
*Please provide details of previous experience with the Antigrain Geometry Library, Cairo, or Boost:*
|
||||||
|
|
||||||
|
*Please provide details of previous experience with mapping or GIS:*
|
||||||
|
|
||||||
|
*Please tell us why you are interested in GIS and open source software:*
|
||||||
|
|
||||||
|
*Please tell us why you are interested in your specific coding project:*
|
||||||
|
|
||||||
|
*Do you understand this is a serious commitment, equivalent to a full-time paid summer internship or summer job?*
|
||||||
|
|
||||||
|
## What criteria did you use to select the individuals who will act as mentors for your organization? Please be as specific as possible
|
||||||
|
Since this is our first year applying we have no formal criteria for Mentors. Mentors are self-nominated by their offering of project ideas and commitment to mentor by listing an idea on the Mapnik GSOC ideas page. All mentors that have proposed projects ideas so far are active contributers to the Mapnik community and the project administrator, Dane Springmeyer, is supportive of their involvement and capability of helping provide guidance to students.
|
||||||
|
|
||||||
|
## What is your plan for dealing with disappearing students? (required)
|
||||||
|
We will ensure that any students accepted provide all their important contact information and the program administrator and mentors be in frequent contact with them to ensure that the level of committment needed to work on Mapnik successfully is clear to all students.
|
||||||
|
|
||||||
|
We will also clearly state our reporting goals, which includes tracking their progress in Mapnik Trac "milestones", active involvement in #mapnik irc with questions, weekly progress reports to the mapnik-devel mailing list, and ideally blog postings detailing their ideas and highlights.
|
||||||
|
|
||||||
|
## What is your plan for dealing with disappearing mentors? (required)
|
||||||
|
|
||||||
|
We plan to have at least 1-2 backup mentors, that are very knowlegable about the Mapnik internals and can help answer questions if the primarily mentor is out of touch for travel or sickness.
|
||||||
|
|
||||||
|
We also plan to support projects that encourage cross-collaboration with OSGEO SOC projects, and we anticipate that if we are accepted there will be potential duel-mentoring possibilities within OSGEO projects.
|
||||||
|
|
||||||
|
## What steps will you take to encourage students to interact with your community before, during, and after the program? (required)
|
||||||
|
|
||||||
|
Weekly reports to the mapnik-devel mailing list, collaboration encouraged on #mapnik irc, and blogging about highlights or problems encountered.
|
||||||
|
|
||||||
|
We also will encourage students to keep their code in a public and easily visible branch of Mapnik svn (or git-svn) (or mirrored if they use the GSOC repository), so that all work can be previewed and supported by the wide Mapnik community that follows tickets and commits via RSS and IRC.
|
||||||
|
|
||||||
|
## What will you do to ensure that your accepted students stick with the project after GSoC concludes? (required)
|
||||||
|
Positive feedback is an essential ingredient to keeping students involved and having them turn into longer term developers and maintainers. Mapnik has great potential, as a young and enthusiastic project, to help students feel valued and encouraged. Also mentors and the project administrator are commited to spreading the word about good student work to the other projects that depend on Mapnik software.
|
||||||
|
|
||||||
|
|
||||||
|
## Is there anything else you would like to tell the Google Summer of Code program administration team? (required)
|
||||||
|
It is a great honor to be able to apply and thanks for the inspiring work you do to support Open Source development.
|
||||||
|
|
||||||
|
## Please select your backup group administrator.
|
||||||
|
|
||||||
|
Backup administrators:
|
||||||
|
* Artem Pavlenko (melange: artemp)
|
218
GSOC2010_Ideas.md
Normal file
218
GSOC2010_Ideas.md
Normal file
|
@ -0,0 +1,218 @@
|
||||||
|
<!-- Name: GSOC2010/Ideas -->
|
||||||
|
<!-- Version: 26 -->
|
||||||
|
<!-- Last-Modified: 2011/02/18 17:22:14 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# Google Summer of Code Ideas
|
||||||
|
|
||||||
|
Mapnik will participate in Google Summer of Code 2010.
|
||||||
|
|
||||||
|
Both potential students and mentors can start adding their ideas for potential projects here.
|
||||||
|
|
||||||
|
See the main page for more details: wiki:GSOC2010
|
||||||
|
|
||||||
|
See also steve8's ideas page: http://trac.mapnik.org/wiki/Ideas
|
||||||
|
|
||||||
|
|
||||||
|
# Project Ideas
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
# Results
|
||||||
|
* *Mapnik Python3k Support*: Done: see wiki:Python3k
|
||||||
|
|
||||||
|
* *Layer Composites*: Too hard for a GSOC student, but hopefully will be tackled by core devs soon
|
||||||
|
|
||||||
|
* *Better Print Support*: GSOC Student Carlos finished adding scale_factor to agg_renderer and wrote a custom svg_renderer (also see: https://github.com/thjc/mapnik-svg)
|
||||||
|
|
||||||
|
* *Support for outputting hit-areas*: GSOC Student Herm created MetaWriter
|
||||||
|
|
||||||
|
* *Processnik*: DevSeed wrote something like this, see http://tilemill.com
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## Mapnik Python3k Support
|
||||||
|
### Description
|
||||||
|
Mapnik uses Boost.Python for its python bindings. Boost.Python is written in C++ and recently added support for Python 3.x based on the excellent [2009 Google Summer of Code project by Haoyu Bai](http://socghop.appspot.com/gsoc/student_project/show/google/gsoc2009/boost/t124021999037) (mentored by Stefan Seefeld). An amazing addition to the Mapnik library would be following up on this work and applying it to Mapnik for full python 3.x support.
|
||||||
|
|
||||||
|
In addition, if interest and time this project could look at exposing more pythonic access to Mapnik C++ objects, perhaps using a more declarative style (#459) and extending wrapping of key object like r1740.
|
||||||
|
|
||||||
|
### How it would benefit Mapnik Project
|
||||||
|
Mapnik would be compatible with both Python 2.x and Python 3.x, paving the way for better integration with other leading python applications. Better python style would encourage faster and funner development.
|
||||||
|
|
||||||
|
### What student would learn
|
||||||
|
The student would learn about the latest advances in Boost Python, the intricacies of Mapnik's Python bindings, and overall very valuable skills that could be applied to a range of other projects that have yet to upgrade to Python 3.x.
|
||||||
|
|
||||||
|
### Submitter
|
||||||
|
[Dane Springmeyer](http://dbsgeo.com)
|
||||||
|
|
||||||
|
### Possible Mentors
|
||||||
|
[Dane Springmeyer](http://dbsgeo.com)
|
||||||
|
|
||||||
|
### Technical Issues
|
||||||
|
* See ticket #334 for more details
|
||||||
|
* -- springmeyer - March 12th,2010
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
----
|
||||||
|
|
||||||
|
## Layer Composites
|
||||||
|
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Mapnik layers should be able to interact with one another just like layers in Photoshop. They could have transfer modes (e.g. screen, hard light, darken), masks, and groups. The XML description for this would be backward-compatible with the current Mapnik stylesheet language, but when new markup is added, such as a _mode_ or _opacity_ attribute on a layer, a _Group_ element around a group of layers, or a _Mask_ layer inside another layer, new behaviors could be seen.
|
||||||
|
|
||||||
|
### How it would benefit Mapnik Project
|
||||||
|
Mapnik would natively create complex, layered maps like the amazing [TopOSM](http://wiki.openstreetmap.org/wiki/TopOSM).
|
||||||
|
|
||||||
|
### What student would learn
|
||||||
|
The student would learn the internals of Mapnik and the math and complexity behind Photoshop-style image compositing.
|
||||||
|
|
||||||
|
### Submitter
|
||||||
|
[Mike Migurski](http://mike.teczno.com) (mike@stamen.com)
|
||||||
|
|
||||||
|
### Possible Mentors
|
||||||
|
Unsure who would be a willing mentor - [I](http://mike.teczno.com) know what would be a great-looking end result and could help with the math and cartography and XML format bits, but I can't offer C++ help of any kind. Maybe this is a bidirectional mentorship? =)
|
||||||
|
|
||||||
|
### Technical Issues
|
||||||
|
* Maybe is possible to use other free software (like imagemagick) instead Photoshop to study layer composing, i'm interesting to develop this idea, i have a little knowledge of C++ but i can study it in these months before GSOC will start
|
||||||
|
* -- luca delucchi - March 11, 2009
|
||||||
|
|
||||||
|
* GRASS GIS made something similar with [r.his](http://grass.osgeo.org/grass64/manuals/html64_user/r.his.html)
|
||||||
|
* -- luca delucchi - March 12, 2009
|
||||||
|
|
||||||
|
* Seems perhaps related to #314
|
||||||
|
* -- springmeyer - March 12, 2009
|
||||||
|
|
||||||
|
* TopOSM does indeed use ImageMagick for compositing, so that may be a good thing to look at. See http://wiki.openstreetmap.org/wiki/TopOSM/Details for more info about how it is done.
|
||||||
|
* -- Lars Ahlzen - March 13, 2010
|
||||||
|
|
||||||
|
* See also: http://wiki.openstreetmap.org/wiki/User:Kobezda/GSoC
|
||||||
|
* -- Dane Springmeyer - April 6, 2010
|
||||||
|
|
||||||
|
* Potential spec could look like: http://trac.mapnik.org/wiki/Ideas/Compositing
|
||||||
|
* -- Dane Springmeyer - April 6, 2010
|
||||||
|
|
||||||
|
* Good brainstorming thread on issues around compositing on #mapnik April 7th: http://mapnik.dbsgeo.com/mapnik_logs/2010/04/07/
|
||||||
|
* -- Dane Springmeyer - April 7, 2010
|
||||||
|
|
||||||
|
* Ideas/Compositing - shawnbot's idea around a potential syntax
|
||||||
|
|
||||||
|
----
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
## Better Print Support
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Through the growth of projects using Mapnik rendering, like http://OpenStreetMap.org, http://Walking-Papers.org, and http://MapOSMatic.org, more and more users are looking to print out Mapnik cartography. Target formats are large paper plots or other variable-resolution digital formats (vectors like PDF/SVG). It is an exciting and powerful thing to be able to use the same renderer for web cartography as multi-resolution cartography, and due to Mapnik's solid Cairo Rendering backend the foundation is in place for multi-resolution output. But currently Mapnik has a few limits which hold back optimal print and vector output.
|
||||||
|
|
||||||
|
Potential subtopics include:
|
||||||
|
* Mapnik's understanding of units could be expanded beyond just pixels (#389)
|
||||||
|
* Users could gain hooks into the Mapnik rendering process to control scaling directives (#343), and tune currently hardcoded map scale assumptions (#196)
|
||||||
|
* More internal objects could be logically scalable
|
||||||
|
* e.g. we need to be able to scale raster graphics which should be feasible (not going to look very good, but still needed: see #155)
|
||||||
|
* and ideally need scalable vector symbols as per #320 (this is likely out of the scope of a GSOC project but should be considered).
|
||||||
|
* Other cool stuff can (and should for proper paper output) be drawn on the map: #358 (see also wiki:Legending)
|
||||||
|
* Lastly, certain limitations exist in the Cairo API Mapnik uses that might be able to be addressed by student research/coding:
|
||||||
|
* notably Cairo does not currently embedded fonts in SVG output but rather falls back to vectors to represent fonts.(#535)
|
||||||
|
|
||||||
|
So, to recap Mapnik output could be easily adjustable to various scales and point sizes, use vector or multi-scale symbolizers (shields, points, texture fills, etc), svg icons, etc. SVG supports text on a path, perhaps this could be used in the output. Something like scale-9 might be useful for highway shields: http://www.sephiroth.it/tutorials/flashPHP/scale9/ ... all this should be documented, too! In combination with cascadenik, maybe this uses the CSS media attributes, and could be extended to other changes in resolution like mobile cartography too.
|
||||||
|
|
||||||
|
### How it would benefit Mapnik Project
|
||||||
|
Mapnik would continue to be an attractive way to structure and process cartographic information and a single stylesheet could be generalized and applicable in multiple contexts.
|
||||||
|
|
||||||
|
### What student would learn
|
||||||
|
The student would learn the internals of Mapnik (AGG, Boost etc) and the subtleties of multi-scale and multi-resolution rendering. There's a tension between the accuracy of pixels and the reusable nature of measurements specified in points, inches, millimeters etc. that will be very familiar to users and authors of graphical software. The student would learn all that.
|
||||||
|
|
||||||
|
### Submitter
|
||||||
|
[Tom Carden](http://www.tom-carden.co.uk) (tom@tom-carden.co.uk)
|
||||||
|
|
||||||
|
### Possible Mentors
|
||||||
|
As above, [I](http://www.tom-carden.co.uk) would be willing to mentor this from a sanity, usefulness and syntax point of view but not really from a C++ internals point of view.
|
||||||
|
|
||||||
|
I would be interested in co-mentoring this project from an Mapnik/C++ internals point of view
|
||||||
|
* -- dane springmeyer - March 21, 2010
|
||||||
|
|
||||||
|
|
||||||
|
### Technical Issues
|
||||||
|
* This could be done in tandem with two students/mentors with OpenStreetMap
|
||||||
|
* *Important*: see discussion also at: http://wiki.openstreetmap.org/wiki/GSoC_Project_Ideas_2010#Paper_Output_Projects
|
||||||
|
* -- dane springmeyer - March 21, 2010
|
||||||
|
|
||||||
|
* Existing tickets that could be advanced/started as part of this project include: #343 and #389
|
||||||
|
* --dane springmeyer - March 21, 2010
|
||||||
|
|
||||||
|
* This has many linkages with the idea of [OSGEO Cartographic Library](http://wiki.osgeo.org/wiki/OSGeo_Cartographic_Engine#Ideas_for_Summer_of_Code_2010_Project)
|
||||||
|
* --dane springmeyer - March 9, 2010
|
||||||
|
|
||||||
|
* One student application on this topic is being prepared at: http://betterprintsupport.blogspot.com/
|
||||||
|
|
||||||
|
* Two more examples of people using Mapnik for printed output:
|
||||||
|
* http://oliverobrien.co.uk/2010/03/map-adornments-with-cairo/
|
||||||
|
* http://razor.occams.info/blog/2010/02/26/printable-congressional-district-maps-behind-the-scenes/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
----
|
||||||
|
|
||||||
|
## Support for outputting hit-areas
|
||||||
|
|
||||||
|
### Description
|
||||||
|
It should be possible to specify a layer as "clickable" and as well as outputting an image output a corresponding data file (e.g. JSON or HTML map/area tags or raw geometry) that could be used to perform hit tests. This could be used to make clickable points, lines or polygons. Demo implementation could be done using OpenLayers, perhaps. This idea could be extended to embedding metadata directly in image files, for example all visible street names could be added as EXIF data so that a map image (might) appear in an image search for a street.
|
||||||
|
|
||||||
|
### How it would benefit Mapnik Project
|
||||||
|
Mapnik would continue to be the first open-source choice for rendering web-based maps. Mapnik's geometry internals would be robustly exposed to outputting (projected, image-space) geometry with arbitrary selections of metadata.
|
||||||
|
|
||||||
|
### What student would learn
|
||||||
|
The student would learn the internals of mapnik and the very edges of the trade-offs between raster and vector imagery for interactivity on the web.
|
||||||
|
|
||||||
|
### Submitter
|
||||||
|
[Tom Carden](http://www.tom-carden.co.uk)
|
||||||
|
|
||||||
|
### Possible Mentors
|
||||||
|
As above, [I](http://www.tom-carden.co.uk) would be willing to mentor this from a sanity, usefulness and syntax point of view but not really from a C++ internals point of view.
|
||||||
|
|
||||||
|
### Technical Issues
|
||||||
|
|
||||||
|
----
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
## Processnik
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Processing http://processing.org for Mapnik/Cascadenik. Or Nodebox, for Python folks. Basically a tabbed text editor with a play button that would preview a map. But clearly Mapnik requires a few more features than that: it would be lovely to be able to interrogate/browse data sets and find out which attributes should be used. It would be ideal, Firebug style, to click on a street and find out which styles were applied to it. It would be great to have a slippy map as a preview. Perhaps this is an extension of Quantumnik. Perhaps it's a Firefox extension that uses Mapnik's SVG output and then piggybacks onto Firebug. Who knows?
|
||||||
|
|
||||||
|
### How it would benefit Mapnik Project
|
||||||
|
GUI tools bring users, users bring fame and glory.
|
||||||
|
|
||||||
|
### What student would learn
|
||||||
|
GUI development, Mapnik internals, Cascadenik, Python, etc. Plus a healthy dose of reaching out to cartographers who don't want to edit code. Setting up layers with database queries in this environment would be tricky, but simple shapefile rendering should be totally doable.
|
||||||
|
|
||||||
|
### Submitter
|
||||||
|
[Tom Carden](http://www.tom-carden.co.uk)
|
||||||
|
|
||||||
|
### Possible Mentors
|
||||||
|
As above, [I](http://www.tom-carden.co.uk) would be willing to mentor this from a sanity, usefulness and syntax point of view but not really from a C++ internals point of view.
|
||||||
|
|
||||||
|
### Technical Issues
|
||||||
|
|
||||||
|
----
|
||||||
|
----
|
||||||
|
|
||||||
|
Format should be:
|
||||||
|
|
||||||
|
## NAME HERE
|
||||||
|
### Description
|
||||||
|
### How it would benefit Mapnik Project
|
||||||
|
### What student would learn
|
||||||
|
### Submitter
|
||||||
|
### Possible Mentors
|
||||||
|
### Technical Issues
|
||||||
|
* Comment/Idea
|
||||||
|
* -- name of person commenting - date
|
||||||
|
----
|
33
GSOC2011.md
Normal file
33
GSOC2011.md
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<!-- Name: GSOC2011 -->
|
||||||
|
<!-- Version: 2 -->
|
||||||
|
<!-- Last-Modified: 2011/04/29 18:01:05 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Google Summer of Code 2011
|
||||||
|
|
||||||
|
## Welcome!
|
||||||
|
|
||||||
|
### 2011 is the second year of the Mapnik project's involvement in GSOC.
|
||||||
|
|
||||||
|
We were accepted as an organization for 2011 program!
|
||||||
|
|
||||||
|
[Three students were accepted](http://mapnik.org/news/2011/apr/25/three_students_mapnik_gsoc_2011/)
|
||||||
|
|
||||||
|
### Help make it amazing
|
||||||
|
|
||||||
|
* Keep a close eye on the schedule: http://socghop.appspot.com/document/show/gsoc_program/google/gsoc2011/faqs#timeline
|
||||||
|
|
||||||
|
* *If you are a potential student*:
|
||||||
|
* Review, comment, and add to the list of ideas at wiki:GSOC2011/Ideas
|
||||||
|
* Sign up for the [mapnik-users](http://lists.berlios.de/mailman/listinfo/mapnik-users) mailing list and introduce yourself and your interests
|
||||||
|
* Start compiling, running, and learning about the Mapnik codebase and most of all start asking questions!
|
||||||
|
|
||||||
|
* *If you are a potential mentor*:
|
||||||
|
* Create a profile at the gsoc site: http://socghop.appspot.com/document/show/gsoc_program/google/gsoc2011/userguide#quick_all
|
||||||
|
* Start adding to wiki:GSOC2011/Ideas (and list your info)
|
||||||
|
* Make note if you are interested in reviewing applications
|
||||||
|
* Need an idea? See Steve8's: http://trac.mapnik.org/wiki/Ideas
|
||||||
|
|
||||||
|
### Administrator
|
||||||
|
|
||||||
|
* Ian Dees (acting as organization administrator)
|
||||||
|
* please feel free to contact with any questions by email: iandees@gmail.com
|
203
GSOC2011_Ideas.md
Normal file
203
GSOC2011_Ideas.md
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
<!-- Name: GSOC2011/Ideas -->
|
||||||
|
<!-- Version: 8 -->
|
||||||
|
<!-- Last-Modified: 2011/04/29 18:02:00 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# Google Summer of Code Ideas
|
||||||
|
|
||||||
|
Mapnik was accepted to participate in Google Summer of Code 2011.
|
||||||
|
|
||||||
|
Three students were accepted this year: http://mapnik.org/news/2011/apr/25/three_students_mapnik_gsoc_2011/
|
||||||
|
|
||||||
|
See the main page for more details: wiki:GSOC2011
|
||||||
|
|
||||||
|
See also steve8's ideas page: http://trac.mapnik.org/wiki/Ideas
|
||||||
|
|
||||||
|
|
||||||
|
# Project Ideas
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Format should be:
|
||||||
|
|
||||||
|
## NAME HERE
|
||||||
|
### Description
|
||||||
|
### How it would benefit Mapnik Project
|
||||||
|
### What student would learn
|
||||||
|
### Submitter
|
||||||
|
### Possible Mentors
|
||||||
|
### Technical Issues
|
||||||
|
* Comment/Idea
|
||||||
|
* -- name of person commenting - date
|
||||||
|
----
|
||||||
|
|
||||||
|
# Mapnik PHP extension
|
||||||
|
# Description
|
||||||
|
The Mapnik library can be used from its native language C++ or from Python by using the Python Mapnik bindings. I propose a GSoC project to fully develop PHP bindings for Mapnik. The large user base of PHP developers means that PHP bindings will make Mapnik available to a whole new audience. I’ve done initial work already on these bindings, and a proof of concept is available. The GSoC project would make it possible to mature this proof of concept to a complete PHP wrapper around Mapnik 0.7 and 2.0. It would also make the extension easily accessible to other developers with build systems for Linux and Windows and have QA with unit tests and automated testing against various versions of PHP. Ideally it should also be able to read XML-based stylesheets and render maps based on them.
|
||||||
|
# How it would benefit Mapnik Project
|
||||||
|
The Mapnik project would benefit from having PHP bindings by being opened up to a lot more potential users. There are many PHP developers writing software for the web. Having PHP as a fully supported language to use Mapnik from, next to C++ and Python, will allow many people to add mapping functionality to their web projects while staying within the same technology stack.
|
||||||
|
# What student would learn
|
||||||
|
PHP/Zend internals and build system; Mapnik internals; unit testing best practices.
|
||||||
|
# Submitter
|
||||||
|
Roel Vanhout
|
||||||
|
= Possible Mentors =
|
||||||
|
???
|
||||||
|
# Technical Issues
|
||||||
|
Technical issues include finding reusable C++ patterns to comfortably work with the Zend extension API, finding ways to optimize the performance hit that comes with scriptings languages and can be substantial for operations that are performed many times and finding a balance in the API design between the idiomatich PHP way and staying close to Mapnik C++.
|
||||||
|
|
||||||
|
----
|
||||||
|
# Cartographic elements
|
||||||
|
# Description
|
||||||
|
Mapnik is mostly focused on rendering maps for the Web, in the form of tiles – map cutouts that are combined to look like one big map. Cartography is more than that, though. For non-interactive maps, traditional cartographic elements like map headers, legends, a north arrow etc. need to be added. I propose an extension to the Mapnik library that allows users to specify these elements and in this way render complete production-quality maps, without having to use other software.
|
||||||
|
The project would start with an inventarisation of required mapping elements in the form of a literature study on cartographic design. After a set of map elements to be implemented is selected, the API needs to be designed that fits with the rest of the Mapnik API. Finally this API needs to be implemented, and tests written to check its correct functioning.
|
||||||
|
# How it would benefit Mapnik Project
|
||||||
|
The described functionality will broaden the applicability of Mapnik as a multi-purpose map rendering library. It will allow making complete, cartographically correct maps from within the comfort of a text editor. These added visual features will allow Mapnik to be a general-purpose map renderer, and not just a Web tile generator.
|
||||||
|
# What student would learn
|
||||||
|
Fundamentals of (computer-based) cartographic design; Mapnik internals.
|
||||||
|
# Submitter
|
||||||
|
Roel Vanhout
|
||||||
|
# Possible Mentors
|
||||||
|
???
|
||||||
|
# Technical Issues
|
||||||
|
The issues with this project are in finding generic ways to specify map elements, in ways that provide a natural fit with the data and provide as much flexibility to the cartographer as possible for maximum expressiveness. As much of the rendering code in the rest of Mapnik should be re-used, e.g. SVG code for rendering SVG north arrows.
|
||||||
|
|
||||||
|
* See also http://trac.mapnik.org/wiki/Legending and http://trac.mapnik.org/ticket/536 .
|
||||||
|
|
||||||
|
* Scale bars, legends, and grid lines are implemented in this evolving work within a python 'printing' module: https://github.com/thjc/mapnik-svg
|
||||||
|
o -- Dane Springmeyer - April 5, 2011
|
||||||
|
|
||||||
|
----
|
||||||
|
# Gradient support for polygons
|
||||||
|
# Description
|
||||||
|
When rendering thematic maps like choropleth maps, gradients are a popular design tool to create visually more exciting maps. This project would add gradient support to the polygon rendering code. There are several ways to apply gradients to a collection of polygons (which constitute most maps); the user should be able to precisely define a gradient (possibly in several color models) and how to apply it to the polygon features.
|
||||||
|
# How it would benefit Mapnik Project
|
||||||
|
Gradient support for polygons would allow users to create more visually pleasing maps and as such will make Mapnik more attractive to users. This project can also result in gradient representations that can be re-used throughout other parts of Mapnik that can be rendered as gradients.
|
||||||
|
# What student would learn
|
||||||
|
Computer graphics concepts, Mapnik internals
|
||||||
|
# Submitter
|
||||||
|
Roel Vanhout
|
||||||
|
# Possible Mentors
|
||||||
|
???
|
||||||
|
# Technical Issues
|
||||||
|
Finding a memory-efficient way to apply gradients across multiple polygons, potentially color model issues in rendering libraries.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
# Layer Composites
|
||||||
|
## Description
|
||||||
|
|
||||||
|
_Note: this was taken over from [[GSOC2010/Ideas#LayerComposites | ideas GSoC2010]] and amended with the bitmap filter feature_
|
||||||
|
|
||||||
|
Mapnik layers should be able to interact with one another just like layers in Photoshop. They could have transfer modes (e.g. screen, hard light, darken), masks, and groups. The XML description for this would be backward-compatible with the current Mapnik stylesheet language, but when new markup is added, such as a mode or opacity attribute on a layer, a Group element around a group of layers, or a Mask layer inside another layer, new behaviors could be seen. An additional feature could be to make bitmap filters work on those layers (gaussian blur, offset and others).
|
||||||
|
## How it would benefit Mapnik Project
|
||||||
|
|
||||||
|
Mapnik would natively create complex, layered maps like the amazing TopOSM.
|
||||||
|
## What student would learn
|
||||||
|
|
||||||
|
The student would learn the internals of Mapnik and the math and complexity behind Photoshop-style image compositing.
|
||||||
|
## Submitter
|
||||||
|
|
||||||
|
Mike Migurski (mike@…)
|
||||||
|
## Possible Mentors
|
||||||
|
|
||||||
|
Unsure who would be a willing mentor - I know what would be a great-looking end result and could help with the math and cartography and XML format bits, but I can't offer C++ help of any kind. Maybe this is a bidirectional mentorship? =)
|
||||||
|
## Technical Issues
|
||||||
|
|
||||||
|
* Maybe is possible to use other free software (like imagemagick) instead Photoshop to study layer composing, i'm interesting to develop this idea, i have a little knowledge of C++ but i can study it in these months before GSOC will start
|
||||||
|
o -- luca delucchi - March 11, 2009
|
||||||
|
|
||||||
|
* GRASS GIS made something similar with r.his
|
||||||
|
o -- luca delucchi - March 12, 2009
|
||||||
|
|
||||||
|
* Seems perhaps related to #314
|
||||||
|
o -- springmeyer - March 12, 2009
|
||||||
|
|
||||||
|
* TopOSM does indeed use ImageMagick? for compositing, so that may be a good thing to look at. See http://wiki.openstreetmap.org/wiki/TopOSM/Details for more info about how it is done.
|
||||||
|
o -- Lars Ahlzen - March 13, 2010
|
||||||
|
|
||||||
|
* See also: http://wiki.openstreetmap.org/wiki/User:Kobezda/GSoC
|
||||||
|
o -- Dane Springmeyer - April 6, 2010
|
||||||
|
|
||||||
|
* Potential spec could look like: http://trac.mapnik.org/wiki/Ideas/Compositing
|
||||||
|
o -- Dane Springmeyer - April 6, 2010
|
||||||
|
|
||||||
|
* Good brainstorming thread on issues around compositing on #mapnik April 7th: http://mapnik.dbsgeo.com/mapnik_logs/2010/04/07/
|
||||||
|
o -- Dane Springmeyer - April 7, 2010
|
||||||
|
|
||||||
|
* Ideas/Compositing - shawnbot's idea around a potential syntax
|
||||||
|
|
||||||
|
----
|
||||||
|
## Cascadenik: Native C++ implementation of node.js Carto
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
Cascadenik has evolved as we've figured out more and more, and integrating less.css syntax with Carto takes another leap. Now it's time to turn it into a native implementation inside mapnik, rather than just living as an external tool.
|
||||||
|
|
||||||
|
You'd need to research and maybe develop a parser for the Carto/Cascadenik/less.css syntax, including variables, classes, inheritance, IDs, and the use of attributes from vector features in style declarations - eg. `#mylayer { line-width: expr(1.7 * $POWER); }`
|
||||||
|
|
||||||
|
Links:
|
||||||
|
* Cascadenik: https://github.com/mapnik/Cascadenik
|
||||||
|
* Carto: https://github.com/mapbox/carto
|
||||||
|
|
||||||
|
### How it would benefit Mapnik Project
|
||||||
|
|
||||||
|
* Faster parsing performance
|
||||||
|
* Match to internal features - rather than being maintained outside and incompatibilities introduced.
|
||||||
|
* Less code-smell - the python Cascadenik code has evolved well beyond its initial design
|
||||||
|
* Wider adoption of CSS-like syntax for styling maps, lowering barriers
|
||||||
|
|
||||||
|
### What student would learn
|
||||||
|
|
||||||
|
A hell of a lot about styling maps :) Seriously though, exploring the depths of mapnik's rendering options. Designing and implementing syntax parsing of less.css/css in C++, and having it extensible as we continue to add new symbolizers and options.
|
||||||
|
|
||||||
|
### Submitter
|
||||||
|
|
||||||
|
Rob Coup
|
||||||
|
|
||||||
|
### Possible Mentors
|
||||||
|
|
||||||
|
Rob Coup, Dane Springmeyer
|
||||||
|
|
||||||
|
### Technical Issues
|
||||||
|
|
||||||
|
todo
|
||||||
|
|
||||||
|
----
|
||||||
|
## Cascadenik/Carto: SLD Converter
|
||||||
|
### Description
|
||||||
|
|
||||||
|
Mapnik to Geoserver already started e.g https://github.com/dwins/mapnik2geotools/
|
||||||
|
|
||||||
|
SLD is an OGC standard for map styling. It's XML and isn't really human-editable. It makes peoples eyes bleed. Cascadenik & Carto are CSS-like ways to define map styles. They're easy, like styling a web page.
|
||||||
|
|
||||||
|
Being able to compile a set of Cascadenik/Carto styles into corresponding SLD would be great! Build styles easily, yet have them standards-compliant for use in/with WxS servers.
|
||||||
|
|
||||||
|
First priority would be Cascadenik/Carto > SLD. Second priority would be the reverse.
|
||||||
|
|
||||||
|
Links:
|
||||||
|
* SLD standard: http://www.opengeospatial.org/standards/sld
|
||||||
|
* SLD in GeoServer: http://docs.geoserver.org/latest/en/user/styling/index.html
|
||||||
|
* Cascadenik: https://github.com/mapnik/Cascadenik
|
||||||
|
* Carto: https://github.com/mapbox/carto
|
||||||
|
|
||||||
|
|
||||||
|
### How it would benefit Mapnik Project
|
||||||
|
|
||||||
|
People could use Cascadenik/Carto styles to set up rendering in GeoServer, etc. This drives the popularity of the Cascadenik/Carto syntax and the mapnik project.
|
||||||
|
|
||||||
|
### What student would learn
|
||||||
|
|
||||||
|
XML, Cascadenik, Carto, CSS-like syntax parsing. You'd need to design and build a flexible framework so that we can easily test compatibility and extend in the future with new rendering features.
|
||||||
|
|
||||||
|
### Submitter
|
||||||
|
|
||||||
|
Rob Coup
|
||||||
|
|
||||||
|
### Possible Mentors
|
||||||
|
|
||||||
|
Rob Coup
|
||||||
|
|
||||||
|
### Technical Issues
|
||||||
|
|
||||||
|
todo
|
168
GettingStarted.md
Normal file
168
GettingStarted.md
Normal file
|
@ -0,0 +1,168 @@
|
||||||
|
<!-- Name: GettingStarted -->
|
||||||
|
<!-- Version: 26 -->
|
||||||
|
<!-- Last-Modified: 2009/04/20 10:04:35 -->
|
||||||
|
<!-- Author: phispi -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# Tutorial 1 -- 'Hello,world!' in Python
|
||||||
|
|
||||||
|
== Step 1 ==
|
||||||
|
|
||||||
|
Make sure you have mapnik installed. Depending on your installation path you may need to modify your PYTHONPATH, /etc/ld.so.conf or export LD_LIBRARY_PATH, or whatever your system requires.
|
||||||
|
|
||||||
|
The simple check is to start python interpreter from a command line by typing python
|
||||||
|
and then just type:
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
>>> import mapnik
|
||||||
|
|
||||||
|
and if you don't see any complaints, you're on the right track. If you do, you have to check your installation again.
|
||||||
|
* Note: If you have built mapnik in debug mode you should see the available datasources listed, including:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
>>> import mapnik
|
||||||
|
registered datasource : gdal
|
||||||
|
registered datasource : postgis
|
||||||
|
registered datasource : raster
|
||||||
|
registered datasource : shape
|
||||||
|
|
||||||
|
## Step 2
|
||||||
|
|
||||||
|
The code below can be pasted into your python interpreter. Ideally paste line by line so you can confirm each step is working. The commented lines (#) should be able to be pasted without trouble, but depending on your interpreter setting may cause errors.
|
||||||
|
* See the code snippet in Step 3 for code without comments.
|
||||||
|
|
||||||
|
Import the mapnik python toolkit and setup the basic map parameters
|
||||||
|
|
||||||
|
#!python
|
||||||
|
import mapnik
|
||||||
|
|
||||||
|
# Instantiate a map object with given width, height and spatial reference system
|
||||||
|
m = mapnik.Map(600,300,"+proj=latlong +datum=WGS84")
|
||||||
|
# Set background colour to 'steelblue'.
|
||||||
|
# You can use 'named' colours, #rrggbb, #rgb or rgb(r%,g%,b%) format
|
||||||
|
m.background = mapnik.Color('steelblue')
|
||||||
|
|
||||||
|
* Note, Mapnik accepts any projection that Proj.4 handles. See http://spatialreference.org for the proj4 strings for various projections. For example http://spatialreference.org/ref/epsg/4326/mapnikpython/ will give you the exact parameters for EPSG 4326.
|
||||||
|
|
||||||
|
|
||||||
|
Create the Styles and Rules for the map symbology
|
||||||
|
|
||||||
|
#!python
|
||||||
|
# Now lets create a style and add it to the Map.
|
||||||
|
s = mapnik.Style()
|
||||||
|
# A Style can have one or more rules. A rule consists of a filter, min/max scale
|
||||||
|
# demoninators and 1..N Symbolizers. If you don't specify filter and scale denominators
|
||||||
|
# you get default values :
|
||||||
|
# Filter = 'ALL' filter (meaning symbolizer(s) will be applied to all features)
|
||||||
|
# MinScaleDenominator = 0
|
||||||
|
# MaxScaleDenominator = INF
|
||||||
|
# Lets keep things simple and use default value, but to create a map we
|
||||||
|
# we still must provide at least one Symbolizer. Here we want to fill countries polygons with
|
||||||
|
# greyish colour and draw outlines with a bit darker stroke.
|
||||||
|
|
||||||
|
r=mapnik.Rule()
|
||||||
|
r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9')))
|
||||||
|
r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1))
|
||||||
|
s.rules.append(r)
|
||||||
|
|
||||||
|
Connect the style information to your map and your data
|
||||||
|
|
||||||
|
#!python
|
||||||
|
# Here we have to add our style to the Map, giving it a name.
|
||||||
|
m.append_style('My Style',s)
|
||||||
|
|
||||||
|
# Here we instantiate our data layer, first by giving it a name and srs (proj4 projections string), and then by giving it a datasource.
|
||||||
|
lyr = mapnik.Layer('world',"+proj=latlong +datum=WGS84")
|
||||||
|
# Then provide the full filesystem path to a shapefile in WGS84 or EPSG 4326 projection without the .shp extension
|
||||||
|
# A sample shapefile can be downloaded from http://mapnik-utils.googlecode.com/svn/data/world_borders.zip
|
||||||
|
lyr.datasource = mapnik.Shapefile(file='/Users/path/to/your/data/world_borders')
|
||||||
|
lyr.styles.append('My Style')
|
||||||
|
|
||||||
|
Finally add the layers to the map and zoom to the full extent of the data layer
|
||||||
|
|
||||||
|
#!python
|
||||||
|
m.layers.append(lyr)
|
||||||
|
m.zoom_to_box(lyr.envelope())
|
||||||
|
|
||||||
|
Finish up by making the world map image
|
||||||
|
|
||||||
|
#!python
|
||||||
|
# Write the data to a png image called world.png in the base directory of your user
|
||||||
|
mapnik.render_to_file(m,'world.png', 'png')
|
||||||
|
|
||||||
|
# Exit the python interpreter
|
||||||
|
exit()
|
||||||
|
|
||||||
|
Then back in your normal shell type:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# On a mac
|
||||||
|
open world.png
|
||||||
|
# On windows
|
||||||
|
start world.png
|
||||||
|
|
||||||
|
Or navigate to your base directory and open world.png and the result should look like this:
|
||||||
|
[[BR]]
|
||||||
|
[[Image(world.png)]]
|
||||||
|
|
||||||
|
|
||||||
|
## Step 3
|
||||||
|
|
||||||
|
The next logical step is to run the same code as a python script from your shell/terminal. This way you will be able to modify and experiment with the settings.
|
||||||
|
|
||||||
|
This can be done by adding a line at the top of the script like:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
Copy this entire text below and save as a file called world.py.
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import mapnik
|
||||||
|
m = mapnik.Map(600,300,"+proj=latlong +datum=WGS84")
|
||||||
|
m.background = mapnik.Color('steelblue')
|
||||||
|
s = mapnik.Style()
|
||||||
|
r=mapnik.Rule()
|
||||||
|
r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9')))
|
||||||
|
r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1))
|
||||||
|
s.rules.append(r)
|
||||||
|
m.append_style('My Style',s)
|
||||||
|
lyr = mapnik.Layer('world',"+proj=latlong +datum=WGS84")
|
||||||
|
lyr.datasource = mapnik.Shapefile(file='/Users/path/to/your/data/world_borders')
|
||||||
|
lyr.styles.append('My Style')
|
||||||
|
m.layers.append(lyr)
|
||||||
|
m.zoom_to_box(lyr.envelope())
|
||||||
|
mapnik.render_to_file(m,'world.png', 'png')
|
||||||
|
* Don't forget to change the path to your world_borders shapefile.
|
||||||
|
* Note: Mapnik accepts both the absolute path to your data as well as the relative path
|
||||||
|
* Note: Same goes for the path to where you want to save your file
|
||||||
|
|
||||||
|
Next make the script executable. On Mac or Linux you would do this with the command:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
chmod +x world.py
|
||||||
|
|
||||||
|
Finally run the script with the command:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# You must be in the same directory as you saved the script
|
||||||
|
./world.py
|
||||||
|
# Add a second optional command to open the resulting file with one keystroke
|
||||||
|
# On a mac
|
||||||
|
./world.py; open world.png
|
||||||
|
# On windows
|
||||||
|
start world.py && start world.png
|
||||||
|
|
||||||
|
* Run this way the script will continually write over and open the world.png map.
|
||||||
|
* Now you can easily open the script in a separate text editor and try changing the dimensions, colors, or datasource (remember to use the correct projection).
|
||||||
|
|
||||||
|
To view the XML approach to make this same map head over to [XmlGettingStarted / Tutorial 2](/wiki:XMLGettingStarted/) which shows the use of XML map configurations.
|
||||||
|
|
||||||
|
To download this script along with other tutorial scripts see: http://code.google.com/p/mapnik-utils/
|
||||||
|
|
43
GlyphSymbolizer.md
Normal file
43
GlyphSymbolizer.md
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<!-- Name: GlyphSymbolizer -->
|
||||||
|
<!-- Version: 3 -->
|
||||||
|
<!-- Last-Modified: 2011/09/02 09:03:22 -->
|
||||||
|
<!-- Author: herm -->
|
||||||
|
# GlyphSymbolizer
|
||||||
|
|
||||||
|
*New in 0.8 (aka Mapnik2) but about to be removed again in Mapnik 2.1*
|
||||||
|
|
||||||
|
Renders a TrueType Glyph at the Feature's label location (usually the center of polygons/lines and on the point themselves).
|
||||||
|
|
||||||
|
(see source:trunk/tests/python_tests/glyph_symbolizer_test.py for sample usage)
|
||||||
|
|
||||||
|
|
||||||
|
## Sample XML Configuration
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Map>
|
||||||
|
<Style name="arrows">
|
||||||
|
<Rule>
|
||||||
|
<GlyphSymbolizer
|
||||||
|
face_name="DejaVu Sans Condensed"
|
||||||
|
size="10"
|
||||||
|
char="'í'"
|
||||||
|
allow_overlap="true"
|
||||||
|
avoid_edges="false"
|
||||||
|
halo_fill="rgba(0%,0%,0%,4%)"
|
||||||
|
halo_radius="1"
|
||||||
|
value="[value]"
|
||||||
|
angle="[azumuth]+90"
|
||||||
|
>
|
||||||
|
<RasterColorizer>
|
||||||
|
<ColorBand value="0" color="#0044cc"/>
|
||||||
|
<ColorBand value="10" color="#00cc00"/>
|
||||||
|
<ColorBand value="20" color="#ffff00"/>
|
||||||
|
</RasterColorizer>
|
||||||
|
</GlyphSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
TODO: Describe all parameters
|
306
HaitiStyles.md
Normal file
306
HaitiStyles.md
Normal file
|
@ -0,0 +1,306 @@
|
||||||
|
<!-- Name: HaitiStyles -->
|
||||||
|
<!-- Version: 10 -->
|
||||||
|
<!-- Last-Modified: 2010/01/19 18:54:23 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Haiti Styles
|
||||||
|
|
||||||
|
Sandbox for keeping haiti specific style renderings.
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
[[Image(fgdc_and_osm.png)]]
|
||||||
|
|
||||||
|
|
||||||
|
Note: styles based on maps in EPSG:4326 running Mapnik 0.7.
|
||||||
|
|
||||||
|
Mapnik compatible names when using TrueType Fonts ('ersV2txt' from http://www.fgdc.gov/HSWG/index.html):
|
||||||
|
|
||||||
|
#!python
|
||||||
|
>>> from mapnik import *
|
||||||
|
>>> fs = FontEngine.instance()
|
||||||
|
>>> for i in fs.face_names(): print i
|
||||||
|
...
|
||||||
|
ERS v2 Damage Regular
|
||||||
|
ERS v2 Incidents Regular
|
||||||
|
ERS v2 Infrastructures Stage 01 Regular
|
||||||
|
ERS v2 Infrastructures Stage 02 Regular
|
||||||
|
ERS v2 Infrastructures Stage 03 Regular
|
||||||
|
ERS v2 Infrastructures Stage 04 Regular
|
||||||
|
ERS v2 Natural Events Regular
|
||||||
|
ERS v2 Operations Stage 01 Regular
|
||||||
|
ERS v2 Operations Stage 02 Regular
|
||||||
|
ERS v2 Operations Stage 03 Regular
|
||||||
|
ERS v2 Operations Stage 04 Regular
|
||||||
|
|
||||||
|
|
||||||
|
Basic additions to osm2pgsql style for catching OSM tags that are emerging:
|
||||||
|
|
||||||
|
|
||||||
|
# haiti
|
||||||
|
node,way refugee text linear
|
||||||
|
node,way earthquake:damage text polygon
|
||||||
|
node,way impassable text linear
|
||||||
|
node,way name:ht text linear
|
||||||
|
|
||||||
|
|
||||||
|
Example of using TrueType fonts to try to utilize FGDC symbols:
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE Map [
|
||||||
|
<!ENTITY maxscale_zoom0 "<MaxScaleDenominator>250000000000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom1 "<MaxScaleDenominator>500000000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom1 "<MinScaleDenominator>200000000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom2 "<MaxScaleDenominator>200000000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom2 "<MinScaleDenominator>100000000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom3 "<MaxScaleDenominator>100000000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom3 "<MinScaleDenominator>50000000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom4 "<MaxScaleDenominator>50000000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom4 "<MinScaleDenominator>25000000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom5 "<MaxScaleDenominator>25000000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom5 "<MinScaleDenominator>12500000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom6 "<MaxScaleDenominator>12500000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom6 "<MinScaleDenominator>6500000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom7 "<MaxScaleDenominator>6500000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom7 "<MinScaleDenominator>3000000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom8 "<MaxScaleDenominator>3000000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom8 "<MinScaleDenominator>1500000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom9 "<MaxScaleDenominator>1500000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom9 "<MinScaleDenominator>750000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom10 "<MaxScaleDenominator>750000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom10 "<MinScaleDenominator>400000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom11 "<MaxScaleDenominator>400000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom11 "<MinScaleDenominator>200000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom12 "<MaxScaleDenominator>200000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom12 "<MinScaleDenominator>100000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom13 "<MaxScaleDenominator>100000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom13 "<MinScaleDenominator>50000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom14 "<MaxScaleDenominator>50000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom14 "<MinScaleDenominator>25000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom15 "<MaxScaleDenominator>25000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom15 "<MinScaleDenominator>12500</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom16 "<MaxScaleDenominator>12500</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom16 "<MinScaleDenominator>5000</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom17 "<MaxScaleDenominator>5000</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom17 "<MinScaleDenominator>2500</MinScaleDenominator>">
|
||||||
|
<!ENTITY maxscale_zoom18 "<MaxScaleDenominator>2500</MaxScaleDenominator>">
|
||||||
|
<!ENTITY minscale_zoom18 "<MinScaleDenominator>1000</MinScaleDenominator>">
|
||||||
|
|
||||||
|
<!-- FONT LEVELS (for operations and infra) -->
|
||||||
|
<!-- "level 3 - Operational, but partially damaged or partially incapacitated. -->
|
||||||
|
<!-- more info: http://www.fgdc.gov/HSWG/ref_pages/DamageOperational_ref.htm -->
|
||||||
|
|
||||||
|
<!-- http://www.fgdc.gov/HSWG/ref_pages/Operations_ref.htm -->
|
||||||
|
<!ENTITY operations1 "ERS v2 Operations Stage 01 Regular">
|
||||||
|
<!ENTITY operations2 "ERS v2 Operations Stage 02 Regular">
|
||||||
|
<!ENTITY operations3 "ERS v2 Operations Stage 03 Regular">
|
||||||
|
<!ENTITY operations4 "ERS v2 Operations Stage 04 Regular">
|
||||||
|
<!ENTITY camp "Q">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- http://www.fgdc.gov/HSWG/ref_pages/Infrastructures_ref.htm -->
|
||||||
|
<!ENTITY infra1 "ERS v2 Infrastructures Stage 01 Regular">
|
||||||
|
<!ENTITY infra2 "ERS v2 Infrastructures Stage 01 Regular">
|
||||||
|
<!ENTITY infra3 "ERS v2 Infrastructures Stage 01 Regular">
|
||||||
|
<!ENTITY infra4 "ERS v2 Infrastructures Stage 01 Regular">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ERS v2 Natural Events Regular -->
|
||||||
|
<!-- only one font severity level -->
|
||||||
|
<!ENTITY events "ERS v2 Natural Events Regular">
|
||||||
|
<!ENTITY landslide "D">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ERS v2 Incidents Regular -->
|
||||||
|
<!-- only one font severity level -->
|
||||||
|
<!ENTITY incidents "ERS v2 Incidents Regular">
|
||||||
|
<!ENTITY civil_disturbance "A">
|
||||||
|
<!ENTITY civil_displacement "C">
|
||||||
|
|
||||||
|
<!-- these are likely unneeded, just severity background but can be found in other fonts -->
|
||||||
|
<!ENTITY damage "ERS v2 Damage Regular">
|
||||||
|
|
||||||
|
]>
|
||||||
|
|
||||||
|
<Map bgcolor="white" srs="+init=epsg:4326">
|
||||||
|
|
||||||
|
<Style name="Planet_osm_line_labels">
|
||||||
|
<Rule>
|
||||||
|
<Filter>([highway] <> '')</Filter>
|
||||||
|
<TextSymbolizer name="name" face_name="DejaVu Sans Bold" size="8" fill="rgb(0,0,0)" dy="6.720000000000001" placement="line" vertical_alignment="bottom" halo_radius="1" halo_fill="rgba(255,255,255,0.298039)" allow_overlap="true"></TextSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style name="Planet_osm_line_style">
|
||||||
|
<Rule>
|
||||||
|
<Filter>([highway]='path')</Filter>
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">darkred</CssParameter>
|
||||||
|
<CssParameter name="stroke-width">1</CssParameter>
|
||||||
|
<CssParameter name="stroke-opacity">0.7647059</CssParameter>
|
||||||
|
<CssParameter name="stroke-linejoin">bevel</CssParameter>
|
||||||
|
<CssParameter name="stroke-linecap">square</CssParameter>
|
||||||
|
<CssParameter name="stroke-dasharray">1.7, 2.7</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
<Filter>([highway]='secondary')</Filter>
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">rgb(9,28,157)</CssParameter>
|
||||||
|
<CssParameter name="stroke-width">2.7</CssParameter>
|
||||||
|
<CssParameter name="stroke-opacity">0.7647059</CssParameter>
|
||||||
|
<CssParameter name="stroke-linejoin">bevel</CssParameter>
|
||||||
|
<CssParameter name="stroke-linecap">square</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
<Filter>(not [highway] <> '')</Filter>
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">black</CssParameter>
|
||||||
|
<CssParameter name="stroke-width">.5</CssParameter>
|
||||||
|
<CssParameter name="stroke-dasharray">2,.2</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
<ElseFilter />
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">rgb(177,177,177)</CssParameter>
|
||||||
|
<CssParameter name="stroke-width">.7</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style name="Planet_osm_line_primary">
|
||||||
|
<Rule>
|
||||||
|
<Filter>([highway]='primary')</Filter>
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">rgb(136,0,15)</CssParameter>
|
||||||
|
<CssParameter name="stroke-width">3.7</CssParameter>
|
||||||
|
<CssParameter name="stroke-opacity">0.7647059</CssParameter>
|
||||||
|
<CssParameter name="stroke-linejoin">bevel</CssParameter>
|
||||||
|
<CssParameter name="stroke-linecap">square</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
<Filter>([highway]='primary_link')</Filter>
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">rgb(98,44,70)</CssParameter>
|
||||||
|
<CssParameter name="stroke-width">3.2</CssParameter>
|
||||||
|
<CssParameter name="stroke-opacity">0.7647059</CssParameter>
|
||||||
|
<CssParameter name="stroke-linejoin">bevel</CssParameter>
|
||||||
|
<CssParameter name="stroke-linecap">square</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Layer name="Planet_osm_line" srs="+init=epsg:4326">
|
||||||
|
<StyleName>Planet_osm_line_style</StyleName>
|
||||||
|
<StyleName>Planet_osm_line_primary</StyleName>
|
||||||
|
<StyleName>Planet_osm_line_labels</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="dbname">haiti_ll</Parameter>
|
||||||
|
<Parameter name="estimate_extent">0</Parameter>
|
||||||
|
<Parameter name="extent">-74.5891653,17.9536341,-71.6100215,20.0196174</Parameter>
|
||||||
|
<Parameter name="geometry_field">way</Parameter>
|
||||||
|
<Parameter name="srid">4326</Parameter>
|
||||||
|
<Parameter name="table">(SELECT way,highway,name FROM "planet_osm_line" ) as "planet_osm_line"</Parameter>
|
||||||
|
<Parameter name="type">postgis</Parameter>
|
||||||
|
<Parameter name="user">postgres</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
<Style name="refugee_camps">
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom5;
|
||||||
|
&minscale_zoom9;
|
||||||
|
<TextSymbolizer size="10" name='truetype' face_name='ERS v2 Operations Stage 03 Regular' fill='#FF8300' allow_overlap='true' halo_radius='1' halo_fill='rgba(255,255,255,.1)'/>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom10;
|
||||||
|
&minscale_zoom12;
|
||||||
|
<TextSymbolizer size="30" name='truetype' face_name='ERS v2 Operations Stage 03 Regular' fill='#FF8300' allow_overlap='true' halo_radius='1' halo_fill='rgba(255,255,255,.1)' />
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom13;
|
||||||
|
&minscale_zoom14;
|
||||||
|
<TextSymbolizer size="45" name='truetype' face_name='ERS v2 Operations Stage 03 Regular' fill='#FF8300' allow_overlap='true' halo_radius='2' halo_fill='rgba(255,255,255,.1)' />
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom15;
|
||||||
|
&minscale_zoom16;
|
||||||
|
<TextSymbolizer size="55" name='truetype' face_name='ERS v2 Operations Stage 03 Regular' fill='#FF8300' allow_overlap='true' halo_radius='3' halo_fill='rgba(255,255,255,.1)' />
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom17;
|
||||||
|
<TextSymbolizer size="70" name='truetype' face_name='ERS v2 Operations Stage 03 Regular' fill='#FF8300' allow_overlap='true' halo_radius='3' halo_fill='rgba(255,255,255,.1)' />
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
|
<Style name="landslide">
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom5;
|
||||||
|
&minscale_zoom9;
|
||||||
|
<TextSymbolizer name="truetype" face_name="&events;" size="10" fill="black" allow_overlap="true" halo_radius="3" halo_fill="rgba(255,255,255,.1)"></TextSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom10;
|
||||||
|
&minscale_zoom12;
|
||||||
|
<TextSymbolizer name="truetype" face_name="&events;" size="20" fill="black" allow_overlap="true" halo_radius="3" halo_fill="rgba(255,255,255,.1)"></TextSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom13;
|
||||||
|
&minscale_zoom14;
|
||||||
|
<TextSymbolizer name="truetype" face_name="&events;" size="35" fill="black" allow_overlap="true" halo_radius="3" halo_fill="rgba(255,255,255,.1)"></TextSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom15;
|
||||||
|
&minscale_zoom16;
|
||||||
|
<TextSymbolizer name="truetype" face_name="&events;" size="45" fill="black" allow_overlap="true" halo_radius="3" halo_fill="rgba(255,255,255,.1)"></TextSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
&maxscale_zoom17;
|
||||||
|
<TextSymbolizer name="truetype" face_name="&events;" size="65" fill="black" allow_overlap="true" halo_radius="3" halo_fill="rgba(255,255,255,.1)"></TextSymbolizer>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Layer name="refugee_camps" status="on" srs="+init=epsg:4326" clear_label_cache="true">
|
||||||
|
<StyleName>refugee_camps</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="dbname">haiti_ll</Parameter>
|
||||||
|
<Parameter name="estimate_extent">true</Parameter>
|
||||||
|
<Parameter name="host"></Parameter>
|
||||||
|
<Parameter name="user">postgres</Parameter>
|
||||||
|
<Parameter name="password"></Parameter>
|
||||||
|
<Parameter name="port"></Parameter>
|
||||||
|
<Parameter name="table">
|
||||||
|
(select way,'&camp;'::text as truetype from planet_osm_point
|
||||||
|
where "earthquake:damage" in ('spontaneous_camp','spontaneous_campsite')
|
||||||
|
or tourism = 'campsite'
|
||||||
|
or refugee is not null
|
||||||
|
) as labels</Parameter>
|
||||||
|
<Parameter name="type">postgis</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
<Layer name="landslide" status="on" srs="+init=epsg:4326" clear_label_cache="true">
|
||||||
|
<StyleName>landslide</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="dbname">haiti_ll</Parameter>
|
||||||
|
<Parameter name="estimate_extent">true</Parameter>
|
||||||
|
<Parameter name="host"></Parameter>
|
||||||
|
<Parameter name="user">postgres</Parameter>
|
||||||
|
<Parameter name="password"></Parameter>
|
||||||
|
<Parameter name="port"></Parameter>
|
||||||
|
<Parameter name="table">
|
||||||
|
(select way,'&landslide;'::text as truetype from planet_osm_polygon
|
||||||
|
where "earthquake:damage" = 'landslide'
|
||||||
|
) as labels</Parameter>
|
||||||
|
<Parameter name="type">postgis</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
|
78
HomeOld.md
Normal file
78
HomeOld.md
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
<!-- Name: WikiStart -->
|
||||||
|
<!-- Version: 100 -->
|
||||||
|
<!-- Last-Modified: 2011/10/11 16:21:31 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<font size="10" color="red" >The hosting for the project code and wiki has moved to <a href="https://github.com/mapnik/mapnik">https://github.com/mapnik/mapnik</a>. Please do not edit this site, but feel free to migrate things if you notice they are not on github</font>
|
||||||
|
|
||||||
|
|
||||||
|
# Welcome to the Mapnik Wiki
|
||||||
|
|
||||||
|
Mapnik is a OpenSource C++/Python toolkit for developing mapping applications. At the core is a C++ shared library providing algorithms/patterns for spatial data access and visualization.
|
||||||
|
|
||||||
|
High-level Python bindings (boost.python) facilitate rapid application development targeting Zope3, Django, and other frameworks. It can comfortably be used for both desktop and web development.
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<a href="http://teczno.com/cascadenik-openstreetmap-II/"><img style="float: right; border: 1px gray solid;" src="http://teczno.com/cascadenik-openstreetmap-II/osm-15-r12662-c5254.png" /></a>
|
||||||
|
|
||||||
|
|
||||||
|
Have fun! [[BR]]
|
||||||
|
_The Mapnik Team_
|
||||||
|
|
||||||
|
|
||||||
|
## Mapnik Starting Points
|
||||||
|
|
||||||
|
* *What is Mapnik?*
|
||||||
|
* MapnikOverview | DemoGallery | [mapnik.org](http://mapnik.org/)
|
||||||
|
* Commit Timeline at [Ohloh](https://www.ohloh.net/projects/mapnik): [[BR]] [[Image(http://www.ohloh.net/p/mapnik/analyses/latest/commits_spark.png)]]
|
||||||
|
|
||||||
|
* *Installing Mapnik*
|
||||||
|
* MapnikInstallation - Guides for installing Mapnik
|
||||||
|
* MapnikReleases - Learn about past, current, and future releases
|
||||||
|
|
||||||
|
* *Community*
|
||||||
|
* Mapnik Users: [Post Questions](http://lists.berlios.de/mailman/listinfo/mapnik-users) | [ Archive ](https://lists.berlios.de/pipermail/mapnik-users/) | [Nabble](http://www.nabble.com/Mapnik-f28006.html).
|
||||||
|
* Join [irc://irc.freenode.net/mapnik #mapnik] on irc.freenode.net for Mapnik community conversation and help.
|
||||||
|
* [//register Contribute] to this Wiki
|
||||||
|
|
||||||
|
* *Tutorials*
|
||||||
|
* See the MapnikTutorials page for a listing.
|
||||||
|
|
||||||
|
* *Learning Mapnik*
|
||||||
|
* LearningMapnik - outline of key topics
|
||||||
|
|
||||||
|
* *Troubleshooting Mapnik*
|
||||||
|
* [wiki:Troubleshooting] - tips for common gochas
|
||||||
|
* InstallationTroubleshooting - install problems and solutions
|
||||||
|
|
||||||
|
* *Mapnik Utilities*
|
||||||
|
* MapnikUtilities lists great tools for using with Mapnik
|
||||||
|
* StyleShare - share and find style ideas
|
||||||
|
|
||||||
|
## Developers Corner
|
||||||
|
|
||||||
|
* *Code Sprints*
|
||||||
|
* See [MapnikCodeSprint Sprint Schedules]
|
||||||
|
|
||||||
|
* *Google Summer of Code*
|
||||||
|
* 2011: [wiki:GSOC2011]
|
||||||
|
* 2010: [wiki:GSOC2010]
|
||||||
|
|
||||||
|
* *Development Ideas and Topics*
|
||||||
|
* DeveloperTopics is a sandbox for discussing Mapnik development
|
||||||
|
|
||||||
|
* *Releases and Packaging*
|
||||||
|
* MapnikReleaseSteps - Checklist developers keep and follow for each release
|
||||||
|
* PackageBuilding - resources for learning about Mapnik packages
|
||||||
|
|
||||||
|
* *Resources for Contributing*
|
||||||
|
* [Active Un-Assigned Tickets (become an owner)](https://trac.mapnik.org/query?status=new&status=reopened&col=id&col=summary&col=status&col=type&col=priority&col=milestone&col=component&order=priority)
|
||||||
|
* Developers list: [Signup](http://lists.berlios.de/mailman/listinfo/mapnik-devel) | [Search Archives](https://lists.berlios.de/pipermail/mapnik-devel/)
|
||||||
|
* [OpenStreetMap Tickets](http://trac.openstreetmap.org/query?status=new&status=assigned&status=reopened&component=mapnik&order=id&desc=1) relating to the use of Mapnik
|
||||||
|
|
||||||
|
## About This Wiki
|
||||||
|
* This site uses Trac, see TracGettingStarted for help on usage
|
||||||
|
* For a complete list of all pages, see TitleIndex.
|
20
Ideas.md
Normal file
20
Ideas.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<!-- Name: Ideas -->
|
||||||
|
<!-- Version: 2 -->
|
||||||
|
<!-- Last-Modified: 2010/06/10 14:56:40 -->
|
||||||
|
<!-- Author: cmarqu -->
|
||||||
|
** icon rotation: could also be used for amenity=viewpoint when tagged with viewing angles
|
||||||
|
* SVG icons: allow replacing colors (e.g. color a black icon in blue); have an alpha parameter
|
||||||
|
|
||||||
|
|
||||||
|
* move icon a bit if it would collide with others
|
||||||
|
* replace an already placed icon with a collection icon when there is another one to be shown right there
|
||||||
|
* push lines apart so that there is a minimum distance between them
|
||||||
|
* be able to construct file names from tag values in XML (e.g. "symbol_file=parking.svg" should be mapped to e.g. ~/mapnik/parking.svg or http://example.com/parking.svg). Right now, people resort to generating XML styles by a script.
|
||||||
|
* (might need sanitizing/sandboxing to prevent malicious icons in the URL case)
|
||||||
|
* when there is a very curvy road, place the name along a smoothed line (when the text is not centered to the line but with a dy)
|
||||||
|
* multi-line text constructed from several tags, e.g. for peak name and height (can be done when you accept the same styling for these text fragments)
|
||||||
|
* stronger coupling between icon and text (maybe similar to the ShieldSymbolizer?) so that manual text dy tweaking is not required anymore (want to be able to say: "place this icon in size 20x20 and put the text in size 12pt five pixels below it")
|
||||||
|
* collapsing of little small areas with the same tags into a single big one (for e.g. a big forest), so that e.g. the name is drawn only once
|
||||||
|
* be able to suppress automatic text rotation (per style or layer) - contour lines should always be displayed so that the base line of the text points to the lower ground
|
||||||
|
* underlined text (for e.g. capitals)
|
||||||
|
* sometimes, peak names drawn in a half circle, would be cool if Mapnik could do that as well
|
66
Ideas_Compositing.md
Normal file
66
Ideas_Compositing.md
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<!-- Name: Ideas/Compositing -->
|
||||||
|
<!-- Version: 5 -->
|
||||||
|
<!-- Last-Modified: 2010/09/26 04:44:22 -->
|
||||||
|
<!-- Author: ivansanchez -->
|
||||||
|
# Compositing
|
||||||
|
|
||||||
|
[TopOSM](http://wiki.openstreetmap.org/wiki/TopOSM/Details) is pretty inspirational. How about an XML dialect for specifying the composition of multiple Mapnik-rendered layers into a single map. This example is based on [TopOSM's compositing steps](http://wiki.openstreetmap.org/wiki/TopOSM/Details#Combining_images_into_a_final_composite), which also incorporate `gdalwarp`-generated hill shadings. (These could be integrated using a [RasterSymbolizer](http://trac.mapnik.org/wiki/RasterSymbolizer), or a thin wrapper could be generated at runtime.)
|
||||||
|
|
||||||
|
* Note: see also artem's test images (generated with AGG): http://trac.mapnik.org/wiki/Compositing
|
||||||
|
* Note: see also the GSOC page on related ideas: http://trac.mapnik.org/wiki/GSOC2010/Ideas?version=17#LayerComposites
|
||||||
|
* Note: Research possibility of use RPN (reverse polish notation) for specifying the rendering and compositing order. It would be hard to understand complex compositing schemes, but easy to implement
|
||||||
|
* Note: Research multithreaded/multiprocess rendering and compositing of layers. In a nutshell, rendering of two different layers to be composed could be handled by different threads, all compositing should be multithreaded. Research and benchmark if it makes sense performance-wise.
|
||||||
|
|
||||||
|
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<Composite srs="...">
|
||||||
|
|
||||||
|
<!-- first, render the areas -->
|
||||||
|
<Map href="areas.xml"/>
|
||||||
|
|
||||||
|
<!-- next, composite hillshading twice: -->
|
||||||
|
|
||||||
|
<!-- first, darkened and using the screen blend mode -->
|
||||||
|
<Map type="raster" href="hillshade.tiff" blend="screen">
|
||||||
|
<Transform type="level">70,90%,0.8</Transform>
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
<!-- then, lightened and using the multiply blend mode -->
|
||||||
|
<Map type="raster" href="hillshade.tiff" blend="multiply">
|
||||||
|
<Transform type="level">0,80%,1.0</Transform>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
<!-- (at this point, we should have a hill shaded area map) -->
|
||||||
|
|
||||||
|
<!-- next up, the features -->
|
||||||
|
<Group id="features">
|
||||||
|
<!-- render the mapnik layer first -->
|
||||||
|
<Map href="features.xml"/>
|
||||||
|
<!-- then replace the alpha channel of the resulting buffer with that of
|
||||||
|
the rendered labels: -->
|
||||||
|
<Channel src="A" dst="A">
|
||||||
|
<!-- render the labels into the buffer then blur, invert, and level -->
|
||||||
|
<Map href="labels.xml">
|
||||||
|
<Filter type="blur">0,2.0</Filter>
|
||||||
|
<Transform type="invert"/>
|
||||||
|
<Transform type="level">5,8%</Transform>
|
||||||
|
</Map>
|
||||||
|
</Channel>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<!-- finally, composite the non-shaded areas and labels -->
|
||||||
|
|
||||||
|
<Map href="noshade-fills.xml"/>
|
||||||
|
<Map href="labels.xml"/>
|
||||||
|
|
||||||
|
</Composite>
|
||||||
|
|
||||||
|
The idea here is that the composition starts with an empty buffer and draws layers into it recursively, in the order that they appear in the XML. The `areas.xml` Mapnik stylesheet is rendered directly into the buffer, then the hill shading is applied twice: first darkened and composited using the "screen" blend mode; then lightened and composited using the "multiply" blend mode. The "features" group creates a new temporary buffer, into which the `features.xml` Mapnik stylesheet is rendered, then has its alpha channel ("A") replaced by that of the rendered `labels.xml` stylesheet (which, before being applied, is blurred, inverted, and leveled). The "areas" buffer is then composited onto the hill-shaded area map, followed by straight-up alpha composited `noshade-fill.xml` and `labels.xml` Mapnik styles.
|
||||||
|
|
||||||
|
Basically, each XML results in an image operation:
|
||||||
|
|
||||||
|
* `<Group>` and `<Layer>` operations create new rendering contexts, the results of which are composited onto the buffer of the parent context (optionally specifying a blend mode).
|
||||||
|
* `<Transform>` and `<Filter>` operations modify the buffer of the parent rendering context. The blur filter and color transforms in this example use [ImageMagick](http://www.imagemagick.org/script/command-line-options.php) semantics, but they could be expressed otherwise.
|
||||||
|
* `<Channel>` operations render their child layers or groups into a temporary buffer, one or more channels of which are then applied to the parent context (optionally specifying a bitwise operator?).
|
||||||
|
|
||||||
|
Recursively rendered Mapnik stylesheets should inherit their SRS from the `<Composite>` element, if provided.
|
209
Ideas_FutureMapnik.md
Normal file
209
Ideas_FutureMapnik.md
Normal file
|
@ -0,0 +1,209 @@
|
||||||
|
<!-- Name: Ideas/FutureMapnik -->
|
||||||
|
<!-- Version: 6 -->
|
||||||
|
<!-- Last-Modified: 2011/04/28 09:45:52 -->
|
||||||
|
<!-- Author: manelclos -->
|
||||||
|
# Future Features of Mapnik
|
||||||
|
|
||||||
|
== WhereCamp Session: April 4th, 2010 (Google Campus) ==
|
||||||
|
|
||||||
|
|
||||||
|
#!text/x-rst
|
||||||
|
|
||||||
|
Attending:
|
||||||
|
|
||||||
|
* Nino Walker & Tim Caro-Bruce (Urban Mapping | http://urbanmapping.com/)
|
||||||
|
* Peter Keum (King County GIS)
|
||||||
|
* Andrew Turner (GeoCommons | http://highearthorbit.com/)
|
||||||
|
* Jeff Johnson (http://twitter.com/ortelius)
|
||||||
|
* Dane Springmeyer (http://twitter.com/springmeyer | http://dbsgeo.com)
|
||||||
|
* Rich Gibson (MappingHacks/Gigapan)
|
||||||
|
* Dan Lyke (flutterby.com)
|
||||||
|
* Brett Camper (Kickstarter | http://kickstarter.com) (formerly http://patch.com/)
|
||||||
|
* Sylvain Carlyle (http://twitter.com/afrognthevalley)
|
||||||
|
* Dan Dye (WeoGeo | http://weogeo.com)
|
||||||
|
* Barbara Hui (UCLA | http://twitter.com/barbarahui)
|
||||||
|
* Marc Pfister (http://www.drwelby.net)
|
||||||
|
* Embeddedlinuxguy
|
||||||
|
* Sobelito
|
||||||
|
* Svogel186
|
||||||
|
* add yourself if I missed you!
|
||||||
|
|
||||||
|
We met for about an hour to discuss some dream features we'd like to see in Mapnik in the year(s) to come, who's using Mapnik currently and for what, and some specific third-party tools that exist or should exist in the future for working with Mapnik.
|
||||||
|
|
||||||
|
Dane Springmeyer took notes. Please add to them if he missed anything!
|
||||||
|
|
||||||
|
A couple key users of Mapnik
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
GeoCommons:
|
||||||
|
* Using Mapnik for PNG output
|
||||||
|
* Pushing Mapnik output into GeoPDF
|
||||||
|
* Currently running on SVG symbol support patch written by Koordinates (Robert Coup/Craig Destigter)
|
||||||
|
|
||||||
|
- This is an issue that needs resolution (http://trac.mapnik.org/ticket/320)
|
||||||
|
- Need to consult with Artem about possibility of using AGG SVG parser in addition to librsvg+cairo
|
||||||
|
|
||||||
|
* Actively needing C++ based WMS server
|
||||||
|
* Have written python and ruby apps around Mapnik (see 'Lithograph' below)
|
||||||
|
|
||||||
|
Urban Mapping:
|
||||||
|
* Visualization, query, and thematic maps api around Mapnik using Django (http://MapFluence.com)
|
||||||
|
* Have done thinking around EC2 and OSM Elastic Block for Mapnik/OSM deployments
|
||||||
|
* Confirmed interest in further coordinating with DevSeed and Stamen on amazon deployment wrappers
|
||||||
|
* Have written a django dashboard to tile rendering / cache wiping / style preview as a r&d project
|
||||||
|
|
||||||
|
|
||||||
|
Core Features of Future
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
|
||||||
|
Compositing/grouping of layers
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
* WMS services need ability to flexibly group and combine layers both in rendered map and GetCaps
|
||||||
|
* Stamen has ideas around compositing/blend modes in mapnik.Image
|
||||||
|
|
||||||
|
- http://trac.mapnik.org/wiki/Ideas/Compositing
|
||||||
|
- http://trac.mapnik.org/wiki/GSOC2010/Ideas#LayerComposites
|
||||||
|
- essentially bring TopOSM like functionality into core, expose easily in stylesheets
|
||||||
|
- Or expose just essentials to be able to render compositions with extra python wrapper
|
||||||
|
|
||||||
|
* UrbanMapping may have some code that does some of this already (outside Mapnik) and can possibly share
|
||||||
|
|
||||||
|
|
||||||
|
Geometry intelligent Symbolization
|
||||||
|
----------------------------------
|
||||||
|
* More control needed to restrict certain application of symbolizer to features with given geometry type
|
||||||
|
|
||||||
|
- e.g. add setting to be able to prevent PointSymbolizer from being applied to polygon features
|
||||||
|
|
||||||
|
* GeoCommons usage has run into issue. Easy to work around, but would be nice to make easier to control
|
||||||
|
|
||||||
|
|
||||||
|
Better Label Placement
|
||||||
|
----------------------
|
||||||
|
* Must have ability to have point labels shifted (by certain tolerance) for denser or better looking placement
|
||||||
|
* Must add ability to try various placement directives, e.g. in cardinal directions (Jeff Johnson)
|
||||||
|
|
||||||
|
- Patch for this from kosmosnimki - needs someone to step up to clean up/refactor (or potentially fund further work)
|
||||||
|
- http://trac.mapnik.org/ticket/463
|
||||||
|
|
||||||
|
|
||||||
|
Ruby Bindings
|
||||||
|
-------------
|
||||||
|
* GeoCommons would love to have Ruby Bindings
|
||||||
|
* Dane: We need to know from Ruby experts the best way to wrap C++ libs these days.
|
||||||
|
* e.g. Since boost::ruby does not exist (although it has been discussed), what method to bind C++ is best?
|
||||||
|
* Aubrey Holland has some github code that lightly wraps, but he mostly uses Python+TileCache still at this point
|
||||||
|
|
||||||
|
- http://github.com/aub/ruby-mapnik
|
||||||
|
|
||||||
|
|
||||||
|
Not Just XML
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Support for Cascadenik (CSS) natively in Mapnik
|
||||||
|
|
||||||
|
- one step could be moving Cascadenik python implementation into Mapnik trunk/releases
|
||||||
|
- next step (long term) could be moving to C++ based implementation
|
||||||
|
|
||||||
|
* Mapnik currently uses boost property_tree to handle XML (along with Parser)
|
||||||
|
* JSON support (through boost ptree + parser) could be viable additional format - anyone interested?
|
||||||
|
|
||||||
|
|
||||||
|
Thematic Mapping
|
||||||
|
----------------
|
||||||
|
* Expressions are needed for dynamic, data driving symbolizers
|
||||||
|
|
||||||
|
- Excellent foundation is recently in trunk
|
||||||
|
- See: http://mapnik.org/news/2009/dec/08/future_mapnik2/
|
||||||
|
- Needs more feedback, testing, funding, and additional properties exposed as expressions
|
||||||
|
|
||||||
|
* Urban Mapping doing quite a bit of thematic cartography in new "MapFluence" API - need more feedback about pain points
|
||||||
|
|
||||||
|
|
||||||
|
Performance
|
||||||
|
-----------
|
||||||
|
* Mapnik is fast, but we must get faster to support web scaling
|
||||||
|
* Profiling and benchmarks are CRITICAL
|
||||||
|
* Opportunities upcoming:
|
||||||
|
|
||||||
|
- Geofabrik stylesheet performance/ best practices (will be presented at SOTM)
|
||||||
|
- Springmeyer entering Mapnik in FOSS4G WMS shootout - goal to identify bottlenecks
|
||||||
|
|
||||||
|
* Jeff Johnson (opensgi.com)can offer data scenarios for profiling massive tile deployment situations
|
||||||
|
|
||||||
|
|
||||||
|
Next Generation Datasources
|
||||||
|
---------------------------
|
||||||
|
* Supporting non-relational datastores
|
||||||
|
|
||||||
|
- Cassandra, mongodb, hbase?
|
||||||
|
|
||||||
|
* Fuller MemoryDatasource support for Lines and Polygons (currently Mapnik only supports in memory points)
|
||||||
|
|
||||||
|
- WKT, WKB, GeoJSON reader exposed in Python
|
||||||
|
|
||||||
|
* Implement pluggable python-based datasources (using boost::python)
|
||||||
|
* Nino: Look into creating in-memory SQLite db using pysqlite then passing handle (not file) to Mapnik within python
|
||||||
|
|
||||||
|
|
||||||
|
Tools
|
||||||
|
-----
|
||||||
|
|
||||||
|
Fast C++ WMS server
|
||||||
|
-------------------
|
||||||
|
* To support highly scalable, fast access to GeoCommons data as WMS
|
||||||
|
* Many more users/orgs need this! Will broaden Mapnik community
|
||||||
|
* Ideally could be used/prototyped by September 2010 FOSS4G "WMS shootout"
|
||||||
|
* Multi-threaded/process server is key
|
||||||
|
* Should build on best practices and lessons from mod_tile (separate request handling + rendering daemon)
|
||||||
|
* Support GetMap, GetCapabilities, GetFeatureinfo, GetLegendGraphic
|
||||||
|
* Python reference server available as a comparison - https://github.com/mapnik/OGCServer
|
||||||
|
|
||||||
|
- Problem with Python server is that it is unmaintained currently and while Dane is developing it a bit he does not have much time to dedicate. Untested assumption that speed it critical so python will be to slow...
|
||||||
|
|
||||||
|
|
||||||
|
Single File Map (SFM)
|
||||||
|
---------------------
|
||||||
|
* A self contained Map package - term coined by Andrew/Jeff
|
||||||
|
|
||||||
|
- Dane has referred to this idea as "render bundle" in the past.
|
||||||
|
- DevSeed has been brainstorming on same issues of how to package.
|
||||||
|
|
||||||
|
* Could allow shippable GeoCommons map, e.g. download and open/browse in QGIS offline.
|
||||||
|
* To address need of fully portable, self contained data + styles + extra display logic
|
||||||
|
* Prototype will target Mapnik XML/Cascadenik MML + sqlite datasources + zip archive
|
||||||
|
|
||||||
|
- Supporting varied datasources is the hard part so starting with SQLite would be best (look into pushing rasters in Rasterlite)
|
||||||
|
|
||||||
|
* Need to start thinking through tools that can read, unpack, and pass this bundled format to render with Mapnik
|
||||||
|
|
||||||
|
- Could be many various apps that just "understand" this packaged format for direct reading:
|
||||||
|
- e.g. Quantumnik, WMS servers, mod_tiles, etc...
|
||||||
|
|
||||||
|
|
||||||
|
Lithograph
|
||||||
|
----------
|
||||||
|
* Python wrapper around Mapnik that GeoCommons will share
|
||||||
|
* Has features that push forward ideas around SFM
|
||||||
|
|
||||||
|
- particularly the issue of moving data into SQLite
|
||||||
|
- and the writing of MML styles from other formats
|
||||||
|
|
||||||
|
|
||||||
|
MapShift Library
|
||||||
|
----------------
|
||||||
|
* Python library Dane Springmeyer is scoping to handle bundling existing datasources, symbols, other files that make up map
|
||||||
|
* Perhaps could merge with Lithograph if sources were open.
|
||||||
|
* Planning to write in python and depend on OGR/GDAL python bindings (for projection/reprojection support)
|
||||||
|
* Will have (in Phase II) support for validation and mapfile evaluation for performance.
|
||||||
|
|
||||||
|
|
||||||
|
Quantumnik Future
|
||||||
|
-----------------
|
||||||
|
* Currently can export out Mapnik XML and set all paths to be relative to deployed location
|
||||||
|
* Lots more possible just within this tool to make stylesheets more portable.
|
||||||
|
* Will be first stop to test out ideas around SFM and MapShift implementation.
|
||||||
|
* Development lately has been driven mostly by trying to map subtle QGIS styling to Mapnik styling and adding support for new datasources
|
||||||
|
* Future development will focus on original goals: ability to quickly author Mapnik stylesheets for one-click tile seeding and map packaging
|
5
InstallGuide.md
Normal file
5
InstallGuide.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!-- Name: InstallGuide -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2009/04/01 12:41:07 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[ReST(/tags/release-0.6.0/INSTALL)]]
|
403
InstallationTroubleshooting.md
Normal file
403
InstallationTroubleshooting.md
Normal file
|
@ -0,0 +1,403 @@
|
||||||
|
<!-- Name: InstallationTroubleshooting -->
|
||||||
|
<!-- Version: 43 -->
|
||||||
|
<!-- Last-Modified: 2011/09/10 10:51:41 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# Installation Troubleshooting
|
||||||
|
|
||||||
|
*See also: UsingScons* for help on how to properly use SCons to find your dependencies.
|
||||||
|
|
||||||
|
## Build Errors
|
||||||
|
|
||||||
|
### boost: object_base_initializer was not declared in this scope
|
||||||
|
|
||||||
|
* *Description*: You get a compile error related to boost iostreams when building mapnik's shapefile or ogr plugin.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
g++ -o plugins/input/shape/shape.os -c -DHAVE_LIBXML2 -DHAVE_PYCAIRO - ansi -Wall -pthread -ftemplate-depth-100 -DLINUX - DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE -DSVN_REVISION=1418 -O0 - fno-inline -g -DDEBUG -DMAPNIK_DEBUG -DSHAPE_MEMORY_MAPPED_FILE -fPIC - Iagg/include -Iinclude -I. -I/usr/include -I/usr/local/include -I/usr/ include/freetype2 -I/usr/include/libxml2 -I/usr/include/pycairo -I/usr/ include/cairo -I/usr/include/libpng12 plugins/input/shape/shape.cpp /usr/local/include/boost/iostreams/device/mapped_file.hpp:43: error: redefinition of class boost::iostreams::mapped_file_base /usr/local/include/boost/iostreams/device/mapped_file.hpp:43: error: previous definition of âclass boost::iostreams::mapped_file_base
|
||||||
|
* *Solution*: Upgrade boost as this is a bug in boost 1.41. Or patch a single header like:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
cat << EOF > iostream.patch
|
||||||
|
--- boost/iostreams/device/mapped_file.hpp 2009-11-22 11:32:31.000000000 -0800
|
||||||
|
+++ boost/iostreams/device/mapped_file.hpp 2009-11-22 11:24:25.000000000 -0800
|
||||||
|
@@ -4,6 +4,9 @@
|
||||||
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
|
||||||
|
|
||||||
|
+#ifndef BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
|
||||||
|
+#define BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
|
||||||
|
+
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
@@ -591,3 +594,5 @@
|
||||||
|
} } // End namespaces iostreams, boost.
|
||||||
|
|
||||||
|
#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||||
|
+
|
||||||
|
+#endif // #ifndef BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
|
||||||
|
EOF
|
||||||
|
patch -p0 < iostream.patch
|
||||||
|
|
||||||
|
### boost: object_base_initializer was not declared in this scope
|
||||||
|
|
||||||
|
* *Description*: You get a compile error related to boost when building mapnik.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
/usr/local/include/boost/python/numeric.hpp:121: instantiated from ‘void boost::python::numeric::array::resize(const Sequence&) [with Sequence = boost::python::tuple]’ /usr/local/include/boost/preprocessor/iteration/detail/local.hpp: 37: instantiated from here /usr/local/include/boost/python/object_core.hpp:330: error: ‘object_base_initializer’ was not declared in this scope
|
||||||
|
scons: *** [bindings/python/mapnik_shield_symbolizer.os] Error 1
|
||||||
|
scons: building terminated because of errors.
|
||||||
|
* *Solution*: You need to re-compile boost_python, correctly. Likely what is happening is that you have multiple python versions on your system, and when you built boost, the boost_python library compiled against a different set of headers than it linked against. Basically, `bjam`, the tool used to build boost, is not very smart about linking to python versions, and needs extra help. At the least you MUST pass the python version to `bjam` like:
|
||||||
|
|
||||||
|
|
||||||
|
bjam --with-python python=2.6 [...snip...]
|
||||||
|
* And sometimes even that does not work. *HINT:* pass the `-d2` flag to see all the compile commands sent to `gcc` by `bjam` and you will likely see something like `-I/usr/include/python24` in the compile arguments when it should be `-I/usr/include/python26` (or some older version of python headers). If this happens then you can craft a full config file (with all possible python info) and pass a reference to that on the bjam command line. Docs on this are here: http://www.boost.org/doc/libs/1_42_0/libs/python/doc/building.html#configuring-boost-build, and an example follows:
|
||||||
|
|
||||||
|
Create a file called 'user-config.jam' (but change the python versions to be appropriate):
|
||||||
|
|
||||||
|
import option ;
|
||||||
|
import feature ;
|
||||||
|
if ! gcc in [ feature.values <toolset> ]
|
||||||
|
{
|
||||||
|
using gcc ;
|
||||||
|
}
|
||||||
|
project : default-build <toolset>gcc ;
|
||||||
|
using python
|
||||||
|
: 2.5 # version
|
||||||
|
: /usr/bin/python2.5 # cmd-or-prefix
|
||||||
|
: /usr/include/python2.5/ # includes
|
||||||
|
: /usr/lib/python2.5/config/ # a lib actually symlink
|
||||||
|
: <toolset>gcc # condition
|
||||||
|
;
|
||||||
|
libraries = --with-python ;
|
||||||
|
|
||||||
|
Then, go recompile (just boost_python) and move the new library into place:
|
||||||
|
|
||||||
|
./bjam --with-python -a -j2 --ignore-site-config --user-config=user-config.jam toolset=gcc stage -d2
|
||||||
|
#install them by hand as it is faster
|
||||||
|
sudo cp stage/lib/libboost_python.so* /usr/local/lib/
|
||||||
|
|
||||||
|
### Dependency not found but once worked I know!
|
||||||
|
* *Description*: One of the mapnik dependencies was once found by Scons, then cached, and even when you set the variable correctly (ie TIFF_INCLUDES=/correct/path) Scons does not find the library/include.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
Checking for C++ library X... no (cached)
|
||||||
|
Could not find header or shared library for X, exiting!
|
||||||
|
* *Solution*: Use the Scons option `--config=force` which will force Scons to forget about the old location used and honor your new command line variable/options.
|
||||||
|
|
||||||
|
### All boost libs are found except for boost_thread
|
||||||
|
* *Description*: SCons apparently fails to find all boost libs except for boost_thread (or the last main C++ dependency checked) during the configure stage.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
Checking for C++ library boost_program_options-mt... yes
|
||||||
|
Checking for C++ library boost_thread-mt... no
|
||||||
|
Could not find required header or shared library for boost thread
|
||||||
|
* *Solution*: Likely do to hitting ctrl-c or otherwise aborting the configure stage, SCons internal `.sconf_temp/` have been messed up. Delete them and rebuild:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
rm -fR .sconf_temp
|
||||||
|
|
||||||
|
### Boost/ICU linking error when linking libmapnik
|
||||||
|
* *Description*: undefined symbols in boost_regex when linking Mapnik
|
||||||
|
|
||||||
|
Undefined symbols:
|
||||||
|
"boost::re_detail::icu_regex_traits_implementation::do_transform(int const*, int const*, icu::Collator const*) const", referenced from:
|
||||||
|
unsigned short const* boost::re_detail::re_is_set_member<unsigned short const*, int, boost::icu_regex_traits, unsigned long long>(unsigned short const*, unsigned short const*, boost::re_detail::re_set_long<unsigned long long> const*, boost::re_detail::regex_data<int, boost::icu_regex_traits> const&, bool)in agg_renderer.os
|
||||||
|
unsigned short const* boost::re_detail::re_is_set_member<unsigned short const*, int, boost::icu_regex_traits, unsigned long long>(unsigned short const*, unsigned short const*, boost::re_detail::re_set_long<unsigned long long> const*, boost::re_detail::regex_data<int, boost::icu_regex_traits> const&, bool)in agg_renderer.os
|
||||||
|
* *Solution*: Likely, your boost library was built without regex+icu support. If you have built libboost from source, you can make your system's relevant .so files be recompiled with that support and reinstalled in place in the /lib/ folders. Go to libboost's source folder and run the following command (which you can find on [latest release install details](http://trac.mapnik.org/wiki/Mapnik2#fromlatestrelease|Mapnik2's)):
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
sudo ./bjam --with-regex toolset=gcc -sHAVE_ICU=1 -sICU_PATH=/usr/local/ -a install
|
||||||
|
Note the -a setting which makes your system's installed regex symbols to be updated in place.
|
||||||
|
|
||||||
|
### Mapnik build error due to outdated ICU
|
||||||
|
* *Description*: Mapnik build fails with errors mentioning "icu" and Unicode stuff.
|
||||||
|
|
||||||
|
src/expression_string.cpp: In member function "void mapnik::expression_string::operator()(const mapnik::regex_match_node&) const":
|
||||||
|
src/expression_string.cpp:79: error: "fromUTF32" is not a member of "icu_3_8::UnicodeString"
|
||||||
|
* *Solution*: The above errors tells basically that function UnicodeString::fromUTF32(...) used in Mapnik code isn't provided by your current ICU installation (above is 3.8). You need at least 4.1.4 (see #482 for more details). Likely, you are compiling Mapnik from svn or a more recent version than the 7.0 branch with your distribution's (above was Ubuntu 8.04) outdated ICU package (version<4.1.4). Remove update your ICU package or both remove your distribution's ICU package (eg. sudo apt-get remove libicu*) and compile and install ICU from source (from [http://icu-project.org/download/]).
|
||||||
|
|
||||||
|
### ICU not found
|
||||||
|
|
||||||
|
$ python
|
||||||
|
$ import mapnik
|
||||||
|
from _mapnik import *
|
||||||
|
ImportError: libicudata.so.38: cannot open shared object file: No such file or directory
|
||||||
|
* *Solution*: Mapnik's source code and libraries depend on Boost library (libboost*) which in turn -for the libboost regex library- depends on ICU library (libicu*). If you have compiled both libboost and libicu from source (eg. you wanted to build the bleeding edge Mapnik's svn/trunk) ; you likely did not remove your system's libicu* packages, build libboost first against those old ICU install libraries, then erased the latter libraries to install the ICU source newer libraries, which made libboost still linked to old libraries. In short, you should : a) build libUCI to update your system's installed version, b) build libboost that links to the new libUCIs.
|
||||||
|
* *Solution*: This may simply occur because your mapnik library was compiled for a different ICU version than your currently installed ICU library. For example, your Mapnik was compiled and linked against libicu 3.8 while you have later on compiled and installed libicu v4.x. You should 1) check that libicu is installed and same version as the error (find -name "*libicu*.so*" /usr/ ). 2) If the error's mentioned ICU version and the find installed ICU version do not differ, try running "$ ldconfig" as a superuser ; restart python and see if the python import command works now. 3) If ICU versions did differ (error message <> installed version), you have install a newer/older Mapnik or ICU libraries so that Mapnik's ICU requirements and your install library match. Typically, if you compiled and installed Mapnik from SVN/trunk and libicu was installed with your package manager, remove the latter package first (eg. apt-get remove libicu* on Debian/Ubuntu) and compile+install libicu from source (take newest ICU4C or SVN : [http://site.icu-project.org/download]).
|
||||||
|
|
||||||
|
* *Description*: International Components for Unicode libs are installed but Scons says they could not be found.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
Checking for C++ library icuuc... no
|
||||||
|
Could not find header or shared library for icuuc, exiting!
|
||||||
|
* *Solution*: This is the first C++ program that Scons 'finds' by actually compiling a sample program that links to it. *A g++ compiler* is therefore _required_ for this step. On linux do `apt-get install g++` and on Mac os make sure you've installed XCode from the apple dev site.
|
||||||
|
|
||||||
|
* *Solution*: If g++ is available then ICU must be in a custom location so set the paths to the libs and includes - ie. ICU_LIBS=/usr/local/lib and ICU_INCLUDES=/usr/local/include.
|
||||||
|
|
||||||
|
### Boost not found during SCons build
|
||||||
|
|
||||||
|
* *Description*: Often the various packages that install the Boost libraries do not properly symlink to the .so such that mapnik's Scons build process does not automatically find the boost libraries.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
Checking for C++ library boost_filesystem-mt... no
|
||||||
|
Could not find header or shared library for boost_filesystem-mt, exiting!
|
||||||
|
|
||||||
|
* *Solution Option 1*: Locate your libboost*.so files - usually located in /usr/lib, and find their naming scheme, then match it with the BOOST_TOOLKIT and BOOST_VERSION variables:
|
||||||
|
|
||||||
|
$ ls /usr/lib/libboost_* -la
|
||||||
|
lrwxrwxrwx 1 root root 40 2008-02-01 22:46 /usr/lib/libboost_filesystem-gcc-1_33_1.so -> libboost_filesystem-gcc-1_33_1.so.1.33.1
|
||||||
|
-rw-r--r-- 1 root root 70152 2008-01-17 04:35 /usr/lib/libboost_filesystem-gcc-1_33_1.so.1.33.1
|
||||||
|
lrwxrwxrwx 1 root root 43 2008-02-01 22:46 /usr/lib/libboost_filesystem-gcc-mt-1_33_1.so -> libboost_filesystem-gcc-mt-1_33_1.so.1.33.1
|
||||||
|
-rw-r--r-- 1 root root 70248 2008-01-17 04:35 /usr/lib/libboost_filesystem-gcc-mt-1_33_1.so.1.33.1
|
||||||
|
lrwxrwxrwx 1 root root 36 2008-02-01 22:46 /usr/lib/libboost_filesystem.so -> libboost_filesystem-gcc-mt-1_33_1.so
|
||||||
|
|
||||||
|
# then, since 'threading' (mt) will be looked for by default you can match libboost*-gcc-mt-1_33_1.so with...
|
||||||
|
$ python scons/scons.py configure BOOST_TOOLKIT=gcc BOOST_VERSION=1_33
|
||||||
|
|
||||||
|
* *Solution Option 2*: Locate your libboost* files - usually located in /usr/lib and manually create symlinks like:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
cd /usr/lib
|
||||||
|
ln -s libboost_filesystem.so libboost_filesystem-mt.so
|
||||||
|
ln -s libboost_regex.so libboost_regex-mt.so
|
||||||
|
ln -s libboost_iostreams.so libboost_iostreams-mt.so
|
||||||
|
ln -s libboost_program_options.so libboost_program_options-mt.so
|
||||||
|
ln -s libboost_thread.so libboost_thread-mt.so
|
||||||
|
ln -s libboost_python.so libboost_python-mt.so
|
||||||
|
|
||||||
|
Note : if you experience trouble installing boost on *Ubuntu 7.04* see this mapnik-devel thread: https://lists.berlios.de/pipermail/mapnik-devel/2008-August/000700.html
|
||||||
|
|
||||||
|
Note: If the SCons build process simply can't find an include or library and you are about to dive into the SConscript code to muck around, first read: [SCons can't find an include header](http://www.scons.org/faq.php#SS_4_1)
|
||||||
|
|
||||||
|
### Boost undefined symbols
|
||||||
|
|
||||||
|
* *Description*: Boost builds without problems but Mapnik will not run due to missing Boost symbols (functions)
|
||||||
|
*Related to filesystem symbols (with old libboost versions <1.35)*
|
||||||
|
|
||||||
|
#!python
|
||||||
|
Python 2.4.3 (#2, Aug 16 2008, 12:04:04)
|
||||||
|
[GCC 4.1.1 20060724 (prerelease) (4.1.1-4pclos2007)] on linux2
|
||||||
|
Type "help", "copyright", "credits" or "license" for more information.
|
||||||
|
>>> import mapnik
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<stdin>", line 1, in ?
|
||||||
|
File "/usr/lib/python2.4/site-packages/mapnik/__init__.py", line 31, in ?
|
||||||
|
from _mapnik import *
|
||||||
|
ImportError: /usr/local/lib/libmapnik.so.0.5: undefined symbol: _ZN5boost10filesystem6detail15not_found_errorE
|
||||||
|
>>
|
||||||
|
* *Solution*: This problem is old and likely fixed now whatever libboost source or recent package you'd take. According to [page](http://lists.boost.org/Archives/boost/2008/03/134329.php|this), the problem was fixed from libboost v1.35. _Rebuild boost and then mapnik. If this does not fix the problem, confirm that your Boost version is compatible with the Mapnik release version, see: BoostCompatibility._
|
||||||
|
|
||||||
|
*Related to regex symbols with ICU support*
|
||||||
|
|
||||||
|
#!python
|
||||||
|
$ python
|
||||||
|
>>> import mapnik
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<stdin>", line 1, in <module>
|
||||||
|
File "/usr/lib/python2.5/site-packages/mapnik/__init__.py", line 53, in <module>
|
||||||
|
from _mapnik import *
|
||||||
|
ImportError: /usr/local/lib/libmapnik.so.0.8: undefined symbol: _ZN5boost11basic_regexIiNS_16icu_regex_traitsEE9do_assignEPKiS4_j
|
||||||
|
* *Solution*: Likely, your boost library was built without regex+icu support. If you have built libboost from source, you can make your system's relevant .so files be recompiled with that support and reinstalled in place in the /lib/ folders. Go to libboost's source folder and run the following command (which you can find on [latest release install details](http://trac.mapnik.org/wiki/Mapnik2#fromlatestrelease|Mapnik2's)):
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
sudo ./bjam --with-regex toolset=gcc -sHAVE_ICU=1 -sICU_PATH=/usr/local/ -a install
|
||||||
|
Note the -a setting which makes your system's installed regex symbols to be updated in place.
|
||||||
|
You may need to run "sudo ldconfig" after that command, then retry "import mapnik" in python to check.
|
||||||
|
|
||||||
|
### Input/Plugin not found error
|
||||||
|
|
||||||
|
* *Description*: You rebuild Mapnik with Scons without a problem but when importing the python module you get a strange error about one of the input plugins
|
||||||
|
|
||||||
|
#!python
|
||||||
|
>>> import mapnik
|
||||||
|
dlopen(/usr/local/lib/mapnik/input/postgis.input, 9): Library not loaded: /opt/local/lib/libboost_thread-mt-1_35.dylib
|
||||||
|
Referenced from: /usr/local/lib/mapnik/input/postgis.input
|
||||||
|
Reason: image not found
|
||||||
|
# or
|
||||||
|
>>> import mapnik
|
||||||
|
dlopen(/usr/local/lib/mapnik/input/gdal.input, 9): Library not loaded: /opt/local/lib/libboost_thread-mt-1_35.dylib
|
||||||
|
Referenced from: /usr/local/lib/mapnik/input/gdal.input
|
||||||
|
Reason: image not found
|
||||||
|
* *Solution*: It is likely that Scons did not rebuild a given plugin because GDAL or PostGIS was not found. So, either rebuild with Scons again, ensuring that those optional libraries are found, or simply manually remove the *.input plugin file.
|
||||||
|
|
||||||
|
### Input/Plugin 'file not found' output
|
||||||
|
* *Description*: You rebuild Mapnik with Scons without a problem but when importing the python module you strange output about 'file not found'.
|
||||||
|
|
||||||
|
#!python
|
||||||
|
>>> import mapnik
|
||||||
|
file not found
|
||||||
|
file not found
|
||||||
|
file not found
|
||||||
|
file not found
|
||||||
|
file not found
|
||||||
|
|
||||||
|
* *Solution*: A previous installation of Mapnik was compiled with more Plugins that your latest build. Either rebuilt with INPUT_PLUGINS=all or delete the unused plugin libraries which can be found by typing:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
>>> import mapnik
|
||||||
|
>>> print mapnik.inputpluginspath
|
||||||
|
|
||||||
|
## Cairo library not found
|
||||||
|
|
||||||
|
* *Description*: Cairo plugin not found when rebuilding Mapnik with Cairo
|
||||||
|
|
||||||
|
* *Solution*: Mapnik with Cairo needs the following libraries: libcairo2 libcairo2-dev python-cairo python-cairo-dev libcairomm-1.0-1 libcairomm-1.0-dev
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Linking Errors
|
||||||
|
|
||||||
|
### The libmapnik shared library is not found
|
||||||
|
|
||||||
|
* *Description*: This is a common problem on linux encountered immediately after installing mapnik for the first time.
|
||||||
|
|
||||||
|
#!python
|
||||||
|
$ python
|
||||||
|
>>> import mapnik
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<stdin>", line 1, in <module>
|
||||||
|
File "/usr/lib/python2.5/site-packages/mapnik/__init__.py", line 31, in <module>
|
||||||
|
from _mapnik import *
|
||||||
|
ImportError: libmapnik.so.0.5: cannot open shared object file: No such file or directory
|
||||||
|
* *Solution*: Add '/usr/local/lib' to the file 'etc/ld.so.conf' then run $ldconfig, log out and back in, and the shared library should be found. If you're running the 64bit version of Ubuntu, make the path '/usr/local/lib64'. Your Linux installation may have a directory '/etc/ld.so.conf.d' with additional configuration files - if this is the case and /'etc/ld.so.conf' contains "include /etc/ld.so.conf.d/*.conf", add a new file to 'etc/ld.so.conf.d' containing "/usr/local/lib".
|
||||||
|
|
||||||
|
### Mapnik not found after building on an AMD64 or x86 64bit machine
|
||||||
|
|
||||||
|
Do the same as above but you'll just need to add an entry of '/usr/local/lib64' into one of the files inside '/etc/ld.so.conf.d/'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Install Errors
|
||||||
|
|
||||||
|
=== Permission Denied Error ===
|
||||||
|
|
||||||
|
* *Description*: Installing mapnik libs requires root priveleges
|
||||||
|
|
||||||
|
#!python
|
||||||
|
scons: Building targets ...
|
||||||
|
Install file: "src/libmapnik.so" as "/usr/local/lib/libmapnik.so.0.5.0"
|
||||||
|
scons: *** [/usr/local/lib/libmapnik.so.0.5.0] /usr/local/lib/libmapnik.so.0.5.0: Permission denied
|
||||||
|
scons: building terminated because of errors.
|
||||||
|
* *Solution*: Run:
|
||||||
|
|
||||||
|
sudo python scons/scons.py install
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Python Errors
|
||||||
|
|
||||||
|
### Python TypeError
|
||||||
|
|
||||||
|
* *Description*: In rare circumstances on Mac OS X the Mapnik python bindings are directly linked against a different version of Python then they were compiled against and you will see an error like:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
TypeError: __init__() should return None, not 'NoneType'
|
||||||
|
* *Solution*: In general you must rebuild Mapnik to link against the same version of Python as you are running. On Mac OS X recent versions of Mapnik >= 0.7 should prevent this from happening, but just in case you can manually use the `FRAMEWORK_SEARCH_PATH` option to point SCons (see UsingScons) at the directory where the desired 'Python.framework' exists.
|
||||||
|
|
||||||
|
|
||||||
|
### Python Version Mismatch
|
||||||
|
|
||||||
|
* *Description*: A `Python Mismatch` can occur when the version of boost_python you installed is linked to a different version of Python that you are running and that Mapnik has linked to. This is most frequently seen when building boost with Macports, since Macports installs its own duplicate version of Python. See: http://trac.macports.org/ticket/17975
|
||||||
|
|
||||||
|
* Since the Mapnik python bindings use boost python, both boost python (when it is compiled), and mapnik python must be linked against the same version of Python.
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
$ python
|
||||||
|
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
|
||||||
|
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
|
||||||
|
Type "help", "copyright", "credits" or "license" for more information.
|
||||||
|
>>> import mapnik
|
||||||
|
Fatal Python error: Interpreter not initialized (version mismatch?)
|
||||||
|
Abort trap
|
||||||
|
* *Solution*: Usually you must rebuild boost_python so that it links against the correct version of Python, or you can use the `install_name_tool` to on-the-fly change the linking paths. In rarer cases you may need to rebuild Mapnik as well.
|
||||||
|
|
||||||
|
* The `otool` command is how you find out what is linked against what library. In the following example, Boost python and Mapnik are both linked against the Python25 Apple installed version of Python on 10.5 (which works):
|
||||||
|
|
||||||
|
$ otool -L /opt/local/lib/libboost_python-mt.dylib | grep Python
|
||||||
|
/System/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.1)
|
||||||
|
$ otool -L /Library/Python/2.5/site-packages/mapnik/_mapnik.so | grep Python
|
||||||
|
/Library/Python/2.5/site-packages/mapnik/_mapnik.so:
|
||||||
|
/System/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.1)
|
||||||
|
|
||||||
|
* In Mapnik versions >=0.7, the FRAMEWORK_SEARCH_PATH option can be used to direct mapnik to link against a specific version of python, for example to link against Python 26 installed from python.org (which is /Library/Frameworks/Python.framework) do:
|
||||||
|
|
||||||
|
$ python scons/scons.py FRAMEWORK_SEARCH_PATH=/Library/Frameworks
|
||||||
|
|
||||||
|
* Also see this discussion: MacPythonUpgradeIssues
|
||||||
|
|
||||||
|
### unknown required load command
|
||||||
|
|
||||||
|
* *Description*: You installed mapnik on osx using a binary installer. When you import the Mapnik python bindings you get a generic 'no suitable image found'.
|
||||||
|
|
||||||
|
|
||||||
|
>>> import mapnik
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<stdin>", line 1, in <module>
|
||||||
|
File "/Library/Frameworks/Mapnik.framework/Versions/Current/Python/System/2.5/site-packages/mapnik/__init__.py", line 53, in <module>
|
||||||
|
from _mapnik import *
|
||||||
|
ImportError: dlopen(/Library/Frameworks/Mapnik.framework/Versions/Current/Python/System/2.5/site-packages/mapnik/_mapnik.so, 258): Library not loaded: /Library/Frameworks/Mapnik.framework/Versions/0.7/Mapnik
|
||||||
|
Referenced from: /Library/Frameworks/Mapnik.framework/Versions/0.7/Python/System/2.5/site-packages/mapnik/_mapnik.so
|
||||||
|
Reason: no suitable image found. Did find:
|
||||||
|
/Library/Frameworks/Mapnik.framework/Versions/0.7/Mapnik: unknown required load command 0x80000022
|
||||||
|
/Library/Frameworks/Mapnik.framework/Versions/0.7/Mapnik: unknown required load command 0x80000022
|
||||||
|
/usr/local/lib/Mapnik: not a file
|
||||||
|
|
||||||
|
* *Solution*: The key error is "unknown required load command" which indicates that you are likely trying to run libraries compiled for a different MAC OS X version. Go back and make sure you installed the correct Installer for your OS X version.
|
||||||
|
|
||||||
|
|
||||||
|
## Runtime Errors
|
||||||
|
|
||||||
|
### Boost assertion error in visitation: "Assertion false failed"
|
||||||
|
|
||||||
|
* *Description*: When trying to run a program written in C/C++ that has been compiled against mapnik, boost throws an assertion error that looks like:
|
||||||
|
|
||||||
|
|
||||||
|
/usr/include/boost/variant/detail/visitation_impl.hpp:203: typename Visitor::result_type boost::detail::variant::visitation_impl(int, int, Visitor&, VPCV, mpl_::true_, NBF, W*, S*) [with W = mpl_::int_<20>, S = boost::detail::variant::visitation_impl_step<boost::mpl::l_iter<boost::mpl::l_end>, boost::mpl::l_iter<boost::mpl::l_end> >, Visitor = boost::detail::variant::invoke_visitor<mapnik::symbolizer_attributes>, VPCV = const void*, NBF = boost::variant<mapnik::point_symbolizer, mapnik::line_symbolizer, mapnik::line_pattern_symbolizer, mapnik::polygon_symbolizer, mapnik::polygon_pattern_symbolizer, mapnik::raster_symbolizer, mapnik::shield_symbolizer, mapnik::text_symbolizer, mapnik::building_symbolizer, mapnik::markers_symbolizer, mapnik::glyph_symbolizer>::has_fallback_type_, typename Visitor::result_type = void, mpl_::true_ = mpl_::bool_<true>]: Assertion `false' failed.
|
||||||
|
|
||||||
|
* *Solution*: This indicates a problem in compiling against mapnik headers. It might be able to be fixed simply by completely cleaning and rebuilding the C++ program that is linking to mapnik. If that does not solve it then this indicates that key compiler flags that affect how inlining are done were likely missing from the compile commands for the program that is building against mapnik headers. You should be using the `mapnik-config --cflags` output when compiling c++ programs against mapnik to ensure that key flags like these are included (but these may change between mapnik releases to check `mapnik-config`):
|
||||||
|
|
||||||
|
|
||||||
|
-ansi -Wall -ftemplate-depth-200 -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE -O3 -finline-functions -Wno-inline -DNDEBUG
|
||||||
|
|
||||||
|
### Proj_init_error
|
||||||
|
|
||||||
|
* *Description*: When trying to project a Map or Layer by setting a projection using the '+init=epsg:<code>' syntax, mapnik returns a blank graphic. If mapnik was built in debug mode (scons.py DEBUG=y) then in your terminal (or apache logs when running the OGCServer) you will see a 'proj_init_error' during the map processing stage:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
start map processing bbox=Envelope(-180,-4.428969359331489,-94.42896935933148,81.14206128133704)
|
||||||
|
proj_init_error:failed to initialize projection with:+init=epsg:4326
|
||||||
|
end map processing
|
||||||
|
* *Solution*: Reinstall your proj4 library because this means that mapnik (through proj4) can't find the proj epsg file. It could also mean that you are improperly setting the 'allowedepsgcodes' in the OGCServer conf file (which need a trailing ',' to be a formal python tuple) or that you are simply trying to initiate a custom projection that does not have a corresponding epsg code (in this case you'll need to add a record to your proj epsg file).
|
||||||
|
* *Note*: If you want to use the Google Spherical Mercator projection and initiate the projection with an epsg code add this text to your /usr/local/share/proj/epsg file:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
<900913> +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 +nadgrids=@null +no_defs +over<>
|
||||||
|
|
||||||
|
### Node 'Map' not found
|
||||||
|
|
||||||
|
* *Description*: When trying to use XML entities within an xml mapfile the load_map() function fails on a strange error:
|
||||||
|
|
||||||
|
Not a map file. Node 'Map' not found.
|
||||||
|
* *Solution*: Rebuild mapnik with support for XML entities by installing libxml2 and specifying the XMLParser as a Scons option. Libxml2 is not the default parser used by Mapnik but the only one capable of handling XML entities (see: MapnikXMLsupport)
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
python scons/scons.py install XMLPARSER=libxml2
|
||||||
|
|
||||||
|
|
||||||
|
### Expected type double but got ...
|
||||||
|
|
||||||
|
* *Description*: When loading an xml map, mapnik throws a parsing error like:
|
||||||
|
|
||||||
|
|
||||||
|
Error: Failed to parse attribute 'stroke-width'. Expected type double but got '.2' in LineSymbolizer in style 'style'
|
||||||
|
|
||||||
|
* *Solution*: Notice in the above error that '.2' is a double type. This signals that C++ thinks doubles are not doubles, which is very bad. This is certainly an ABI compatibility problem and due to some problem compiling or linking. One potential cause is that libmapnik is linked to a different version of libstd++ or libgcc than libboost was or python or some other key mapnik dependency. So, most likely you have some bad duplicate installation of gcc/g++. Look around your system and try to clean it up otherwise no amount of recompiling mapnik will help. Once you find the culprit remove it and recompile mapnik. To find what libraries and linked against what other libraries use the `ldd` tool on linux and the `otool -L` command on os x.
|
91
IntegrateWithWxPython.md
Normal file
91
IntegrateWithWxPython.md
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<!-- Name: IntegrateWithWxPython -->
|
||||||
|
<!-- Version: 5 -->
|
||||||
|
<!-- Last-Modified: 2008/12/13 22:15:55 -->
|
||||||
|
<!-- Author: victorlin -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# How to integrate mapnik with wxPython?
|
||||||
|
|
||||||
|
It is pretty easy to integrate mapnik with wxPython, here is a simple wxPython application demonstrates how to:
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
"""
|
||||||
|
This is a simple wxPython application demonstrates how to
|
||||||
|
integrate mapnik, it do nothing but draw the map from the World Poplulation XML
|
||||||
|
example:
|
||||||
|
http://trac.mapnik.org/wiki/XMLGettingStarted
|
||||||
|
|
||||||
|
Victor Lin. (bornstub@gmail.com)
|
||||||
|
Blog http://blog.ez2learn.com
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import wx
|
||||||
|
import mapnik
|
||||||
|
|
||||||
|
class Frame(wx.Frame):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
wx.Frame.__init__(self, size=(800, 500) ,*args, **kwargs)
|
||||||
|
self.Bind(wx.EVT_PAINT, self.onPaint)
|
||||||
|
|
||||||
|
self.mapfile = "population.xml"
|
||||||
|
self.width = 800
|
||||||
|
self.height = 500
|
||||||
|
self.createMap()
|
||||||
|
self.drawBmp()
|
||||||
|
|
||||||
|
def createMap(self):
|
||||||
|
"""Create mapnik object
|
||||||
|
|
||||||
|
"""
|
||||||
|
self.map = mapnik.Map(self.width, self.height)
|
||||||
|
mapnik.load_map(self.map, self.mapfile)
|
||||||
|
bbox = mapnik.Envelope(mapnik.Coord(-180.0, -75.0), mapnik.Coord(180.0, 90.0))
|
||||||
|
self.map.zoom_to_box(bbox)
|
||||||
|
|
||||||
|
def drawBmp(self):
|
||||||
|
"""Draw map to Bitmap object
|
||||||
|
|
||||||
|
"""
|
||||||
|
# create a Image32 object
|
||||||
|
image = mapnik.Image(self.width, self.height)
|
||||||
|
# render map to Image32 object
|
||||||
|
mapnik.render(self.map, image)
|
||||||
|
# load raw data from Image32 to bitmap
|
||||||
|
self.bmp = wx.BitmapFromBufferRGBA(self.width, self.height, image.tostring())
|
||||||
|
|
||||||
|
def onPaint(self, event):
|
||||||
|
dc = wx.PaintDC(self)
|
||||||
|
memoryDC = wx.MemoryDC(self.bmp)
|
||||||
|
# draw map to dc
|
||||||
|
dc.Blit(0, 0, self.width, self.height, memoryDC, 0, 0)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app = wx.App()
|
||||||
|
frame = Frame(None, title="wxPython Mapnik Demo By Victor Lin")
|
||||||
|
frame.Show()
|
||||||
|
app.MainLoop()
|
||||||
|
|
||||||
|
The key point of this program is this:
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
# create a Image32 object
|
||||||
|
image = mapnik.Image(self.width, self.height)
|
||||||
|
# render map to Image32 object
|
||||||
|
mapnik.render(self.map, image)
|
||||||
|
# load raw data from Image32 to bitmap
|
||||||
|
self.bmp = wx.BitmapFromBufferRGBA(self.width, self.height, image.tostring())
|
||||||
|
|
||||||
|
We create an Image32 object, and render map on to that image, then load raw data of image into wxPython's Bitmap object. That's it! Now you can use your memory dc to do whatever you like
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
memoryDC = wx.MemoryDC(self.bmp)
|
||||||
|
# draw map to dc
|
||||||
|
dc.Blit(0, 0, self.width, self.height, memoryDC, 0, 0)
|
||||||
|
|
||||||
|
Screenshots
|
||||||
|
|
||||||
|
[[Image(wxMapnikScreenshot.png)]]
|
71
InterMapTxt.md
Normal file
71
InterMapTxt.md
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
<!-- Name: InterMapTxt -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2006/12/11 18:32:26 -->
|
||||||
|
<!-- Author: trac -->
|
||||||
|
# InterMapTxt
|
||||||
|
|
||||||
|
## This is the place for defining InterWiki prefixes
|
||||||
|
|
||||||
|
This page was modelled after the MeatBall:InterMapTxt page.
|
||||||
|
In addition, an optional comment is allowed after the mapping.
|
||||||
|
|
||||||
|
|
||||||
|
This page is interpreted in a special way by Trac, in order to support
|
||||||
|
InterWiki links in a flexible and dynamic way.
|
||||||
|
|
||||||
|
The code block after the first line separator in this page
|
||||||
|
will be interpreted as a list of InterWiki specifications:
|
||||||
|
|
||||||
|
prefix <space> URL [<space> # comment]
|
||||||
|
|
||||||
|
By using `$1`, `$2`, etc. within the URL, it is possible to create
|
||||||
|
InterWiki links which support multiple arguments, e.g. Trac:ticket:40.
|
||||||
|
The URL itself can be optionally followed by a comment,
|
||||||
|
which will subsequently be used for decorating the links
|
||||||
|
using that prefix.
|
||||||
|
|
||||||
|
New InterWiki links can be created by adding to that list, in real time.
|
||||||
|
Note however that _deletions_ are also taken into account immediately,
|
||||||
|
so it may be better to use comments for disabling prefixes.
|
||||||
|
|
||||||
|
Also note that InterWiki prefixes are case insensitive.
|
||||||
|
|
||||||
|
|
||||||
|
## List of Active Prefixes
|
||||||
|
|
||||||
|
[[InterWiki]]
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## Prefix Definitions
|
||||||
|
|
||||||
|
|
||||||
|
PEP http://www.python.org/peps/pep-$1.html # Python Enhancement Proposal
|
||||||
|
Trac-ML http://thread.gmane.org/gmane.comp.version-control.subversion.trac.general/ # Message $1 in Trac Mailing List
|
||||||
|
trac-dev http://thread.gmane.org/gmane.comp.version-control.subversion.trac.devel/ # Message $1 in Trac Development Mailing List
|
||||||
|
|
||||||
|
Mercurial http://www.selenic.com/mercurial/wiki/index.cgi/ # the wiki for the Mercurial distributed SCM
|
||||||
|
RFC http://rfc.net/rfc$1.html # IETF's RFC $1
|
||||||
|
|
||||||
|
#
|
||||||
|
# A arbitrary pick of InterWiki prefixes...
|
||||||
|
#
|
||||||
|
Acronym http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=
|
||||||
|
C2find http://c2.com/cgi/wiki?FindPage&value=
|
||||||
|
Cache http://www.google.com/search?q=cache:
|
||||||
|
CPAN http://search.cpan.org/perldoc?
|
||||||
|
DebianBug http://bugs.debian.org/
|
||||||
|
DebianPackage http://packages.debian.org/
|
||||||
|
Dictionary http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=
|
||||||
|
Google http://www.google.com/search?q=
|
||||||
|
GoogleGroups http://groups.google.com/group/$1/msg/$2 # Message $2 in $1 Google Group
|
||||||
|
JargonFile http://downlode.org/perl/jargon-redirect.cgi?term=
|
||||||
|
MeatBall http://www.usemod.com/cgi-bin/mb.pl?
|
||||||
|
MetaWiki http://sunir.org/apps/meta.pl?
|
||||||
|
MetaWikiPedia http://meta.wikipedia.org/wiki/
|
||||||
|
MoinMoin http://moinmoin.wikiwikiweb.de/
|
||||||
|
WhoIs http://www.whois.sc/
|
||||||
|
Why http://clublet.com/c/c/why?
|
||||||
|
c2Wiki http://c2.com/cgi/wiki?
|
||||||
|
WikiPedia http://en.wikipedia.org/wiki/
|
110
InterTrac.md
Normal file
110
InterTrac.md
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
<!-- Name: InterTrac -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2006/12/11 18:32:26 -->
|
||||||
|
<!-- Author: trac -->
|
||||||
|
# InterTrac Links
|
||||||
|
|
||||||
|
Trac supports a convenient way to refer to resources of other Trac servers, from within the Wiki markup, since version 0.10.
|
||||||
|
|
||||||
|
## Definitions
|
||||||
|
|
||||||
|
An InterTrac link can be seen as a scoped TracLinks.
|
||||||
|
It is used for referring to a Trac resource
|
||||||
|
(Wiki page, changeset, ticket, ...) located in another
|
||||||
|
Trac environment.
|
||||||
|
|
||||||
|
## List of Active InterTrac Prefixes
|
||||||
|
|
||||||
|
[[InterTrac]]
|
||||||
|
|
||||||
|
## Link Syntax
|
||||||
|
|
||||||
|
Simply use the name of the other Trac environment as a prefix,
|
||||||
|
followed by a colon, ending with the resource located in the other environment.
|
||||||
|
|
||||||
|
|
||||||
|
<target_environment>:<TracLinks>
|
||||||
|
|
||||||
|
The other resource is specified using a regular TracLinks, of any flavor.
|
||||||
|
|
||||||
|
That target environment name is either the real name of the
|
||||||
|
environment, or an alias for it.
|
||||||
|
The aliases are defined in `trac.ini` (see below).
|
||||||
|
The prefix is case insensitive.
|
||||||
|
|
||||||
|
For convenience, there's also some alternative short-hand form,
|
||||||
|
where one can use an alias as an immediate prefix
|
||||||
|
for the identifier of a ticket, changeset or report:
|
||||||
|
(e.g. `#T234`, `[T1508]`, `[trac 1508]`, ...)
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
|
||||||
|
#!comment
|
||||||
|
Besides the other environments run by the same server process
|
||||||
|
(called ''sibling'' environments), which are automatically detected,
|
||||||
|
Support for sibling environments has been disabled.
|
||||||
|
See http://thread.gmane.org/gmane.comp.version-control.subversion.trac.devel/157
|
||||||
|
|
||||||
|
It is necessary to setup a configuration for the InterTrac facility.
|
||||||
|
This configuration has to be done in the TracIni file, `[intertrac]` section.
|
||||||
|
|
||||||
|
Example configuration:
|
||||||
|
|
||||||
|
...
|
||||||
|
[intertrac]
|
||||||
|
# -- Example of setting up an alias:
|
||||||
|
t = trac
|
||||||
|
|
||||||
|
# -- Link to an external Trac:
|
||||||
|
trac.title = Edgewall's Trac for Trac
|
||||||
|
trac.url = http://projects.edgewall.com/trac
|
||||||
|
trac.compat = false
|
||||||
|
|
||||||
|
The `.url` is mandatory and is used for locating the other Trac.
|
||||||
|
This can be a relative URL in case that Trac environment is located
|
||||||
|
on the same server.
|
||||||
|
|
||||||
|
The `.title` information will be used for providing an useful tooltip
|
||||||
|
when moving the cursor over an InterTrac links.
|
||||||
|
|
||||||
|
Finally, the `.compat` option can be used to activate or disable
|
||||||
|
a _compatbility_ mode:
|
||||||
|
* If the targeted Trac is running a version below milestone:0.10
|
||||||
|
(r3526 to be precise), then it doesn't know how to dispatch an InterTrac
|
||||||
|
link, and it's up to the local Trac to prepare the correct link.
|
||||||
|
Not all links will work that way, but the most common do.
|
||||||
|
This is called the compatibility mode, and is `true` by default.
|
||||||
|
* If you know that the remote Trac knows how to dispatch InterTrac links,
|
||||||
|
you can explicitely disable this compatibility mode and then _any_
|
||||||
|
TracLinks can become an InterTrac link.
|
||||||
|
|
||||||
|
Now, given the above configuration, one could create the following links:
|
||||||
|
* to this InterTrac page:
|
||||||
|
* `trac:wiki:InterTrac` trac:wiki:InterTrac
|
||||||
|
* `t:wiki:InterTrac` t:wiki:InterTrac
|
||||||
|
* Keys are case insensitive: `T:wiki:InterTrac` T:wiki:InterTrac
|
||||||
|
* to the ticket #234:
|
||||||
|
* `trac:ticket:234` trac:ticket:234
|
||||||
|
* `trac:#234` trac:#234
|
||||||
|
* `#T234` #T234
|
||||||
|
* to the changeset [1912]:
|
||||||
|
* `trac:changeset:1912` trac:changeset:1912
|
||||||
|
* `[T1912]` [T1912]
|
||||||
|
* to the log range [3300:3330]: *(Note: the following ones need `trac.compat=false`)*
|
||||||
|
* `trac:log:@3300:3330` trac:log:@3300:3330
|
||||||
|
* `[trac 3300:3330]` [trac 3300:3330]
|
||||||
|
|
||||||
|
The generic form `intertrac_prefix:module:id` is translated
|
||||||
|
to the corresponding URL `<remote>/module/id`, shorthand links
|
||||||
|
are specific to some modules (e.g. !#T234 is processed by the
|
||||||
|
ticket module) and for the rest (`intertrac_prefix:something`),
|
||||||
|
we rely on the TracSearch#quickjump facility of the remote Trac.
|
||||||
|
|
||||||
|
----
|
||||||
|
### Discussion
|
||||||
|
|
||||||
|
I think that the `trac` prefix could even be set as a default in the `[intertrac]` TracIni section. --CB
|
||||||
|
|
||||||
|
----
|
||||||
|
See also: TracLinks, InterWiki
|
73
InterWiki.md
Normal file
73
InterWiki.md
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
<!-- Name: InterWiki -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2006/12/11 18:32:26 -->
|
||||||
|
<!-- Author: trac -->
|
||||||
|
# Support for InterWiki links
|
||||||
|
|
||||||
|
_(since [milestone:0.10])_
|
||||||
|
|
||||||
|
## Definition
|
||||||
|
|
||||||
|
An InterWiki link can be used for referring to a Wiki page
|
||||||
|
located in another Wiki system, and by extension, to any object
|
||||||
|
located in any other Web application, provided a simple URL
|
||||||
|
mapping can be done.
|
||||||
|
|
||||||
|
At the extreme, InterWiki prefixes can even be used to simply introduce
|
||||||
|
links to new protocols, such as `tsvn:` used by TortoiseSvn.
|
||||||
|
|
||||||
|
## Link Syntax
|
||||||
|
|
||||||
|
|
||||||
|
<target_wiki>(:<identifier>)+
|
||||||
|
|
||||||
|
The link is composed by the targeted Wiki (or system) name,
|
||||||
|
followed by a colon (e.g. `MeatBall:`),
|
||||||
|
followed by a page specification in the target.
|
||||||
|
Note that, as for InterTrac prefixes, *InterWiki prefixes are case insensitive*.
|
||||||
|
|
||||||
|
The target Wiki URL is looked up in the InterMapTxt wiki page,
|
||||||
|
modelled after MeatBall:InterMapTxt.
|
||||||
|
|
||||||
|
In addition to traditional InterWiki links, where the target
|
||||||
|
is simply _appended_ to the URL,
|
||||||
|
Trac supports parametric InterWiki URLs:
|
||||||
|
identifiers `$1`, `$2`, ... in the URL
|
||||||
|
will be replaced by corresponding arguments.
|
||||||
|
The argument list is formed by splitting the page identifier
|
||||||
|
using the ":" separator.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
If the following is an excerpt of the InterMapTxt page:
|
||||||
|
|
||||||
|
|
||||||
|
= InterMapTxt =
|
||||||
|
== This is the place for defining InterWiki prefixes ==
|
||||||
|
|
||||||
|
Currently active prefixes: [[InterWiki]]
|
||||||
|
|
||||||
|
This page is modelled after the MeatBall:InterMapTxt page.
|
||||||
|
In addition, an optional comment is allowed after the mapping.
|
||||||
|
----
|
||||||
|
{{{
|
||||||
|
PEP http://www.python.org/peps/pep-$1.html # Python Enhancement Proposal $1
|
||||||
|
Trac-ML http://thread.gmane.org/gmane.comp.version-control.subversion.trac.general/$1 # Message $1 in Trac Mailing List
|
||||||
|
|
||||||
|
tsvn tsvn: # Interact with TortoiseSvn
|
||||||
|
...
|
||||||
|
MeatBall http://www.usemod.com/cgi-bin/mb.pl?
|
||||||
|
MetaWiki http://sunir.org/apps/meta.pl?
|
||||||
|
MetaWikiPedia http://meta.wikipedia.org/wiki/
|
||||||
|
MoinMoin http://moinmoin.wikiwikiweb.de/
|
||||||
|
...
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Then,
|
||||||
|
* `MoinMoin:InterWikiMap` should be rendered as MoinMoin:InterWikiMap
|
||||||
|
and the _title_ for that link would be "InterWikiMap in MoinMoin"
|
||||||
|
* `Trac-ML:4346` should be rendered as Trac-ML:4346
|
||||||
|
and the _title_ for that link would be "Message 4346 in Trac Mailing List"
|
||||||
|
|
||||||
|
----
|
||||||
|
See also: InterTrac, InterMapTxt
|
35
InternationalText.md
Normal file
35
InternationalText.md
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<!-- Name: InternationalText -->
|
||||||
|
<!-- Version: 14 -->
|
||||||
|
<!-- Last-Modified: 2011/09/06 11:31:00 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# International Text
|
||||||
|
|
||||||
|
Mapnik supports unicode text and Right-to-left (RTL) languages (through ICU library).
|
||||||
|
|
||||||
|
This page is to document and discuss improvements needed to unicode text handling.
|
||||||
|
|
||||||
|
== Current Tickets ==
|
||||||
|
|
||||||
|
* #364 / #404 - RTL mirroring
|
||||||
|
* #519 - RTL spacing wrong with numbers (UBIDI_MIXED)
|
||||||
|
* #112 - Indic RTL font shaping
|
||||||
|
* #189 / #409 - RTL wrapping (line breaks)
|
||||||
|
* from osm trac: http://trac.openstreetmap.org/ticket/2182 and http://trac.openstreetmap.org/ticket/1515
|
||||||
|
* #550 - line-follow: perhaps made worse by unicode chars, perhaps not, needs closer look
|
||||||
|
* #558 - Character spacing not correct for nepali text
|
||||||
|
* #582 - TextSymbolizer bug with Armenian letters
|
||||||
|
|
||||||
|
## Issues
|
||||||
|
|
||||||
|
* Better leveraging of ICU
|
||||||
|
* Does ICU support any mirroring that we are not yet leveraging?
|
||||||
|
* It seems that ICU *does not* support shaping for anything other than Arabic RTL, but need to dig deeper
|
||||||
|
|
||||||
|
* Other libraries that solve some of these problems:
|
||||||
|
* In the past developer discussions have mentioned using the [pango library](http://www.pango.org/), or ideas from [liblinebreak](http://vimgadgets.sourceforge.net/liblinebreak/)
|
||||||
|
* If used Pango would need to be an optional dependecy because we don't want to have to depend on whole GLib/GTK stack.
|
||||||
|
* Artem is not interested in a pango dependency
|
||||||
|
* (MapOSMatic is using pango via python: http://news.maposmatic.org/?p=125)
|
||||||
|
* What about http://www.freedesktop.org/wiki/Software/HarfBuzz?
|
||||||
|
|
||||||
|
* http://behdad.org/text/
|
52
IntroductionToGIS.md
Normal file
52
IntroductionToGIS.md
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<!-- Name: IntroductionToGIS -->
|
||||||
|
<!-- Version: 6 -->
|
||||||
|
<!-- Last-Modified: 2009/03/06 08:30:10 -->
|
||||||
|
<!-- Author: WJHildreth -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
As one might guess from [Wikipedia's entry on GIS](http://en.wikipedia.org/wiki/Geographic_information_system), geographic information systems have a long and rich history.
|
||||||
|
|
||||||
|
In this brief note, we will sketch out some basic GIS and GIS-related concepts that can be useful in making use of Mapnik!
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## What is GIS?
|
||||||
|
|
||||||
|
First, we should point out that most would not consider Mapnik a "true geographic information system" since it is mainly a [rendering library](http://en.wikipedia.org/wiki/Rendering_(computer_graphics)) rather than a complete information system that may provide tools for rich analysis or data management. That said, Mapnik builds upon existing work on GIS and GIS-related technologies, such as [proj.4](http://trac.osgeo.org/proj/), [PostGIS](http://en.wikipedia.org/wiki/PostGIS), and various raster/vector data formats.
|
||||||
|
|
||||||
|
Instead, some might say that Mapnik may be more easily applicable to endeavors in the field of [Neogeography](http://en.wikipedia.org/wiki/Neogeography).
|
||||||
|
|
||||||
|
Terminology aside, as you start using or contributing to Mapnik, you'll notice that Mapnik gives you many options when it comes to choosing your _input datasources_ and _geospatial projections_.
|
||||||
|
|
||||||
|
## Data formats
|
||||||
|
|
||||||
|
The two broad categories of input datasources are raster graphics and vector graphics. Developers and dedicated users can dive into Mapnik's PluginArchitecture to get an idea of what kinds of raster and vector input formats Mapnik supports.
|
||||||
|
|
||||||
|
TODO -- paras on choosing input data sources, whether here or in the MapDesign page.
|
||||||
|
|
||||||
|
## Geospatial Projections
|
||||||
|
|
||||||
|
As you start writing C++ or Python code, or tweaking existing XML files, you'll notice that Mapnik allows you to specify geospatial map projections like so:
|
||||||
|
|
||||||
|
|
||||||
|
<Map srs="+proj=latlong +datum=WGS84 +k=1.0 +units=m +over +no_defs"> <!-- XML -->
|
||||||
|
|
||||||
|
The "srs" attribute here stands for [Spatial reference system](http://en.wikipedia.org/wiki/Spatial_referencing_systems). In the "srs" above, note the specification of a map projection and a [datum](http://en.wikipedia.org/wiki/Datum_(geodesy)) type.
|
||||||
|
|
||||||
|
TODO -- more text here.
|
||||||
|
|
||||||
|
For more information on map projections, read the proj.4 documentation, or check out this [guide to selecting map projections](http://www.manifold.net/doc/guide_to_selecting_map_projections.htm).
|
||||||
|
|
||||||
|
Related links
|
||||||
|
|
||||||
|
* http://spatialreference.org/about/
|
||||||
|
* http://www.manifold.net/doc/guide_to_selecting_map_projections.htm
|
||||||
|
* http://en.wikipedia.org/wiki/Map_projection
|
||||||
|
* http://trac.osgeo.org/proj/wiki/GenParms
|
||||||
|
|
||||||
|
## Map Design
|
||||||
|
|
||||||
|
For a longer treatment of MapDesign in Mapnik, see the MapDesign page.
|
||||||
|
|
||||||
|
For more a detailed treatment of map design, see the written works of [Cynthia Brewer](http://www.personal.psu.edu/cab38/) and [Alan MacEachren](http://www.google.com/search?q=alan+maceachren+books).
|
83
Kismet.md
Normal file
83
Kismet.md
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<!-- Name: Kismet -->
|
||||||
|
<!-- Version: 4 -->
|
||||||
|
<!-- Last-Modified: 2010/11/13 10:14:09 -->
|
||||||
|
<!-- Author: kunitoki -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<h2 style="text-align: left; color: red">WARNING: experimental !</h1>
|
||||||
|
|
||||||
|
Mapnik's PluginArchitecture supports the use of different input formats.
|
||||||
|
|
||||||
|
This plugin supports reading WLANs found by running the [kismet](http://www.kismetwireless.net/) daemon.
|
||||||
|
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
There needs to be a running _kismet_server_ process with activated GPS support before starting mapnik.
|
||||||
|
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
|
||||||
|
|| *parameter* || *value* || *description* || *default* ||
|
||||||
|
|| host || string || host where the kismet daemon is running || ||
|
||||||
|
|| port || integer || port of the kismet daemon || ||
|
||||||
|
|| extent || string || max extent of the kismet returned wlans || ||
|
||||||
|
|| encoding || string || internal file encoding || utf-8 ||
|
||||||
|
|
||||||
|
|
||||||
|
# Example
|
||||||
|
|
||||||
|
See next an example XML file to render WLAN icons on the map.
|
||||||
|
|
||||||
|
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map>
|
||||||
|
<Map bgcolor="#b5d0d0" srs="+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 +nadgrids=@null +no_defs +over">
|
||||||
|
|
||||||
|
<Style name="kismet">
|
||||||
|
<Rule>
|
||||||
|
<MaxScaleDenominator>2000000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>100</MinScaleDenominator>
|
||||||
|
<Filter>[internet_access]='wlan_crypted'</Filter>
|
||||||
|
<PointSymbolizer file = "/home/andreas/src/osm/mapnik/symbols/wlan_crypted.png" type="png" width="32" height="32" />
|
||||||
|
<TextSymbolizer name="name" face_name="DejaVu Sans Bold" size="8" fill="#636" dy="-10" halo_radius="1" wrap_width="0"/>
|
||||||
|
</Rule>
|
||||||
|
|
||||||
|
<Rule>
|
||||||
|
<MaxScaleDenominator>2000000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>100</MinScaleDenominator>
|
||||||
|
<Filter>[internet_access]='wlan_uncrypted'</Filter>
|
||||||
|
<PointSymbolizer file = "/home/andreas/src/osm/mapnik/symbols/wlan_uncrypted.png" type="png" width="32" height="32" />
|
||||||
|
<TextSymbolizer name="name" face_name="DejaVu Sans Bold" size="8" fill="#636" dy="-10" halo_radius="1" wrap_width="0"/>
|
||||||
|
</Rule>
|
||||||
|
|
||||||
|
<Rule>
|
||||||
|
<MaxScaleDenominator>2000000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>100</MinScaleDenominator>
|
||||||
|
<Filter>[internet_access]='wlan_wep'</Filter>
|
||||||
|
<PointSymbolizer file = "/home/andreas/src/osm/mapnik/symbols/wlan_wep.png" type="png" width="32" height="32" />
|
||||||
|
<TextSymbolizer name="name" face_name="DejaVu Sans Bold" size="8" fill="#636" dy="-10" halo_radius="1" wrap_width="0"/>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Layer -->
|
||||||
|
|
||||||
|
<Layer name="kismet" status="on" srs="+proj=latlong +datum=WGS84">
|
||||||
|
<StyleName>kismet</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="type">kismet</Parameter>
|
||||||
|
<Parameter name="host">localhost</Parameter>
|
||||||
|
<Parameter name="port">2501</Parameter>
|
||||||
|
<Parameter name="estimate_extent">false</Parameter>
|
||||||
|
<Parameter name="extent">-179,-85,179,85</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
# Resources
|
||||||
|
|
||||||
|
This [icon](http://openclipart.org/people/pinterb7/pinterb7_wlan_accesspoint.svg) suits perfect for WLAN. I just changed the color and exported it to PNG.
|
||||||
|
|
||||||
|
Here is a video: [http://www.youtube.com/watch?v=On9O8d7AOZA]
|
13
LabelingSupport.md
Normal file
13
LabelingSupport.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<!-- Name: LabelingSupport -->
|
||||||
|
<!-- Version: 2 -->
|
||||||
|
<!-- Last-Modified: 2009/12/11 12:02:53 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
### Labeling with Mapnik
|
||||||
|
|
||||||
|
Make labels with the TextSymbolizer
|
||||||
|
|
||||||
|
Great resources:
|
||||||
|
* http://mike.teczno.com/notes/mapnik.html
|
||||||
|
* http://trac.openstreetmap.org/browser/applications/rendering/mapnik/osm.xml
|
||||||
|
|
||||||
|
|
64
LearningMapnik.md
Normal file
64
LearningMapnik.md
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<!-- Name: LearningMapnik -->
|
||||||
|
<!-- Version: 7 -->
|
||||||
|
<!-- Last-Modified: 2010/05/02 11:05:01 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Learning Mapnik
|
||||||
|
|
||||||
|
== Background ==
|
||||||
|
|
||||||
|
*How to Approach Map Design*
|
||||||
|
* MapDesign -- use Mapnik to design better looking maps!
|
||||||
|
|
||||||
|
*How to understand GIS Concepts*
|
||||||
|
* [wiki:IntroductionToGIS] -- a brief intro to the world of mapping systems
|
||||||
|
* Projections, geodetics, and polygons, oh my...
|
||||||
|
|
||||||
|
## Core Topics
|
||||||
|
|
||||||
|
*How to Style your Maps*
|
||||||
|
* SymbologySupport
|
||||||
|
|
||||||
|
*How to combine Map styles and Layers*
|
||||||
|
* See the MapnikTutorials
|
||||||
|
* XML Mapfile details [wiki:XMLConfigReference]
|
||||||
|
|
||||||
|
*How to read in data*
|
||||||
|
* PluginArchitecture
|
||||||
|
|
||||||
|
*How to use the Mapnik Python Bindings*
|
||||||
|
* See the python api docs here: http://media.mapnik.org/api_docs/python/
|
||||||
|
* You can generate these docs yourself too, look at source:trunk/docs/epydoc_config/readme.txt
|
||||||
|
* Check out the MapnikTutorials and the references at ExampleCode
|
||||||
|
* Study applications like Cascadenik or Nik2img at http://mapnik-utils.googlecode.com/
|
||||||
|
|
||||||
|
*How to use Custom Fonts*
|
||||||
|
* UsingCustomFonts
|
||||||
|
|
||||||
|
== Performance ==
|
||||||
|
|
||||||
|
[wiki:OptimizeRenderingWithPostGIS] -- Optimize rendering speed and simplify the stylesheet with PostGIS
|
||||||
|
|
||||||
|
|
||||||
|
## Advanced Topics
|
||||||
|
|
||||||
|
MapnikRenderers -- Render with AGG or Cairo
|
||||||
|
|
||||||
|
LabelingSupport -- Discover the intricacies of label placement.
|
||||||
|
|
||||||
|
OutputFormats -- Which format to use based on speed, quality, and rendering tradeoffs.
|
||||||
|
|
||||||
|
[Generating Contours](http://wiki.openstreetmap.org/index.php/Contours) - Using Mapnik with GDAL to build contours of the world.
|
||||||
|
|
||||||
|
ManagingLargeXmlFiles -- Do things once and only once using XML entities.
|
||||||
|
|
||||||
|
[Hooking up Mapnik to PostGIS](/wiki:PostGIS/)
|
||||||
|
|
||||||
|
[Scale and Scale denominators](/wiki:ScaleAndPpi/) -- Scale, Projection and Pixels Per Inch: what it means for determining the scale of your rendered and printed maps.
|
||||||
|
|
||||||
|
ModServer -- An experimental mod_python server for Mapnik
|
||||||
|
|
||||||
|
[wiki:IntegrateWithWxPython] -- Demonstrate how to integrate mapnik with wxPython
|
||||||
|
|
||||||
|
[wiki:FontSet] -- Fallback fonts support
|
||||||
|
|
||||||
|
MapnikReferences -- Various other resources related to Mapnik and Mapping
|
77
Legending.md
Normal file
77
Legending.md
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
<!-- Name: Legending -->
|
||||||
|
<!-- Version: 10 -->
|
||||||
|
<!-- Last-Modified: 2011/10/10 02:01:25 -->
|
||||||
|
<!-- Author: Petr Dlouhy -->
|
||||||
|
|
||||||
|
# Discussion of a Legending Spec for Mapnik
|
||||||
|
Should be configured with XML or a python class.
|
||||||
|
|
||||||
|
#536 tracks progress on this feature.
|
||||||
|
|
||||||
|
# Possible Example
|
||||||
|
[[Image(legend_example.png)]]
|
||||||
|
|
||||||
|
## XML
|
||||||
|
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
|
||||||
|
|
||||||
|
<Legend>
|
||||||
|
<Title breakline=true stroke-width="1" stroke="black">Education</title>
|
||||||
|
<SubTitle> Level of Education Among Population Over Age 20</Subtitle>
|
||||||
|
<Item>
|
||||||
|
<Symbolizer>
|
||||||
|
<CssParameter name="stroke">white</CssParameter>
|
||||||
|
<CssParameter name="stroke-width">.5</CssParameter>
|
||||||
|
<CssParameter name="fill">#93A462</CssParameter>
|
||||||
|
<ItemText face_name="DejaVu Sans Bold" size="10" fill="black">Highest</ItemText>
|
||||||
|
</Item>
|
||||||
|
....
|
||||||
|
</Legend>
|
||||||
|
## Python
|
||||||
|
|
||||||
|
|
||||||
|
# Feature Wishlist
|
||||||
|
|
||||||
|
### Layer symbolization using representative feature geometry
|
||||||
|
|
||||||
|
Default behavior would will be to use, for example, a filled rectangle to represent polygon geometries (like the example graphic above)
|
||||||
|
|
||||||
|
But an optional filter could be applied to direct the legend renderer to use a specific feature geometry (scaled to fit the legend layout) as the symbol
|
||||||
|
|
||||||
|
That would look something like:
|
||||||
|
|
||||||
|
[[Image(legend_feature_example.png)]]
|
||||||
|
|
||||||
|
Syntax might look like:
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Item>
|
||||||
|
<Filter>[id] = 1</Filter>
|
||||||
|
<Symbolizer>
|
||||||
|
...
|
||||||
|
|
||||||
|
# or, more simplistically choose a random feature
|
||||||
|
<Item use_feature="true">
|
||||||
|
<Symbolizer>
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
### Andy's alternative approach
|
||||||
|
|
||||||
|
I'd like to approach things slightly differently. We could keep the stylesheet as close as possible to the "real" one, and concentrate the legend-specific alterations to the layer definitions. For example, if there was a WKT layer (#630) and screen coordinates (#631) then you could have something like
|
||||||
|
|
||||||
|
|
||||||
|
[... normal style rules ...]
|
||||||
|
<Layer name=pubs srs="screen">
|
||||||
|
<Datasource type="wkt">
|
||||||
|
<Parameter name="geom">POINT(20,20)</Parameter>
|
||||||
|
<Parameter name="attributes">{"amenity","pub"}</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
The label text for the legend could then be chosen and placed with other screen+wkt layers to get the desired effect. Although this means creating custom layers, it's likely to be less work than altering the <style> sections of a large map definition.
|
||||||
|
|
||||||
|
# See also
|
||||||
|
Lars Ahlzen has written a Python script for TopOSM which creates HTML snippets with images from a Mapnik style file: http://wiki.openstreetmap.org/wiki/TopOSM/Details#Map_legend
|
42
LinePatternSymbolizer.md
Normal file
42
LinePatternSymbolizer.md
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<!-- Name: LinePatternSymbolizer -->
|
||||||
|
<!-- Version: 8 -->
|
||||||
|
<!-- Last-Modified: 2009/09/17 01:14:55 -->
|
||||||
|
<!-- Author: theosys -->
|
||||||
|
## Configuration Options for LinePatternSymbolizer
|
||||||
|
|
||||||
|
|| *parameter* || *value* || *default* ||
|
||||||
|
|| file || path to image file || none ||
|
||||||
|
|| base || base path where to search for file || none ||
|
||||||
|
|| width || px || 4 ||
|
||||||
|
|| height || px || 4 ||
|
||||||
|
|| type || png tiff || none ||
|
||||||
|
|
||||||
|
*Note* that the line direction matters!
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
A natural=cliff tag on an OpenStreetMap tile, rendered with LinePatternSymbolizer.
|
||||||
|
[[BR]]
|
||||||
|
[[Image(http://a.tile.openstreetmap.org/18/141423/87855.png)]]
|
||||||
|
|
||||||
|
### Default
|
||||||
|
|
||||||
|
|
||||||
|
#### XML
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<LinePatternSymbolizer width="16" height="16" type="png" file="/path/to/icon.png"/>
|
||||||
|
|
||||||
|
|
||||||
|
#### Python
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
l = LinePatternSymbolizer('/path/to/icon.png','png',10,10) # file, type, width, height
|
||||||
|
|
||||||
|
#### C++
|
||||||
|
|
||||||
|
|
||||||
|
#!cpp
|
||||||
|
rule_type rule;
|
||||||
|
rule.append(line_pattern_symbolizer("/path/to/icon.png", "png", 20, 20)); // file, type, width, height
|
68
LineSymbolizer.md
Normal file
68
LineSymbolizer.md
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<!-- Name: LineSymbolizer -->
|
||||||
|
<!-- Version: 11 -->
|
||||||
|
<!-- Last-Modified: 2009/09/17 02:06:35 -->
|
||||||
|
<!-- Author: theosys -->
|
||||||
|
# LineSymbolizer
|
||||||
|
|
||||||
|
A LineSymbolizer is used to render a "stroke" along a linear geometry.
|
||||||
|
|
||||||
|
|| *parameter* || *value* || *description* || *unit* || *default* ||
|
||||||
|
|| stroke || CSS colour || A Color value such as 'green' or #A3D979 || - || "black" ||
|
||||||
|
|| stroke-width || 0.0 - n || Width of line || pixels || 1.0 ||
|
||||||
|
|| stroke-opacity || 0.0 - 1.0 || 1 is fully opaque while zero is fully transparent and .5 would be 50% transparent|| transparency || 1.0 ||
|
||||||
|
|| stroke-linejoin || miter, round, bevel || See http://www.w3.org/TR/SVG/painting.html#propdef-stroke-linejoin for an example for each value || - || miter ||
|
||||||
|
|| stroke-linecap || round, butt, square || See http://www.w3.org/TR/SVG/painting.html#propdef-stroke-linecap for an example for each value || - || butt ||
|
||||||
|
|| stroke-dasharray || 0.0 - n,0.0 - n || A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported as well (e.g. to start the line not with a stroke, but with a gap). || pixels || none ||
|
||||||
|
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
[[Image(htdocs:/images/line_symbolizer_2.png)]]
|
||||||
|
|
||||||
|
### Default
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
[[Image(default_line_symbolizer.png)]]
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<LineSymbolizer />
|
||||||
|
|
||||||
|
|
||||||
|
#### XML
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<LineSymbolizer>
|
||||||
|
<CssParameter name="stroke">#0000ff</CssParameter>
|
||||||
|
<CssParameter name="stroke-width">4</CssParameter>
|
||||||
|
</LineSymbolizer>
|
||||||
|
|
||||||
|
#### Python
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
l = LineSymbolizer(Color('green'),0.1)
|
||||||
|
l.stroke.add_dash(.1,.1)
|
||||||
|
l.stroke.opacity = .5
|
||||||
|
|
||||||
|
Fetch all the possible methods like:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
>>> from mapnik import LineSymbolizer
|
||||||
|
>>> dir(LineSymbolizer().stroke)
|
||||||
|
|
||||||
|
#### C++
|
||||||
|
|
||||||
|
|
||||||
|
#!cpp
|
||||||
|
rule_type rule;
|
||||||
|
stroke ls; // This is the line symbolizer
|
||||||
|
ls.set_color(color(255, 255, 255);
|
||||||
|
ls.set_width(4); // width of the line in pixels
|
||||||
|
ls.set_line_join(mapnik::ROUND_JOIN);
|
||||||
|
ls.set_line_cap(mapnik::ROUND_CAP);
|
||||||
|
ls.add_dash(2.5, 1.0);
|
||||||
|
ls.set_opacity(0.5);
|
||||||
|
rule.append(ls);
|
||||||
|
|
||||||
|
|
30
LinuxInstallation.md
Normal file
30
LinuxInstallation.md
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<!-- Name: LinuxInstallation -->
|
||||||
|
<!-- Version: 13 -->
|
||||||
|
<!-- Last-Modified: 2010/10/27 19:43:31 -->
|
||||||
|
<!-- Author: ajashton -->
|
||||||
|
# Installing Mapnik on Linux
|
||||||
|
|
||||||
|
* *Ubuntu*
|
||||||
|
* Build instructions for the current Ubuntu release at UbuntuInstallation
|
||||||
|
* Notes for older versions archived at UbuntuInstallationOld
|
||||||
|
|
||||||
|
* *Debian*
|
||||||
|
* DebianInstallation
|
||||||
|
|
||||||
|
* *OpenSuse*
|
||||||
|
* OpenSuseInstallation
|
||||||
|
|
||||||
|
* *FreeBSD* - TODO
|
||||||
|
|
||||||
|
* *Gentoo* - http://wiki.openstreetmap.org/wiki/Deploying_your_own_Slippy_Map_Gentoo#Setting_up_your_system
|
||||||
|
|
||||||
|
* *[wiki:CentOS/RHEL]*
|
||||||
|
|
||||||
|
* *Fedora* - http://wiki.openstreetmap.org/wiki/Mapnik/Fedora_Installation
|
||||||
|
|
||||||
|
* *Arch Linux*
|
||||||
|
* ArchInstallation
|
||||||
|
|
||||||
|
|
||||||
|
*ALSO:* notes for many linux versions at: http://wiki.openstreetmap.org/index.php/Mapnik/Installation
|
||||||
|
|
25
MacInstallation.md
Normal file
25
MacInstallation.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<!-- Name: MacInstallation -->
|
||||||
|
<!-- Version: 96 -->
|
||||||
|
<!-- Last-Modified: 2010/09/30 10:16:40 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# Installing Mapnik Mac OS X
|
||||||
|
|
||||||
|
## [Installers](/wiki:MacInstallation/Frameworks/)
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<img style="float: left; margin-right:15px;" src="http://dbsgeo.com/media/images/mac_pkg_small.png" />
|
||||||
|
|
||||||
|
[Binary Mapnik installers for Mac OS X are available](http://dbsgeo.com/downloads) via http://dbsgeo.com
|
||||||
|
|
||||||
|
|
||||||
|
## [Using Homebrew](/wiki:MacInstallation/Homebrew/)
|
||||||
|
|
||||||
|
Homebrew is the recommended OS X package manager for installing Mapnik.
|
||||||
|
|
||||||
|
See [wiki:MacInstallation/Homebrew] for details.
|
||||||
|
|
||||||
|
## [From Source / Macports](/wiki:MacInstallation/Source/)
|
||||||
|
|
||||||
|
For older build notes for various dependencies see: [wiki:MacInstallation/Source]
|
72
MacInstallationPorts.md
Normal file
72
MacInstallationPorts.md
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
<!-- Name: MacInstallationPorts -->
|
||||||
|
<!-- Version: 10 -->
|
||||||
|
<!-- Last-Modified: 2009/11/05 11:15:11 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Installing Mapnik on Mac OS X
|
||||||
|
|
||||||
|
This page describes how to build/install Mapnik from source on Mac OS X >= 10.5, using Macports.
|
||||||
|
|
||||||
|
Unlike the MacInstallation guide, this page assumes you grok [the command-line](http://en.wikipedia.org/wiki/In_the_Beginning...was_the_Command_Line).
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* Install [MacPorts](http://www.macports.org/): http://www.macports.org/install.php (requires XCode. Version 1.6 may not set up a .profile, see [ProblemHotlist](https://trac.macports.org/wiki/ProblemHotlist#a4..profilenotsetup) to fix)
|
||||||
|
|
||||||
|
Run
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ sudo port install proj libpng jpeg tiff icu jam
|
||||||
|
$ sudo port install boost +python25 +icu
|
||||||
|
|
||||||
|
For optional dependencies (such as Cairo or PostGIS), see MacInstallation/Optional
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
Grab source:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ svn co http://svn.mapnik.org/trunk mapnik
|
||||||
|
|
||||||
|
Patch [SConstruct](http://www.scons.org/doc/1.0.1/HTML/scons-user/x348.html) (get [SConstruct.osx.patch](http://trac.mapnik.org/attachment/wiki/MacInstallationPorts/SConstruct.osx.patch), [download here](http://trac.mapnik.org/raw-attachment/wiki/MacInstallationPorts/SConstruct.osx.patch))
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ patch -p1 < SConstruct.osx.patch
|
||||||
|
|
||||||
|
Compile/Install
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ cd mapnik
|
||||||
|
$ python scons/scons.py DEBUG=y
|
||||||
|
$ sudo python scons/scons.py install DEBUG=y
|
||||||
|
|
||||||
|
Add the following line to your ~/.profile
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
export PYTHONPATH="/usr/lib/python2.5/site-packages"
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python
|
||||||
|
>>> import mapnik
|
||||||
|
registered datasource : gdal
|
||||||
|
registered datasource : postgis
|
||||||
|
registered datasource : raster
|
||||||
|
registered datasource : shape
|
||||||
|
>>> dir(mapnik) # This gets you a list of symbols
|
||||||
|
['BoostPythonMetaclass', 'Color', 'Coord', 'CreateDatasource', ...]
|
||||||
|
>>> help(mapnik)
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
* [The Official Mapnik installation guide](http://mapnik.org/documentation/install/)
|
||||||
|
* Conventional MacInstallation guide
|
||||||
|
* http://www.codingadventures.com/2008/04/howto-building-mapnik-on-osx-leopard/
|
||||||
|
|
||||||
|
|
||||||
|
|
353
MacInstallationSource.md
Normal file
353
MacInstallationSource.md
Normal file
|
@ -0,0 +1,353 @@
|
||||||
|
<!-- Name: MacInstallationSource -->
|
||||||
|
<!-- Version: 14 -->
|
||||||
|
<!-- Last-Modified: 2010/01/29 15:03:43 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
## WARNING - this page is out of date
|
||||||
|
|
||||||
|
# Installing Mapnik on Mac OS X (build dependencies from source)
|
||||||
|
|
||||||
|
If you are new to compiling source code, or having trouble getting started on a Mac, you may find that building Mapnik on a Linux-based system is a more friendly place to start. Also see MacInstallation which makes use of MacPorts instead.
|
||||||
|
|
||||||
|
## Notes on These Instructions
|
||||||
|
* Prerequisites are mandatory unless noted
|
||||||
|
|
||||||
|
* Instructions here focus on terminal commands. If you are new to command line usage, read up on using the [Bash shell](https://help.ubuntu.com/community/UsingTheTerminal?action=show&redirect=BasicCommands) and the mac native [Terminal.app](http://www.oreilly.com/pub/a/mac/2004/02/24/bash.html).
|
||||||
|
|
||||||
|
* The [Wget](http://www.gnu.org/software/wget/) command is used below to download source packages and is not pre-installed on Mac OS.
|
||||||
|
|
||||||
|
* If you are new to Python a great place to start is to ['Dive into Python'](http://www.diveintopython.org/installing_python/shell.html).
|
||||||
|
|
||||||
|
* The $ indicates a normal command prompt in the shell.
|
||||||
|
* The # indicates a command that likely needs to be run by a superuser.
|
||||||
|
* The ## indicates code comments that are not executed.
|
||||||
|
* If you run into any problems not discussed on this page see: InstallationTroubleshooting
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* Intel or PPC Mac, g++ compiler (default compiler should be fine)
|
||||||
|
|
||||||
|
* *Python* ≥2.4 - [python.org](http://www.python.org)
|
||||||
|
* Note: Python 2.5.1 comes preloaded on 10.5
|
||||||
|
* Current Source (2.5) and Mac Binaries are available - [http://www.python.org/download/]
|
||||||
|
|
||||||
|
* *The Latest Mapnik Source* - [0.5.1 ](http://mapnik.org/download/Release)
|
||||||
|
* Download stable release 0.5.1 - [Mapnik Source 0.5.1](http://prdownload.berlios.de/mapnik/mapnik_src-0.5.1.tar.gz)
|
||||||
|
* Checkout the current repository with subversion:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
svn co http://svn.mapnik.org/trunk/ mapnik
|
||||||
|
|
||||||
|
* *Recommended*: Proj.4 - [Cartographic Projections Library](http://www.remotesensing.org/proj/)
|
||||||
|
* necessary for reprojection support
|
||||||
|
* necessary for the WMS server
|
||||||
|
|
||||||
|
* *Boost* - [C++ Libraries](http://www.boost.org/)
|
||||||
|
* Thread - libboost_thread-mt.dylib
|
||||||
|
* System - config.hpp (for different operating systems support)
|
||||||
|
* Filesystem - libboost_filesystem.dylib
|
||||||
|
* regex (regular expressions) - libboost_regex.dylib
|
||||||
|
* Iostreams (input/output) - libboost_iostreams.dylib
|
||||||
|
* Program Options - program_options.hpp
|
||||||
|
* python - libboost_python.dylib
|
||||||
|
* Note: [Boost Jam](http://www.boost.org/users/download/) (bjam) needed for boost source build
|
||||||
|
|
||||||
|
* *Libraries* for Imaging, character encoding, font, compression, and parsing
|
||||||
|
* libpng - [Portable Network Graphics format](http://www.libpng.org/pub/png/libpng.html)
|
||||||
|
* libjpeg - [Joint Photographic Experts Group format](http://www.ijg.org/)
|
||||||
|
* libtiff - [Tag Image File Format](http://www.libtiff.org/)
|
||||||
|
* libltdl - [GNU Libtool / Shared Library Linker](http://www.gnu.org/software/libtool/manual/libtool.html)
|
||||||
|
* libz - [zlib compression library](http://www.zlib.net/)
|
||||||
|
* Comes pre-installed on Mac OS X in /usr/local/lib
|
||||||
|
* libicu - [International Components for Unicode](http://www.icu-project.org/)
|
||||||
|
* Note: libicucore.dylib is installed on mac but to build against it you need to generate the headers, see below
|
||||||
|
* Optional: libcairo, libcairomm, pycairo, tinyxml / spirit / libxml2. See [MacInstallation/Optional] for more details.
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
|
||||||
|
### Short Version
|
||||||
|
|
||||||
|
1. Install dependencies (Good luck! See below...)
|
||||||
|
|
||||||
|
2. Optional: within the Mapnik source directory run this command to get your build options:
|
||||||
|
* These are configured in the [source:trunk/SConstruct SConstruct file used by scons.py] but can be assigned with flags
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py -h # lowercase h is the scons dependency configurations
|
||||||
|
$ python scons/scons.py -H # capitol H is the scons help
|
||||||
|
3. Then run scons to build:
|
||||||
|
* Note: this will only work if all your required dependencies are in the default locations (near impossible on Mac OS)
|
||||||
|
* Some packages are located in scons using pkg-config (so make sure that binary in is your path)
|
||||||
|
* Set custom directives with flags like PGSQL_INCLUDES=/usr/local/pgsql/include PGSQL_LIBS=/usr/local/pgsql/lib to point to custom locations
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py
|
||||||
|
4. Once scons can find all needed dependencies it will compile Mapnik locally. To install then issue:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py install [and any of the flags you needed to find dependencies]
|
||||||
|
5. Optional: Run this command to clear out the local scons build if you already attempted, unsuccessfully, to build:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py -c
|
||||||
|
6. Optional: if you are rebuilding Mapnik due to compile problems or updgrading it may help to first delete your mapnik libs and python bindings:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
## If you ran scons using the system python the PYTHON_PREFIX will likely be equivalent to: /usr/lib/python2.5/site-packages/
|
||||||
|
$ export PYTHON_PREFIX=/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
|
||||||
|
## The PREFIX will be /usr/local by default or your custom location
|
||||||
|
$ export PREFIX=/usr/local
|
||||||
|
## Uninstall the Python `mapnik` module.
|
||||||
|
$ sudo rm -fr $PYTHON_PREFIX/mapnik
|
||||||
|
## Uninstall the mapnik libs, includes, and bin
|
||||||
|
$ sudo rm -fr $PREFIX/include/mapnik
|
||||||
|
$ sudo rm -fr $PREFIX/lib/mapnik
|
||||||
|
$ sudo rm -f $PREFIX/lib/libmapnik.*
|
||||||
|
$ sudo rm $PREFIX/bin/shapeindex
|
||||||
|
|
||||||
|
|
||||||
|
## Full Instructions
|
||||||
|
|
||||||
|
### Download Mapnik
|
||||||
|
1. Download the Mapnik source code from svn
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ svn co http://svn.mapnik.org/trunk mapnik_svn
|
||||||
|
$ cd mapnik_svn
|
||||||
|
or the stable release source code:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ wget http://download.berlios.de/mapnik/mapnik-0.7.0.tar.bz2
|
||||||
|
$ tar xvf mapnik-0.7.0.tar.bz2
|
||||||
|
$ cd mapnik-0.7.0/
|
||||||
|
|
||||||
|
2. Read over the INSTALL instructions for your version
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
open INSTALL # Doc in the root of Mapnik download
|
||||||
|
|
||||||
|
### Optional Installs
|
||||||
|
|
||||||
|
3. Install Proj.4, PostgreSQL/PostGIS, and GDAL if necessary.
|
||||||
|
|
||||||
|
See [MacInstallation/Optional] for details.
|
||||||
|
|
||||||
|
### Install Necessary Libraries
|
||||||
|
|
||||||
|
4. Install all the imaging, character encoding, font, compression, and parsing libraries
|
||||||
|
* This can be done with [Macports](http://www.macports.org/), [Fink](http://www.finkproject.org/), or by source (recommended).
|
||||||
|
* The image libraries should already be installed if you used the [Frameworks](http://www.kyngchaos.com/wiki/software:frameworks) from kyngchaos.com for GDAL
|
||||||
|
* You will still need to specify their locations in the scons build process like:
|
||||||
|
* TIFF_LIBS=/Library/Frameworks/UnixImageIO.framework/Versions/Current/unix/lib
|
||||||
|
* TIFF_INCLUDES=/Library/Frameworks/UnixImageIO.framework/Versions/Current/unix/include
|
||||||
|
* And you may need to specify in your .bash_profile:
|
||||||
|
* export DYLD_LIBRARY_PATH=/Library/Frameworks/UnixImageIO.framework/Versions/Current/unix/lib
|
||||||
|
* Detailed descriptions - TO DO / FIXME
|
||||||
|
|
||||||
|
### Install ICU
|
||||||
|
|
||||||
|
OS 10.5.10.6 trick to build against Apple provided ICU, which lacks headers.
|
||||||
|
|
||||||
|
Note: custom approach - it is easier to just install your own copy of ICU.
|
||||||
|
|
||||||
|
To get this to work you need to:
|
||||||
|
* Pass `ICU_LIB_NAME=icucore` when building Mapnik for this to work (only 0.7 or greater).
|
||||||
|
* compile boost_regex with:
|
||||||
|
|
||||||
|
bjam --with-regex toolset=darwin -sHAVE_ICU=1 cxxflags='-DU_HIDE_DRAFT_API -DUDISABLE_RENAMING' -sICU_PATH=/usr/ -a install
|
||||||
|
* patch boost regex jamfile like:
|
||||||
|
|
||||||
|
#!diff
|
||||||
|
Index: libs/regex/build/Jamfile.v2
|
||||||
|
===================================================================
|
||||||
|
--- libs/regex/build/Jamfile.v2 (revision 58875)
|
||||||
|
+++ libs/regex/build/Jamfile.v2 (working copy)
|
||||||
|
@@ -25,9 +25,9 @@
|
||||||
|
if $(HAVE_ICU) && ! $(ICU_PATH)
|
||||||
|
{
|
||||||
|
gHAS_ICU = true ;
|
||||||
|
- gICU_CORE_LIB = icuuc ;
|
||||||
|
- gICU_IN_LIB = icui18n ;
|
||||||
|
- gICU_DATA_LIB = icudata ;
|
||||||
|
+ gICU_CORE_LIB = icucore ;
|
||||||
|
+ #gICU_IN_LIB = icui18n ;
|
||||||
|
+ #gICU_DATA_LIB = icudata ;
|
||||||
|
gICU_CONFIG_CHECKED = true ;
|
||||||
|
}
|
||||||
|
else if $(ICU_PATH)
|
||||||
|
|
||||||
|
And compile icu to pull out headers like:
|
||||||
|
|
||||||
|
cd ~/src
|
||||||
|
### SNOW LEOPARD - 10.6
|
||||||
|
curl -O http://www.opensource.apple.com/tarballs/ICU/ICU-400.38.tar.gz
|
||||||
|
tar xvf ICU-400.38.tar.gz
|
||||||
|
cd ICU-400.38
|
||||||
|
|
||||||
|
### LEOPARD - 10.5
|
||||||
|
curl -O http://www.opensource.apple.com/tarballs/ICU/ICU-8.11.4.tar.gz
|
||||||
|
rac xvf ICU-8.11.4.tar.gz
|
||||||
|
cd ICU-8.11.4
|
||||||
|
|
||||||
|
## BUILD
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
# copy headers to /usr/include
|
||||||
|
# or you could put these anywhere that Mapnik can find them
|
||||||
|
sudo mv build/usr/local/include/unicode/ /usr/include/
|
||||||
|
|
||||||
|
### Install Boost
|
||||||
|
|
||||||
|
5. Install Boost using Bjam
|
||||||
|
* You can install boost with Macports (currently 1.35.0):
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ port info boost-jam boost # optional: this is to check that these exist and see their details
|
||||||
|
# port install boost-jam # must install bjam manually first, due to [http://trac.macosforge.org/projects/macports/ticket/13714 Macports bug]
|
||||||
|
# port install -v boost +python25 +icu
|
||||||
|
* Prepare for a long wait and lots of CPU!
|
||||||
|
* Macports should automatically download any dependencies needed for Boost
|
||||||
|
|
||||||
|
* Or install from source (recommended) like so:
|
||||||
|
* Thanks jbronn for this writeup
|
||||||
|
* Use the `bjam` not the `configure` script to build.
|
||||||
|
* If you have a dual-core system you can add the `-j2` flag to both `bjam` and `scons` to take advantage of both cores:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
svn co http://svn.boost.org/svn/boost/trunk boost-trunk
|
||||||
|
cd boost-trunk
|
||||||
|
export BOOST=`pwd`
|
||||||
|
cd tools/jam/src
|
||||||
|
./build.sh darwin
|
||||||
|
cd bin.mac*/
|
||||||
|
export PATH=`pwd`:$PATH
|
||||||
|
cd $BOOST
|
||||||
|
bjam --toolset=darwin \
|
||||||
|
--with-thread --with-filesystem --with-iostreams \
|
||||||
|
--with-regex --with-program_options --with-python \
|
||||||
|
--with-system stage
|
||||||
|
sudo bjam --toolset=darwin \
|
||||||
|
--with-thread --with-filesystem --with-iostreams \
|
||||||
|
--with-regex --with-program_options --with-python \
|
||||||
|
--with-system install
|
||||||
|
|
||||||
|
|
||||||
|
### Install WMS dependencies
|
||||||
|
|
||||||
|
6. See [MacInstallation/Optional] for details.
|
||||||
|
|
||||||
|
### Finally, build and install Mapnik
|
||||||
|
|
||||||
|
7. Run scons (debug mode flag, DEBUG=y, is recommended for troubleshooting later on)
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ cd mapnik-0.5.1
|
||||||
|
$ python scons/scons.py DEBUG=y
|
||||||
|
|
||||||
|
* If the scons build process is not able to find a required dependency it will exit.
|
||||||
|
* You'll need to manually set the paths to the locations of library (libs) and/or header files (includes)
|
||||||
|
* See the svn INSTALL readme for more details about setting paths or issue the command:
|
||||||
|
|
||||||
|
* You will be looking for an output once scons finds all necessary dependencies (an elusive target) that looks like:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py DEBUG=y
|
||||||
|
scons: Reading SConscript files ...
|
||||||
|
Building on Darwin ...
|
||||||
|
pkg-config --exists cairomm-1.0
|
||||||
|
Checking for C library m... yes
|
||||||
|
Checking for C library ltdl... yes
|
||||||
|
Checking for C library png... yes
|
||||||
|
Checking for C library tiff... yes
|
||||||
|
Checking for C library z... yes
|
||||||
|
Checking for C library jpeg... yes
|
||||||
|
Checking for C library proj... no
|
||||||
|
Checking for C library pq... no
|
||||||
|
Checking for C++ library icuuc... yes
|
||||||
|
Checking for C++ library icudata... yes
|
||||||
|
Checking for C++ library gdal... no
|
||||||
|
Checking for C++ library boost_filesystem-mt... yes
|
||||||
|
Checking for C++ library boost_regex-mt... yes
|
||||||
|
Checking for C++ library boost_iostreams-mt... yes
|
||||||
|
Checking for C++ library boost_program_options-mt... yes
|
||||||
|
Checking for C++ library boost_thread-mt... yes
|
||||||
|
Bindings Python version... 2.5
|
||||||
|
Python 2.5 prefix... /System/Library/Frameworks/Python.framework/Versions/2.5
|
||||||
|
pkg-config --exists pycairo
|
||||||
|
scons: done reading SConscript files.
|
||||||
|
[... build process will commence...]
|
||||||
|
* Mapnik should be successfully built at the culmination of that command.
|
||||||
|
|
||||||
|
* If this fails with an error complaining that boost filesystem cannot be found, check the section above for building boost and add the symlinks. Also ensure you add the following to the scons command (assuming built from source and default installation folder)
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py DEBUG=y BOOST_LIBS=/usr/local/lib BOOST_INCLUDES=/usr/local/includes/boost-1_35/
|
||||||
|
|
||||||
|
* Then you should install the compiled files:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py install DEBUG=y
|
||||||
|
|
||||||
|
### Test Installation
|
||||||
|
|
||||||
|
8. Now test your mapnik installation in the python interpreter:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
$ python
|
||||||
|
>>> import mapnik
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<stdin>", line 1, in <module>
|
||||||
|
ImportError: No module named mapnik
|
||||||
|
* Whoops, the mapnik module is not on sys.path!
|
||||||
|
|
||||||
|
* This command will show you what *is* on your PYTHONPATH:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
$ python
|
||||||
|
>>> import sys
|
||||||
|
>>> sys.path
|
||||||
|
['', '/Library/Python/2.5/site-packages/ ....
|
||||||
|
|
||||||
|
9. If you got the ImportError put your mapnik module in your PYTHONPATH like so:
|
||||||
|
* Place this text in either /etc/profile or ~/.bash_profile
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
export PYTHONPATH=/usr/lib/python2.5/site-packages/
|
||||||
|
|
||||||
|
* Or Symlink to your Mapnik module from the default site-packages directory (it should be on your path automatically)
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/mapnik /Library/Python/2.5/site-packages/mapnik
|
||||||
|
* Find your default site-packages directory like so:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
|
||||||
|
|
||||||
|
10. Now return to the python interpreter:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python
|
||||||
|
>>> import mapnik
|
||||||
|
registered datasource : gdal
|
||||||
|
registered datasource : postgis
|
||||||
|
registered datasource : raster
|
||||||
|
registered datasource : shape
|
||||||
|
>>> dir(mapnik) # This gets you a list of symbols
|
||||||
|
['BoostPythonMetaclass', 'Color', 'Coord', 'CreateDatasource'
|
||||||
|
[.....]
|
||||||
|
'scale_denominator', 'setdlopenflags']
|
||||||
|
>>> help(mapnik)
|
||||||
|
|
||||||
|
* Congrats: you can now head to the [GettingStarted Getting Started page] for a 'Hello World' demo of using Mapnik via the python bindings.
|
||||||
|
|
||||||
|
## Known Issues
|
||||||
|
* There are several known issues with building Mapnik on Mac OS X
|
||||||
|
|
||||||
|
* It is entirely possible to run Mapnik on Mac 10.4 and 10.5 but some users have experienced the following problems:
|
||||||
|
* Mapnik does not correctly read the map Envelope(extent) and gets caught in infinite loop during shapefile processing - [April 17](https://lists.berlios.de/pipermail/mapnik-users/2008-April/000801.html) - May be related to PPC architecture. See Ticket #92
|
||||||
|
* NoneType Error occurs in python bindings - [April 21](https://lists.berlios.de/pipermail/mapnik-devel/2008-April/000610.html) & [April 18](https://lists.berlios.de/pipermail/mapnik-users/2008-April/000813.html). The NoneType error may be due to a previously installed version of Python (possible from Tiger to Leopard Upgrade) that left frameworks in /Library/Frameworks/Python.framework. Remove that folder, and rebuild mapnik. NOTE: Only do this if you can confirm that this is not the current location of your system Python.
|
||||||
|
|
||||||
|
* Keep in mind that installation on most linux distros is an easier starting point. For example, on [UbuntuInstallation Ubuntu] many of the dependencies are either pre-installed or readily available via the synaptic package manager. Macports and Fink hypothetically offer similar convience but conflicts between local source installs and port/fink installs are pita's for mapnik mac users.
|
||||||
|
|
||||||
|
* If you upgraded your core python (from the mac binary from python.org) and are trying to rebuild mapnik see this page [MacPython upgrade issues](/wiki:MacPythonUpgradeIssues/)
|
7
MacInstallation_Frameworks.md
Normal file
7
MacInstallation_Frameworks.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<!-- Name: MacInstallation/Frameworks -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2010/09/30 10:10:40 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Installing Mapnik on OS X with Framework Installers
|
||||||
|
|
||||||
|
Just see README inside the downloads at http://dbsgeo.com/downloads/
|
89
MacInstallation_Homebrew.md
Normal file
89
MacInstallation_Homebrew.md
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
<!-- Name: MacInstallation/Homebrew -->
|
||||||
|
<!-- Version: 6 -->
|
||||||
|
<!-- Last-Modified: 2011/05/20 14:50:02 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
# Installing Mapnik on OS X with Homebrew
|
||||||
|
|
||||||
|
|
||||||
|
## Install Homebrew
|
||||||
|
Install homebrew as per: http://github.com/mxcl/homebrew/wiki/installation
|
||||||
|
|
||||||
|
Basically do:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
curl -Lsf http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C/usr/local
|
||||||
|
brew install git
|
||||||
|
git clone http://github.com/mxcl/homebrew.git /tmp/homebrew
|
||||||
|
mv /tmp/homebrew/.git /usr/local/
|
||||||
|
rm -rf /tmp/homebrew
|
||||||
|
|
||||||
|
Yes, feel free to chmod /usr/local like:
|
||||||
|
|
||||||
|
|
||||||
|
sudo chown -R $USER /usr/local
|
||||||
|
|
||||||
|
*But be aware:* running chmod on /usr/local will break things like postgres installed via Kyngchaos in `/usr/local/pgsql`. You will see:
|
||||||
|
|
||||||
|
psql: could not connect to server: Connection refused
|
||||||
|
Is the server running locally and accepting
|
||||||
|
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
|
||||||
|
|
||||||
|
This can be fixed by simply re-installing postgres (which will fix permissions) from: http://www.kyngchaos.com/software/postgres
|
||||||
|
|
||||||
|
## Installing Mapnik 0.7.x via Homebrew
|
||||||
|
|
||||||
|
Simply type:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
brew install mapnik
|
||||||
|
|
||||||
|
Be aware that this will take a long time - hours maybe. The main reason is that homebrew installs *many* boost libraries that mapnik does not need and mapnik will not start building until boost is done.
|
||||||
|
|
||||||
|
## Installing Mapnik 2.0 via Homebrew
|
||||||
|
|
||||||
|
Homebrew only provides mapnik 0.7.x currently, so to install mapnik2 we need to create a new "formula".
|
||||||
|
|
||||||
|
Assuming that your homebrew installation is standard and in `/usr/local/Library' then just do this:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
wget https://gist.github.com/raw/983887/mapnik2.rb -O /usr/local/Library/Formula/mapnik2.rb
|
||||||
|
|
||||||
|
Then do:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
brew install mapnik2
|
||||||
|
|
||||||
|
Or you could copy the mapnik2.rb formula and apply a simple patch to it:
|
||||||
|
|
||||||
|
|
||||||
|
#!diff
|
||||||
|
diff --git a/Library/Formula/mapnik.rb b/Library/Formula/mapnik.rb
|
||||||
|
index 04be7b7..e160920 100644
|
||||||
|
--- a/Library/Formula/mapnik.rb
|
||||||
|
+++ b/Library/Formula/mapnik.rb
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
require 'formula'
|
||||||
|
|
||||||
|
-class Mapnik < Formula
|
||||||
|
- url 'http://download.berlios.de/mapnik/mapnik-0.7.1.tar.gz'
|
||||||
|
+class Mapnik2 < Formula
|
||||||
|
+ head 'http://svn.mapnik.org/trunk/', :using => :svn
|
||||||
|
homepage 'http://www.mapnik.org/'
|
||||||
|
md5 '3a070fdd7c6a3367ad78d95c2387b03b'
|
||||||
|
|
||||||
|
@@ -17,11 +17,6 @@ class Mapnik < Formula
|
||||||
|
def install
|
||||||
|
ENV.x11 # for freetype-config
|
||||||
|
|
||||||
|
- # Allow compilation against boost 1.46
|
||||||
|
- inreplace ["src/datasource_cache.cpp", "src/libxml2_loader.cpp", "src/load_map.cpp", "
|
||||||
|
- "#include <boost/filesystem/operations.hpp>",
|
||||||
|
- "#define BOOST_FILESYSTEM_VERSION 2\n#include <boost/filesystem/operations.hpp>"
|
||||||
|
-
|
||||||
|
icu = Formula.factory("icu4c")
|
||||||
|
system "scons",
|
||||||
|
"PREFIX=#{prefix}",
|
91
MacInstallation_Optional.md
Normal file
91
MacInstallation_Optional.md
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<!-- Name: MacInstallation/Optional -->
|
||||||
|
<!-- Version: 10 -->
|
||||||
|
<!-- Last-Modified: 2009/10/12 16:43:17 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Optional Installs
|
||||||
|
|
||||||
|
* The $ indicates a normal command prompt in the shell.
|
||||||
|
* The # indicates a command that likely needs to be run by a superuser.
|
||||||
|
* The ## indicates code comments that are not executed.
|
||||||
|
|
||||||
|
You may install Proj.4, PostgreSQL/PostGIS, and GDAL if needed.
|
||||||
|
|
||||||
|
* *Proj.4 and Datum data* from source
|
||||||
|
|
||||||
|
$ wget ftp://ftp.remotesensing.org/proj/proj-4.6.1.tar.gz
|
||||||
|
$ wget ftp://ftp.remotesensing.org/proj/proj-datumgrid-1.4.tar.gz
|
||||||
|
* Extract the datum files into the main source code and build:
|
||||||
|
|
||||||
|
$ tar xzf proj-4.6.1.tar.gz
|
||||||
|
$ cd proj-4.6.1/nad
|
||||||
|
$ tar xzf ../../proj-datumgrid-1.4.tar.gz
|
||||||
|
$ cd ../
|
||||||
|
$ ./configure
|
||||||
|
$ make
|
||||||
|
# make install
|
||||||
|
$ cd ../
|
||||||
|
|
||||||
|
* *PostgreSQL and PostGIS* binaries - use [kyngchaos.com](http://www.kyngchaos.com/wiki/software:postgres) or from source:
|
||||||
|
* You can build PostgreSQL from source just like any other linux/unix system - [Postgres Docs](http://www.postgresql.org/docs/8.3/interactive/install-procedure.html)
|
||||||
|
* Next build PostGIS source (Install GEOS first if you wish to use Spatial Operations in Postgis separately - [http://code.djangoproject.com/wiki/GeoDjangoInstall#GEOS])
|
||||||
|
|
||||||
|
$ wget http://postgis.refractions.net/download/postgis-1.3.4.tar.gz
|
||||||
|
$ tar xzf postgis-1.3.4.tar.gz
|
||||||
|
$ cd postgis-1.3.4
|
||||||
|
$ ./configure --with-geos --with-proj # these flags are recommend but not needed for Mapnik
|
||||||
|
$ make
|
||||||
|
# make install
|
||||||
|
|
||||||
|
* Alternatively, you may install PostgreSQL and PostGIS using MacPorts. First, run
|
||||||
|
|
||||||
|
$ sudo port install postgresql83
|
||||||
|
$ sudo port install postgis
|
||||||
|
* Next, modify the SConstruct file to point to the libraries and header files installed by port. Change the lines that list PGSQL to:
|
||||||
|
|
||||||
|
opts.Add(PathOption('PGSQL_INCLUDES', 'Search path for PostgreSQL include files', '/opt/local/include/postgresql83'))
|
||||||
|
opts.Add(PathOption('PGSQL_LIBS', 'Search path for PostgreSQL library files', '/opt/local/lib/postgresql83'))
|
||||||
|
* See [wiki:MacPostGIS_Setup] for setup instructions.
|
||||||
|
* *GDAL* binary frameworks - use [kyngchaos.com](http://www.kyngchaos.com/wiki/software:frameworks) or build from source:
|
||||||
|
|
||||||
|
$ wget http://download.osgeo.org/gdal/gdal-1.5.0.tar.gz
|
||||||
|
$ tar xzf gdal-1.5.0.tar.gz
|
||||||
|
$ cd gdal-1.5.0
|
||||||
|
$ ./configure # --with-package (lots of available options here to support various raster formats)
|
||||||
|
$ make
|
||||||
|
# make install
|
||||||
|
|
||||||
|
### Install WMS dependencies
|
||||||
|
|
||||||
|
Install the Mapnik WMS dependencies if you wish to use the WMS (Web Mapping Service) server (Otherwise optional).
|
||||||
|
|
||||||
|
* More details in the [source:trunk/docs/ogcserver/readme.txt WMS Readme] in SVN
|
||||||
|
|
||||||
|
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
|
||||||
|
tar xvf libxml2-2.7.6.tar.gz
|
||||||
|
cd libxml2-2.7.6
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
cd ../
|
||||||
|
|
||||||
|
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
|
||||||
|
tar xvf libxslt-1.1.26.tar.gz
|
||||||
|
cd libxslt-1.1.26
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
|
||||||
|
# easy_install lxml
|
||||||
|
|
||||||
|
$ tar xzvf Imaging-1.1.6.tar.gz
|
||||||
|
$ cd Imaging-1.1.6
|
||||||
|
# python setup.py install
|
||||||
|
|
||||||
|
You'll need either mod_fastcgi or mod_fcgid installed within apache.
|
||||||
|
* FastCGI install notes are here: http://blog.cleverelephant.ca/2008/05/fastcgi-on-osx-leopard.html
|
||||||
|
* Fcgid install notes are here: http://blog.brandonking.net//2008/01/django-app-modfcgid-apache-2-setup-on.html/
|
||||||
|
* TODO FastCGI/mod_fcgi example installation
|
||||||
|
* TODO PostGIS from kyngchaos setup instructions for mapnik
|
||||||
|
|
373
MacInstallation_Source.md
Normal file
373
MacInstallation_Source.md
Normal file
|
@ -0,0 +1,373 @@
|
||||||
|
<!-- Name: MacInstallation/Source -->
|
||||||
|
<!-- Version: 4 -->
|
||||||
|
<!-- Last-Modified: 2010/11/02 06:37:18 -->
|
||||||
|
<!-- Author: willwhite -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# Installing Mapnik on OS X from Source
|
||||||
|
|
||||||
|
Detailed notes for installing from source are below.
|
||||||
|
|
||||||
|
There are *three main routes* for getting Mapnik installed on Mac OS X.
|
||||||
|
|
||||||
|
*Please* take a moment to decide which one fits you best.
|
||||||
|
|
||||||
|
|| *Route A - Option 1* || _Easiest_ -> Recommended for users *new to Python* or users already using Python26 from Macports. ||
|
||||||
|
|| *Route A - Option 2* || _Hardest_ -> Recommended for advanced users already using Python26 from Macports. ||
|
||||||
|
|| *Route B* || _Moderate_ -> Recommended for users who actively using the Python that came pre-installed with Leopard.||
|
||||||
|
|| *Route C* || _Moderate_ -> Recommended for users who are running Python installed from python.org.||
|
||||||
|
|
||||||
|
*Hint*: open Terminal.app and type:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ which python
|
||||||
|
* This will give the path to the python executable
|
||||||
|
* '/opt/local...' means you are using Macports Python
|
||||||
|
* /System/... means you are using the python pre-installed by Apple
|
||||||
|
* /Library/... means you are likely using MacPython from http://python.org
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
[[Image(http://trac.mapnik.org/raw-attachment/wiki/MacInstallation/mapnik_on_mac_os.png)]]
|
||||||
|
|
||||||
|
# Step 1: Install Xcode
|
||||||
|
|
||||||
|
First make sure you have XCode installed.
|
||||||
|
* XCode comes as an optional Installer on Leopard Install Discs
|
||||||
|
* If your CD contains at least version 3.1, you can use the CD installer, otherwise download from ADN
|
||||||
|
|
||||||
|
*Recommended*: The latest version of XCode can be downloaded from the Apple Developer Network (ADN) site
|
||||||
|
* [ADN](http://developer.apple.com/technology/Xcode.html) (~900 MB, requires registering with Apple)
|
||||||
|
* Either the iPhone SDK or XCode can be used.
|
||||||
|
|
||||||
|
# Step 2: Install Macports
|
||||||
|
|
||||||
|
No matter what route you take you'll likely want [Macports](http://www.macports.org/install.php) installed.
|
||||||
|
* Look for the latest dmg: [Current version is 1.8.1](http://www.macports.org/install.php)
|
||||||
|
* Nice [overview article by Apple](http://developer.apple.com/mac/articles/opensource/workingwithmacports.html)
|
||||||
|
|
||||||
|
|
||||||
|
Check your Macports Installation:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ port # should take you into 'interactive mode'
|
||||||
|
> quit # to leave...
|
||||||
|
* If the port command is not available then you'll need to add this to your ~/.profile hidden file
|
||||||
|
|
||||||
|
'export PATH=/opt/local/bin:/opt/local/sbin:$PATH'
|
||||||
|
|
||||||
|
# Step 3: Choose your Route, then begin...
|
||||||
|
|
||||||
|
## Route A
|
||||||
|
|
||||||
|
Update Macports
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
sudo port selfupdate
|
||||||
|
* This will fetch the latest port updates in addition to *syncing* with the remote repository.
|
||||||
|
* If this command fails try:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
sudo port sync
|
||||||
|
|
||||||
|
Install Python 26
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ sudo port install python26 python_select # will take ~ 1 hour
|
||||||
|
* Note: If you are on a dual-core or quad-core machine use the extra argument ['build.jobs=N'](http://trac.macports.org/wiki/howto/ParallelBuilding) to speed up Macports.
|
||||||
|
* The above command on a quad-core machine would be:
|
||||||
|
|
||||||
|
$ sudo port install python26 python_select build.jobs=4
|
||||||
|
|
||||||
|
Switch to using the Macports Python26 (if you are not already using it)
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ sudo python_select python26 # switch to using Macports python just installed
|
||||||
|
|
||||||
|
Install core Mapnik dependencies
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ sudo port install boost +python26 icu libpng jpeg libgeotiff libxml2 freetype # go for a long walk!
|
||||||
|
* *Note*: The '+' invokes a certain boost variant that includes boost-python (which is needed for mapnik's python bindings). The trick is that this requires Macports downloading its own version of python26. This behavior *REQUIRES* you to switch to using the macports version of PYTHON for building mapnik otherwise you will get a 'VERSION MISMATCH' error when you are trying to `>>> import mapnik' because the boost python bindings are built against a different version of python than the interpreter you are running.
|
||||||
|
|
||||||
|
*Optional*: Install extra libraries needed *only* if you want to read custom formats (other than shapefiles) or make maps in PDF/SVG formats
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ sudo port install sqlite3 gdal postgresql83-server postgresql83 postgis cairo cairomm py26-cairo
|
||||||
|
* *Note*: if postgis fails with
|
||||||
|
|
||||||
|
Error: Checksum (sha1) mismatch for postgis-1.3.3.tar.gz
|
||||||
|
Error: Target org.macports.checksum returned: Unable to verify file checksums
|
||||||
|
Error: Status 1 encountered during processing.
|
||||||
|
|
||||||
|
Then we can update the portfile locally to patch the problem
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$cd `port dir postgis`
|
||||||
|
$sudo cp Portfile Portfile.orig
|
||||||
|
$port edit postgis
|
||||||
|
Change line 23 of the port file to:
|
||||||
|
|
||||||
|
checksums sha1 665abd2869e5c59140ed30c20ba1970ea3880fd4"
|
||||||
|
|
||||||
|
|
||||||
|
## Route A | Option 1 - Install Mapnik Port
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ port info py26-mapnik # get options for install, for example +gdal +postgis are needed to get gdal and postgis support
|
||||||
|
$ sudo port -d install py26-mapnik +postgis +gdal +cairo # -d turns on debug mode (send any errors to mapnik-users list)
|
||||||
|
* Note: if you want to see how the *py26-mapnik* portfile works [check out the source](http://www.macports.org/ports.php?by=name&substr=mapnik).
|
||||||
|
|
||||||
|
Then do:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python
|
||||||
|
>>> import mapnik # if no errors, you're good, your're done, wahoo!
|
||||||
|
|
||||||
|
If you get a 'VERSION MISMATCH' this likely means that the 'boost_python.dylib' library (installed by the boost +python26 port) was linked wrong and unfortunately, is a common and re-occurring macports bug (http://trac.macports.org/ticket/21444).
|
||||||
|
|
||||||
|
In english, that means that Apple provides a copy of python and so does macports, which confuses the heck out of boost python.
|
||||||
|
|
||||||
|
On snow leopard, usually this exact command fixes the problem:
|
||||||
|
|
||||||
|
sudo install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.6/Python /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python /opt/local/lib/libboost_python-mt.dylib
|
||||||
|
|
||||||
|
If that does not fix the problem, please email the mapnik-users list for further assistance and provide the output of:
|
||||||
|
|
||||||
|
otool -L /opt/local/lib/libboost_python*
|
||||||
|
otool -L /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mapnik/_mapnik.so
|
||||||
|
|
||||||
|
## Route A | Option 2 - Install Mapnik Latest release from source
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ svn co http://svn.mapnik.org/tags/release-0.7.1/ mapnik
|
||||||
|
$ cd mapnik
|
||||||
|
$ touch config.py # create a blank python file...
|
||||||
|
$ open config.py # to edit in your favorite text editor...
|
||||||
|
|
||||||
|
Copy and paste all this text into that 'config.py' file:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
# config.py file that sits in mapnik source directory
|
||||||
|
BOOST_INCLUDES = '/opt/local/include'
|
||||||
|
BOOST_LIBS = '/opt/local/lib'
|
||||||
|
FREETYPE_CONFIG = '/opt/local/bin/freetype-config'
|
||||||
|
XML2_CONFIG = '/opt/local/bin/xml2-config'
|
||||||
|
ICU_INCLUDES = '/opt/local/include'
|
||||||
|
ICU_LIBS = '/opt/local/lib'
|
||||||
|
PNG_INCLUDES = '/opt/local/include'
|
||||||
|
PNG_LIBS = '/opt/local/lib'
|
||||||
|
JPEG_INCLUDES = '/opt/local/include'
|
||||||
|
JPEG_LIBS = '/opt/local/lib'
|
||||||
|
TIFF_INCLUDES = '/opt/local/include'
|
||||||
|
TIFF_LIBS = '/opt/local/lib'
|
||||||
|
PROJ_INCLUDES = '/opt/local/include'
|
||||||
|
PROJ_LIBS = '/opt/local/lib'
|
||||||
|
GDAL_CONFIG = '/opt/local/bin/gdal-config'
|
||||||
|
PG_CONFIG = '/opt/local/lib/postgresql83/bin/pg_config'
|
||||||
|
SQLITE_INCLUDES = '/opt/local/include'
|
||||||
|
SQLITE_LIBS = '/opt/local/lib'
|
||||||
|
FRAMEWORK_PYTHON = False
|
||||||
|
INPUT_PLUGINS = 'gdal,ogr,postgis,raster,shape,sqlite'
|
||||||
|
# or use...
|
||||||
|
# INPUT_PLUGINS = 'all'
|
||||||
|
|
||||||
|
Configure and Install Mapnik
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ cd mapnik # make sure you are inside the source dir
|
||||||
|
$ python scons/scons.py configure
|
||||||
|
$ python scons/scons.py
|
||||||
|
$ sudo python scons/scons.py install
|
||||||
|
|
||||||
|
* Note: if *pycairo* is not found during the configure step you need to add a non standard path to PKG_CONFIG_PATH
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ port contents py26-cairo | grep .pc
|
||||||
|
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/pkgconfig/pycairo.pc
|
||||||
|
$ export PKG_CONFIG_PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/pkgconfig/
|
||||||
|
Then rerun the configure step.
|
||||||
|
|
||||||
|
If the configure step fails or is interrupted, stale dependency tests can be left over in a directory called .sconf_temp. This can cause future configure attempts to fail. If you're experiencing problems, look for this folder and remove it.
|
||||||
|
|
||||||
|
## Route B and C
|
||||||
|
|
||||||
|
These two routes are essentially the same, just make sure:
|
||||||
|
* You know which Python Version you are using
|
||||||
|
* The 'python_select' tool from macports is handy for switching between the macports python and the system python (python 25)
|
||||||
|
* If you have used different versions of Python in the past you should confirm that you have edited your PYTHONPATH correctly to point to the correct site-packages or other needed locations
|
||||||
|
* Edit PYTHONPATH in your ~/.bash_profile (for user) or /etc/profile (for all users)
|
||||||
|
* Use the FRAMEWORK_SEARCH_PATH = '/Library/Frameworks/Python.framework/Versions/2.6/' option to link against Python26 installed from python.org
|
||||||
|
|
||||||
|
|
||||||
|
## Step 1: Route B/C
|
||||||
|
|
||||||
|
Install Latest Boost from source
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
curl -O http://voxel.dl.sourceforge.net/project/boost/boost/1.42.0/boost_1_42_0.tar.bz2
|
||||||
|
tar xjvf boost_1_42_0.tar.bz2
|
||||||
|
cd boost_1_42_0
|
||||||
|
export BOOST=`pwd`
|
||||||
|
cd tools/jam/src
|
||||||
|
./build.sh darwin
|
||||||
|
cd bin.macosxx*
|
||||||
|
export PATH=`pwd`:$PATH
|
||||||
|
cd $BOOST
|
||||||
|
|
||||||
|
Finally, then compile boost with `bjam`
|
||||||
|
|
||||||
|
Note: newer macs with 64 bit fireware will default to 64 bit libraries, or x86_64 arch. It is recommended to build boost multi-arch (both 32 and 64 bit to avoid potential problems later on)
|
||||||
|
|
||||||
|
If you don't want to build both 32 and 64 bit and would rather stick with the single default arch of your compiler remove the below 'address-model' and 'architecture' flags.
|
||||||
|
|
||||||
|
|
||||||
|
bjam --with-python \
|
||||||
|
--with-thread --with-filesystem \
|
||||||
|
--with-iostreams --with-regex \
|
||||||
|
--with-program_options --with-system \
|
||||||
|
toolset=darwin \
|
||||||
|
address-model=32_64 \
|
||||||
|
architecture=x86 \
|
||||||
|
stage
|
||||||
|
|
||||||
|
sudo bjam --with-python \
|
||||||
|
--with-thread --with-filesystem \
|
||||||
|
--with-iostreams --with-regex \
|
||||||
|
--with-program_options --with-system \
|
||||||
|
toolset=darwin \
|
||||||
|
address-model=32_64 \
|
||||||
|
architecture=x86 \
|
||||||
|
install
|
||||||
|
|
||||||
|
Note: to build boost_regex with icu support you need to pass `-sHAVE_ICU=1`
|
||||||
|
To rebuild just boost regex do:
|
||||||
|
{{{
|
||||||
|
sudo bjam --with-regex \
|
||||||
|
toolset=darwin \
|
||||||
|
-sHAVE_ICU=1 -sICU_PATH=/opt/local \
|
||||||
|
-a install
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Install remaining dependencies from either Macports, [Kyngchaos Frameworks](http://www.kyngchaos.com/wiki/software:frameworks), or from source.
|
||||||
|
|
||||||
|
* For dependencies via Macports (other than python and boost) see Route A above.
|
||||||
|
* For Kyngchaos installs:
|
||||||
|
* Proj4/SQLite/Freetype/UnixImageIO/GDAL from: http://www.kyngchaos.com/wiki/software:frameworks
|
||||||
|
* And PostGIS/Postgres from http://www.kyngchaos.com/software:postgres
|
||||||
|
* For Source installs see MacInstallationSource
|
||||||
|
|
||||||
|
Then download, configure, and install Mapnik:
|
||||||
|
|
||||||
|
Grab from latest release:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ curl -O http://download.berlios.de/mapnik/mapnik-0.7.1.tar.bz2
|
||||||
|
$ tar xjvf mapnik-0.7.1.tar.bz2
|
||||||
|
$ cd mapnik-0.7.1
|
||||||
|
|
||||||
|
Or grab latest release from subversion:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ svn co http://svn.mapnik.org/tags/release-0.7.1/ mapnik
|
||||||
|
$ cd mapnik
|
||||||
|
|
||||||
|
Edit your 'config.py':
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ touch config.py
|
||||||
|
$ open config.py
|
||||||
|
|
||||||
|
* Mapnik uses `SCons` to find dependencies, a next-generation `make` (see UsingScons for more info).
|
||||||
|
* MacPorts installs libraries into `/opt/` while SCons by default expects dependencies in `/usr/`
|
||||||
|
* Anything installed by Macports or Kygnchaos will need custom paths in 'config.py'
|
||||||
|
|
||||||
|
Here is an example 'config.py':
|
||||||
|
|
||||||
|
#!python
|
||||||
|
# example config.py file
|
||||||
|
|
||||||
|
# Uncomment if you want to use Python26 from Python.org (option available in Mapnik >=0.6.1)
|
||||||
|
# FRAMEWORK_SEARCH_PATH = '/Library/Frameworks/'
|
||||||
|
# otherwise we'll link to the Apple provided Python
|
||||||
|
FRAMEWORK_SEARCH_PATH = '/System/Frameworks/'
|
||||||
|
|
||||||
|
# use lots of cores
|
||||||
|
JOBS = 4
|
||||||
|
|
||||||
|
# full compiler optimization
|
||||||
|
OPTIMIZATION = '3'
|
||||||
|
|
||||||
|
# build with debug output
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
# boost from source
|
||||||
|
BOOST_INCLUDES = '/usr/local/include/boost-1_39/'
|
||||||
|
BOOST_LIBS = '/usr/local/lib/'
|
||||||
|
BOOST_TOOLKIT = 'xgcc40'
|
||||||
|
|
||||||
|
# icu from macports
|
||||||
|
ICU_INCLUDES = '/opt/local/include'
|
||||||
|
ICU_LIBS = '/opt/local/lib'
|
||||||
|
|
||||||
|
# Imaging libs from Kyngchaos
|
||||||
|
PNG_INCLUDES = '/Library/Frameworks/UnixImageIO.framework/unix/include'
|
||||||
|
PNG_LIBS = '/Library/Frameworks/UnixImageIO.framework/unix/lib'
|
||||||
|
JPEG_INCLUDES = '/Library/Frameworks/UnixImageIO.framework/unix/include'
|
||||||
|
JPEG_LIBS = '/Library/Frameworks/UnixImageIO.framework/unix/lib'
|
||||||
|
TIFF_INCLUDES = '/Library/Frameworks/UnixImageIO.framework/unix/include'
|
||||||
|
TIFF_LIBS = '/Library/Frameworks/UnixImageIO.framework/unix/lib'
|
||||||
|
|
||||||
|
# SQLite from Kyngchaos
|
||||||
|
SQLITE_INCLUDES = '/Library/Frameworks/SQLite3.framework/unix/include'
|
||||||
|
SQLITE_LIBS = '/Library/Frameworks/SQLite3.framework/unix/lib'
|
||||||
|
|
||||||
|
# Proj4 from Kyngchaos
|
||||||
|
PROJ_LIBS = '/Library/Frameworks/PROJ.framework/unix/lib'
|
||||||
|
PROJ_INCLUDES = '/Library/Frameworks/PROJ.framework/unix/include'
|
||||||
|
|
||||||
|
# Freetype from Kyngchaos
|
||||||
|
FREETYPE_CONFIG='/Library/Frameworks/FreeType.framework/unix/bin/freetype-config'
|
||||||
|
|
||||||
|
# gdal/postgres/postgis from Kyngchaos
|
||||||
|
GDAL_CONFIG = '/Library/Frameworks/GDAL.framework/unix/bin/gdal-config'
|
||||||
|
PG_CONFIG = '/usr/local/pgsql/bin/pg_config'
|
||||||
|
INPUT_PLUGINS = 'gdal,ogr,postgis,raster,shape,sqlite'
|
||||||
|
# or use...
|
||||||
|
# INPUT_PLUGINS = 'all'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py configure DEBUG=True INPUT_PLUGINS='all' # any options provided on command line will OVERRIDE config.py options
|
||||||
|
$ python scons/scons.py
|
||||||
|
$ sudo python scons/scons.py install
|
||||||
|
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
If this works without error - Congrats and welcome to Mapnik on Mac OS!
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python
|
||||||
|
>>> import mapnik
|
||||||
|
registered datasource : gdal # this will only show up if you build with DEBUG=True
|
||||||
|
registered datasource : postgis # this will only show up if you build with DEBUG=True
|
||||||
|
registered datasource : raster # this will only show up if you build with DEBUG=True
|
||||||
|
registered datasource : shape # this will only show up if you build with DEBUG=True
|
||||||
|
>>> dir(mapnik) # This gets you a list of symbols
|
||||||
|
['BoostPythonMetaclass', 'Color', 'Coord', 'CreateDatasource', ...]
|
||||||
|
>>> help(mapnik)
|
||||||
|
|
||||||
|
Check out which libraries libmapnik.dylib has linked against:
|
||||||
|
* Freetype for example could have been linked to either `/opt/` or `/usr/`
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
otool -L /usr/local/lib/libmapnik.dylib
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
* Extended MacInstallationSource guide
|
||||||
|
* WORK IN PROGRESS: For _Optional_ dependencies (such as Cairo, GDAL, and PostGIS), also see the *out-of-date* MacInstallation/Optional
|
44
MacPostGIS_Setup.md
Normal file
44
MacPostGIS_Setup.md
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<!-- Name: MacPostGIS_Setup -->
|
||||||
|
<!-- Version: 4 -->
|
||||||
|
<!-- Last-Modified: 2008/11/10 13:47:55 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
## Mac PostGIS / Postgres Setup
|
||||||
|
|
||||||
|
After you have installed PostgreSQL and PostGIS you will need to perform further setup before you can begin to use them with mapnik.
|
||||||
|
* Setup for *Binaries/Frameworks* from [kyngchaos.com](http://www.kyngchaos.com/wiki/software:frameworks).
|
||||||
|
* Add the bin and man page directories to your path (assumes bash shell which is default on 10.5). You may create or append the ~/.profile with the following:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
export PATH=/usr/local/pgsql/bin:$PATH
|
||||||
|
export MANPATH=/usr/local/pgsql/man:$MANPATH
|
||||||
|
* Register your changes
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ source ~/.profile
|
||||||
|
You should now be able to type the following from any directory and see the man page.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ man psql
|
||||||
|
* Create a database. The installer you used from [kyngchaos.com](http://www.kyngchaos.com/wiki/software:frameworks) automatically created a Mac OS user on your system named postgres. Use that user to create a new database user/role and setup the database. (change "gisuser" to your liking)
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ sudo -u postgres -i
|
||||||
|
$ createuser gisuser
|
||||||
|
$ createdb -E UTF8 -O gisuser mapnik
|
||||||
|
$ createlang plpgsql mapnik
|
||||||
|
* Alternatively you can run all commands from your normal shell user but use the '-U' flag to call them as the postgres user:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ createdb -E UTF8 -U postgres <dbname>
|
||||||
|
$ createlang plpgsql -U postgres <dbname>
|
||||||
|
|
||||||
|
* PostGIS support must be enabled for each database that requires its usage. This is done by feeding the lwpostgis.sql (the enabler script) file to the target database.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ psql -d mapnik -f /usr/local/pgsql/share/lwpostgis.sql
|
||||||
|
$ psql -d mapnik -f /usr/local/pgsql/share/spatial_ref_sys.sql
|
||||||
|
$ echo "ALTER TABLE geometry_columns OWNER TO gisuser; ALTER TABLE spatial_ref_sys OWNER TO gisuser;" | psql -d mapnik
|
||||||
|
|
||||||
|
|
||||||
|
At this point your database should be setup to create a PostGIS table.
|
||||||
|
TODO - full example showing PostGIS use.
|
66
MacPythonUpgradeIssues.md
Normal file
66
MacPythonUpgradeIssues.md
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<!-- Name: MacPythonUpgradeIssues -->
|
||||||
|
<!-- Version: 4 -->
|
||||||
|
<!-- Last-Modified: 2009/02/05 10:01:35 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
If you have upgraded to the MacPython binary off python.org and rebuilt your boost libs from source (to match your new python version) you may encounter the "Fatal Python error: Interpreter not initialized (version mismatch?)" error.
|
||||||
|
|
||||||
|
* *Note*, as of version 1.35 Macports now automatically links its copy of boost its own copy of python. So, it is not possible to use boost built with Macports along with an upgraded python from MacPython/Python.org. If you wish to use Boost built from macports then use the `python-select` tool to switch your default version of python to the Macports version, then rebuild mapnik using that python. When installing a version of python with macports, it should output this hint:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
---> Activating python25 @2.5.4_0+darwin_9+macosx
|
||||||
|
|
||||||
|
To fully complete your installation and make python 2.5 the default, please run
|
||||||
|
|
||||||
|
sudo port install python_select
|
||||||
|
sudo python_select python25
|
||||||
|
|
||||||
|
The scenario goes as follows...
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ sudo python scons/scons.py TIFF_INCLUDES=/usr/local/include
|
||||||
|
JPEG_LIBS=/opt/local/lib JPEG_INCLUDES=/opt/local/include DEBUG=y
|
||||||
|
BOOST_LIBS=/usr/local/lib BOOST_INCLUDES=/usr/local/include/boost-1_35
|
||||||
|
|
||||||
|
Mapnik will build just fine with your new python installation will not complain but when importing you get
|
||||||
|
the "Fatal Python error: Interpreter not initialized (version
|
||||||
|
mismatch?)". Check to see what your _mapnik.so is linking against.
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ cd ~/src/mapnik
|
||||||
|
springmeyer:mapnik spring$ otool -L bindings/python/_mapnik.so | grep python
|
||||||
|
bindings/python/_mapnik.so:
|
||||||
|
/opt/local/lib/libboost_python-mt-1_35.dylib (compatibility version 0.0.0, current version 0.0.0)
|
||||||
|
|
||||||
|
If, like the above command result, you see that your mapnik module it linked against 'opt' (the macports dir), then either remove boost from macports or switch to the macports version of python. Even if you pointed the SCons path variables at a different version of boost, the SCons linker found the macports version because it was on the library path of another one of your dependencies (In the above example, the JPEG_LIBS).
|
||||||
|
|
||||||
|
The easiest solution is to uninstall boost from macports:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ sudo port uninstall boost
|
||||||
|
|
||||||
|
Also, make sure you do not have multiple installations of mapnik in several different site-packages locations.
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
locate _mapnik.so # should turn up only on install location
|
||||||
|
|
||||||
|
When you rebuild mapnik after uinstalling boost, mapnik will overwrite previous problematic libraries that were linked against the wrong version of boost, but only in the one place mapnik gets installed. So, hand remove any duplicated install locations.
|
||||||
|
|
||||||
|
|
||||||
|
Finally, follow the boost build instructions at MacInstallation and link up your boost libs. On leopard as of r738 the links in /usr/local/lib are:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ sudo ln -s libboost_system-mt-1_35.dylib libboost_system-mt.dylib
|
||||||
|
$ sudo ln -s libboost_filesystem-mt-1_35.dylib libboost_filesystem-mt.dylib
|
||||||
|
$ sudo ln -s libboost_regex-mt-1_35.dylib libboost_regex-mt.dylib
|
||||||
|
$ sudo ln -s libboost_iostreams-mt-1_35.dylib libboost_iostreams-mt.dylib
|
||||||
|
$ sudo ln -s libboost_program_options-mt-1_35.dylib
|
||||||
|
libboost_program_options-mt.dylib
|
||||||
|
$ sudo ln -s libboost_thread-mt-1_35.dylib libboost_thread-mt.dylib
|
||||||
|
$ sudo ln -s libboost_python-mt-1_35.dylib libboost_python-mt.dylib
|
||||||
|
|
||||||
|
From here you should be able to rebuild, reinstall and run mapnik from the interpreter without a problem.
|
320
ManagingLargeXmlFiles.md
Normal file
320
ManagingLargeXmlFiles.md
Normal file
|
@ -0,0 +1,320 @@
|
||||||
|
<!-- Name: ManagingLargeXmlFiles -->
|
||||||
|
<!-- Version: 11 -->
|
||||||
|
<!-- Last-Modified: 2010/07/17 10:06:46 -->
|
||||||
|
<!-- Author: oldtopos -->
|
||||||
|
# Managing complex map files using XML entities
|
||||||
|
|
||||||
|
[[PageOutline]]
|
||||||
|
|
||||||
|
Mapnik XML files can become quite complex. This tutorial introduces some
|
||||||
|
techniques to keep large map files more maintainable. Specifically it
|
||||||
|
demonstrates how to avoid duplicate data in the XML file, like:
|
||||||
|
- color values
|
||||||
|
- database connection parameters
|
||||||
|
- icon directories
|
||||||
|
|
||||||
|
It also shows how to split a single, monolithic map file into reusable
|
||||||
|
components using external entities and XInclude.
|
||||||
|
|
||||||
|
|
||||||
|
## Mapnik XML support
|
||||||
|
|
||||||
|
Mapnik currently supports three different XML parsers:
|
||||||
|
- the boost spirit based parser
|
||||||
|
- the tinyxml parser
|
||||||
|
- libxml2
|
||||||
|
The three parsers differ in size, external dependencies and the number of XML
|
||||||
|
features they support. The most comprehensive parser is the libxml2 parser and
|
||||||
|
it is the only one that supports XML entities. As of Mapnik 0.6.0 libxml2 is the default
|
||||||
|
when building the Mapnik source with SCons, and available in the Windows binaries as of 0.6.1.
|
||||||
|
|
||||||
|
|
||||||
|
## Compiling mapnik with libxml2 support
|
||||||
|
|
||||||
|
If not default in your Mapnik version (< 0.6.0) the libxml2 parser is enabled by setting the XMLPARSER option at
|
||||||
|
compile time:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py configure XMLPARSER=libxml2
|
||||||
|
|
||||||
|
Of course this requires the libxml2 library and, depending on the distribution
|
||||||
|
the corresponding devel package. If `xml2-config` is not in the PATH its location
|
||||||
|
can be set using the `XML2_CONFIG` option.
|
||||||
|
|
||||||
|
For example, if you have installed the latest libxml2 on mac os x via Macports, you might need to do:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ python scons/scons.py configure XML2_CONFIG=/opt/local/bin/xml2-config
|
||||||
|
|
||||||
|
|
||||||
|
## Internal Entities
|
||||||
|
|
||||||
|
All XML parsers have some built-in entities to escape otherwise illegal
|
||||||
|
characters:
|
||||||
|
- >
|
||||||
|
- <
|
||||||
|
- &
|
||||||
|
- "
|
||||||
|
- '
|
||||||
|
|
||||||
|
The XML document type definition (DTD) provides a way to declare new, user
|
||||||
|
defined entities:
|
||||||
|
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map[
|
||||||
|
<!ENTITY water_color "#b5d0d0">
|
||||||
|
]>
|
||||||
|
<Map bgcolor="&water_color;"/>
|
||||||
|
|
||||||
|
This XML document declares an internal entity named water_color. This entity is
|
||||||
|
referenced by the bgcolor attribute of the Map element. The parser replaces all
|
||||||
|
occurrences of `&water_color;` with the string `#b5d0d0`.
|
||||||
|
|
||||||
|
Using entities for common values results in a single point of definition. This
|
||||||
|
greatly improves maintainability. Instead of searching and replacing all
|
||||||
|
occurrences of a value, there is a single place to change it. By using names,
|
||||||
|
like water_color the XML becomes more readable which helps a lot with future
|
||||||
|
changes. In case of color values it has an additional benefit. Because all
|
||||||
|
entities are declared at the top of the document the color set of the map is
|
||||||
|
immediately apparent. Of course color values are not the only application. Any
|
||||||
|
reoccurring value is a candidate for an entity.
|
||||||
|
|
||||||
|
It is allowed to nest entities:
|
||||||
|
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map[
|
||||||
|
<!ENTITY home_dir "/home/david">
|
||||||
|
<!ENTITY icons "&home_dir;/map/icons">
|
||||||
|
]>
|
||||||
|
<Map>
|
||||||
|
<Style name="volcanos">
|
||||||
|
<Rule>
|
||||||
|
<PointSymbolizer file="&icons;/volcano.png"
|
||||||
|
type="png" width="16" height="16"/>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
However, these internal entities are not suitable for larger blocks. They also
|
||||||
|
do not help with sharing common styles and layers between different maps.
|
||||||
|
|
||||||
|
|
||||||
|
## External Entities
|
||||||
|
|
||||||
|
External entities are declared by adding the keyword SYSTEM:
|
||||||
|
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map[
|
||||||
|
<!ENTITY db_settings SYSTEM "settings/db_settings">
|
||||||
|
]>
|
||||||
|
<Map>
|
||||||
|
<Layer name="volcanos" status="on">
|
||||||
|
<StyleName>volcanos</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
|
||||||
|
<Parameter name="table">volcanos</Parameter>
|
||||||
|
|
||||||
|
&db_settings;
|
||||||
|
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
The entity declaration assigns the content of the file `settings/db_settings` to
|
||||||
|
the entity `&db_settings;`. When parsed the reference to `&db_settings;` in the
|
||||||
|
Datasource section is expanded to the content of the file. If a relative
|
||||||
|
filename is given the file is searched relative to the document. The file
|
||||||
|
`settings/db_settings` could look like this:
|
||||||
|
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<Parameter name="type">postgis</Parameter>
|
||||||
|
<Parameter name="host">www.example.org</Parameter>
|
||||||
|
<Parameter name="port">5433</Parameter>
|
||||||
|
<Parameter name="user">david</Parameter>
|
||||||
|
<Parameter name="dbname">geo</Parameter>
|
||||||
|
|
||||||
|
Note that this is not a legal XML document on its own because it does not have
|
||||||
|
a single root element. It is a list of elements. But the tags have to be well
|
||||||
|
balanced. Also note that references to external entities are illegal in
|
||||||
|
attribute values. They are only allowed in text sections.
|
||||||
|
|
||||||
|
It is possible to use entity references in external entities. This allows a
|
||||||
|
limited form of parameterization. Consider the following example:
|
||||||
|
|
||||||
|
File earthquake.map:
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map[
|
||||||
|
<!ENTITY since_year "1970">
|
||||||
|
<!ENTITY earthquakes_since SYSTEM "earthquakes_since.lay">
|
||||||
|
|
||||||
|
<!ENTITY earthquakes_default_style SYSTEM "earthquakes.sty">
|
||||||
|
<!ENTITY common_styles SYSTEM "common.sty">
|
||||||
|
<!ENTITY common_layers SYSTEM "common.lay">
|
||||||
|
<!ENTITY db_settings SYSTEM "db_settings">
|
||||||
|
|
||||||
|
<!-- colors -->
|
||||||
|
]>
|
||||||
|
<Map>
|
||||||
|
&earthquakes_default_style;
|
||||||
|
|
||||||
|
&earthquakes_since;
|
||||||
|
|
||||||
|
&common_styles;
|
||||||
|
&common_layers;
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
File earthquakes_since.lay:
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<Layer name="earthquakes_since" status="on">
|
||||||
|
<StyleName>earthquakes</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
|
||||||
|
<Parameter name="table">
|
||||||
|
(SELECT * FROM earthquakes
|
||||||
|
WHERE year >= &since_year; ) AS earthquakes_since
|
||||||
|
</Parameter>
|
||||||
|
|
||||||
|
&db_settings;
|
||||||
|
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
This is a quite flexible setup. It is very easy to add and remove thematic
|
||||||
|
overlays. Other overlays may use the same parameters by referencing the
|
||||||
|
same entities. Styles can be changed by replacing the reference to
|
||||||
|
`&earthquakes_default_style;` with a custom one. It is also possible to have
|
||||||
|
many map files all referencing the same set of styles and layer files but with
|
||||||
|
different settings.
|
||||||
|
|
||||||
|
|
||||||
|
## Entities Summary
|
||||||
|
|
||||||
|
Entities provide a way to use symbolic names in the map file. This improves
|
||||||
|
readability and helps to build logical groups. By providing a single point
|
||||||
|
of definition map files are better adaptable to different environments and in
|
||||||
|
general more maintainable. External entities can store whole blocks of XML.
|
||||||
|
This helps to build reusable collections of layers and styles. These reusable
|
||||||
|
components can be parameterized using other entities as needed.
|
||||||
|
|
||||||
|
|
||||||
|
## Including external files using XInclude
|
||||||
|
|
||||||
|
libxml2 also provides support for decomposing large mapnik XML files through the use of XInclude.
|
||||||
|
|
||||||
|
To enable XInclude in your root file, modify the Map container tag, adding the xi namespace. Adding xi:include tags where the href attribute names the file to include completes the change to the root file.
|
||||||
|
|
||||||
|
File tests/data/good_maps/xinclude/map.xml:
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map >
|
||||||
|
<Map xmlns:xi="http://www.w3.org/2001/XInclude" srs="+init=epsg:4326" bgcolor="rgb(255,255,255)" >
|
||||||
|
|
||||||
|
<!-- http://www.oreillynet.com/xml/blog/2004/05/transclude_with_xinclude_and_x.html -->
|
||||||
|
|
||||||
|
<xi:include href="styles.xml" />
|
||||||
|
|
||||||
|
<xi:include href="layers.xml" />
|
||||||
|
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
Included files wrap their content within an Include tag. XInclude replaces the xi:include tags with the contents of the included file, yielding a single, merged XML document.
|
||||||
|
mapnik's XML parser then merges the contents of the Include tag into the Map tag, resulting in an XML document tree identical to one produced by processing a single file containing
|
||||||
|
all Style and Layer tags.
|
||||||
|
|
||||||
|
File styles.xml:
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Include xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
|
||||||
|
<Style name="point_style">
|
||||||
|
<Rule>
|
||||||
|
<PointSymbolizer file="../../svg/point.svg"/>
|
||||||
|
<TextSymbolizer face_name="DejaVu Sans Book" size="12" name="[name]" halo_fill="rgb(255,255,255,100)" halo_radius="1" dy="-5"/>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style name="world_borders_style">
|
||||||
|
<Rule>
|
||||||
|
<PolygonSymbolizer fill="grey" gamma="0.7"/>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</Include>
|
||||||
|
|
||||||
|
File layers.xml:
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Include xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
|
||||||
|
<Layer name="world_borders" srs="+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs">
|
||||||
|
<StyleName>world_borders_style</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="file">../../shp/world_merc.shp</Parameter>
|
||||||
|
<Parameter name="type">shape</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
</Include>
|
||||||
|
|
||||||
|
## Combining XInclude and External Entities
|
||||||
|
|
||||||
|
Used together, XInclude and External Entities provide improved document size management and parameterization, greatly reducing maintenance effort.
|
||||||
|
|
||||||
|
A common pattern found in mapnik XML file sets is specifying the zoom levels for which a Style or Layer is enabled. Creating an external entity file assigning symbolic names to the minimum and maximum scale denominators for each zoom level increases readability. A fragment of such a file is shown below:
|
||||||
|
|
||||||
|
file: zoomsymbols.txt
|
||||||
|
|
||||||
|
#!text/html
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!ENTITY zoom00max "750000000" >
|
||||||
|
<!ENTITY zoom00min "540000000" >
|
||||||
|
|
||||||
|
<!ENTITY zoom01max "500000000" >
|
||||||
|
<!ENTITY zoom01min "270000000" >
|
||||||
|
|
||||||
|
<!ENTITY zoom02max "250000000" >
|
||||||
|
<!ENTITY zoom02min "130000000" >
|
||||||
|
|
||||||
|
|
||||||
|
Adding a DOCTYPE line to the layers.xml file to include the external entities file, and adding parameterized minzoom and maxzoom attributes to the layer yields the file below:
|
||||||
|
|
||||||
|
|
||||||
|
File layers_with_entities.xml:
|
||||||
|
|
||||||
|
#!text/xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Include SYSTEM "zoomsymbols.txt">
|
||||||
|
|
||||||
|
<Include xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
|
||||||
|
<Layer name="world_borders" minzoom="&zoom02min;" maxzoom="&zoom00max;" srs="+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs">
|
||||||
|
<StyleName>world_borders_style</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="file">../../shp/world_merc.shp</Parameter>
|
||||||
|
<Parameter name="type">shape</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
</Include>
|
||||||
|
|
||||||
|
## Further Reading
|
||||||
|
- [http://www.xml.com/pub/a/98/08/xmlqna0.html XML.com entity tutorial ]
|
||||||
|
- [http://www.w3.org/TR/REC-xml/ W3C XML Standard]
|
||||||
|
- [http://www.w3.org/TR/xinclude/ W3C XInclude Standard]
|
||||||
|
- [http://en.wikipedia.org/wiki/XInclude Wikipedia XInclude Page]
|
32
MapDesign.md
Normal file
32
MapDesign.md
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!-- Name: MapDesign -->
|
||||||
|
<!-- Version: 4 -->
|
||||||
|
<!-- Last-Modified: 2009/04/07 10:49:37 -->
|
||||||
|
<!-- Author: Ldp -->
|
||||||
|
Mapnik offers a base level of functionality which can be used to design great looking maps.
|
||||||
|
|
||||||
|
*Finding map data*
|
||||||
|
|
||||||
|
First, you'll need some data. Mapnik [can currently read](http://mapnik.org/faq/) ESRI Shapefiles, TIFF image files, and can query the PostGIS spatial database. It can also read all OGR and GDAL supported vector and raster datasets.
|
||||||
|
|
||||||
|
[Shapefiles](http://en.wikipedia.org/wiki/Shapefile) can be downloaded for many locations in the world (for example, data from the [nationalatlas.gov](http://www.nationalatlas.gov/atlasftp.html) or USGS is freely available). Furthermore, Mapnik is one of the key rendering engines used to render the [OpenStreetMap.org](http://openstreetmap.org/) project. While the OpenStreetMap project offers XML dumps of their datasets, it takes some work to configure a rendering pipeline to draw the entire world.
|
||||||
|
|
||||||
|
*Making use of Mapnik*
|
||||||
|
|
||||||
|
There are three major ways of using Mapnik. You can use Mapnik as a library from C++ code, you can write Python scripts, and/or you can write XML configuration files which are then processed by Mapnik. Or, you can use a mix of these! Check out the ExampleCode page for more details.
|
||||||
|
|
||||||
|
*Mapnik Data Model*
|
||||||
|
|
||||||
|
The basic Mapnik object is the Map. Other important objects include _Layers, Filters, Features, Symbolizers,_ and _Geometry_.
|
||||||
|
|
||||||
|
Mapnik users typically only deal with Map Layers, Filters, Rules, and Symbolizers. Whereas Filters and Rules serve as predicates that determine _when_ geometric features are displayed, Mapnik Symbolizers take input data and turn them into graphical form, whether as Points, Lines, Polygons, Raster Images, or Textual Labels.
|
||||||
|
|
||||||
|
For more information on Symbolizers, Filters, and Rules, see SymbologySupport.
|
||||||
|
|
||||||
|
Internally, a mapnik Map object may have multiple Layers, where each Layer should have a reference to a Datasource (mapnik::datasource_ptr). A typical Datasource (for example, a Shapefile Datasource, an in-memory Datasource, or a Raster Datasource) has multiple features.
|
||||||
|
|
||||||
|
(To get access to the fundamental Map geometry, one can query a Map Layer's datasource by passing it a mapnik::query, specifying the
|
||||||
|
axis-aligned bounding box, or "Envelope".)
|
||||||
|
|
||||||
|
*Rendering with Mapnik*
|
||||||
|
|
||||||
|
As mentioned on SymbologySupport and Michal's blog post, [making sense of Mapnik](http://mike.teczno.com/notes/mapnik.html), order matters when using Mapnik to render maps. It uses the [Painter's algorithm](http://en.wikipedia.org/wiki/Painter's_algorithm) to determine Z-ordering, that is, layers are drawn in a specific order, and the "top" layer is drawn last, above all others.
|
242
Mapnik2.md
Normal file
242
Mapnik2.md
Normal file
|
@ -0,0 +1,242 @@
|
||||||
|
<!-- Name: Mapnik2 -->
|
||||||
|
<!-- Version: 64 -->
|
||||||
|
<!-- Last-Modified: 2011/04/14 18:26:35 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Mapnik2
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
Mapnik2 is current trunk and a new era of the mapnik codebase that uses boost features only available in boost >=1.41, icu >=4.2, and is a testbed for next-generation Mapnik features.
|
||||||
|
|
||||||
|
Pre-release installers for Mapnik2 are available for Mac OS X: http://dbsgeo.com/downloads/#mapnik-2.0.0
|
||||||
|
|
||||||
|
For Linux source compiles are required, see instructions below.
|
||||||
|
|
||||||
|
Mapnik2 implements a naming change for ease of development and testing .
|
||||||
|
|
||||||
|
So in python for now you do:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
>>> import mapnik2 # . This enables running the Mapnik 0.7.x series alongside Mapnik2.
|
||||||
|
|
||||||
|
And C++ programs must link against mapnik2:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
-L/usr/local/lib -lmapnik2
|
||||||
|
|
||||||
|
See also the brainstorming page for Future Mapnik at http://trac.mapnik.org/wiki/Ideas/FutureMapnik
|
||||||
|
|
||||||
|
## Compatibility
|
||||||
|
|
||||||
|
The Mapnik2 API has advanced (requiring breakages) and the XML syntax has changed in specific cases.
|
||||||
|
|
||||||
|
Therefore Mapnik2 is the [MapnikReleases first release] with significant backward incompatibility. See wiki:Mapnik2/Changes
|
||||||
|
|
||||||
|
# Upgrade Guide
|
||||||
|
|
||||||
|
1) rebuild all shapefile indexes
|
||||||
|
|
||||||
|
2) upgrade stylesheets with a python script:
|
||||||
|
|
||||||
|
We have written a python converter to seamlessly upgrade your pre-Mapnik2 stylesheets to be fully compatible with Mapnik2.
|
||||||
|
|
||||||
|
After installing Mapnik2 you will have a new command available called 'upgrade_map_xml.py':
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ upgrade_map_xml.py
|
||||||
|
Usage: upgrade_map_xml.py <input_file> <output_file>
|
||||||
|
|
||||||
|
Also, for osm.xml users, you will note that this script does not preserve entities (sorry). You may be interested in an experimental version of this script (but not installed by default) which does. See:
|
||||||
|
|
||||||
|
***WARNING*** this script has not been kept in sync with the main script mentioned above.
|
||||||
|
|
||||||
|
http://trac.mapnik.org/browser/trunk/utils/upgrade_map_xml/upgrade_map_xml_keep_ent.py
|
||||||
|
|
||||||
|
Also, we have ported support for the new Mapnik2 syntax to the upcoming [0.7.2 release](http://trac.mapnik.org/milestone/0.7.2), so you can stay on the 0.7 series but keep your stylesheets in the cleaner Mapnik2 format.
|
||||||
|
|
||||||
|
## External Applications
|
||||||
|
|
||||||
|
Special care will be needed to run various external applications against Mapnik2:
|
||||||
|
|
||||||
|
### Python Applications with Mapnik2
|
||||||
|
|
||||||
|
Note: you cannot do:
|
||||||
|
|
||||||
|
>>> import mapnik
|
||||||
|
>>> import mapnik2
|
||||||
|
|
||||||
|
This is because the namespaces will clash. We ultimately plan to release Mapnik2 using the standard '>>> import mapnik' namespace, so its not worth the trouble to make the above work. The rule of thumb is that you can have both installed just only run one at a time.
|
||||||
|
|
||||||
|
### Cascadenik
|
||||||
|
There is a branch of Cascadenik that is adding Mapnik2 compatibility at https://github.com/mapnik/Cascadenik/tree/mapnik2
|
||||||
|
|
||||||
|
### nik2img
|
||||||
|
Nik2img as of 0.5.0 supports both mapnik and mapnik2 transparently. Pass --mapnik-version 1 or mapnik-version 2 to force the usage of a single one (it will default to using Mapnik2)
|
||||||
|
|
||||||
|
### mod_tile/renderd
|
||||||
|
Supports Mapnik2 as of [r22900](http://trac.openstreetmap.org/changeset/22900)
|
||||||
|
But requires a patch to the Makefile and moving to the side any non-mapnik2 headers.
|
||||||
|
|
||||||
|
Here is the patch needed to the Makefile:
|
||||||
|
|
||||||
|
#!diff
|
||||||
|
Index: Makefile
|
||||||
|
===================================================================
|
||||||
|
--- Makefile (revision 22899)
|
||||||
|
+++ Makefile (working copy)
|
||||||
|
@@ -51,7 +51,7 @@
|
||||||
|
RENDER_LDFLAGS += -L/usr/local/lib
|
||||||
|
endif
|
||||||
|
|
||||||
|
-RENDER_LDFLAGS += -lmapnik -Liniparser3.0b -liniparser
|
||||||
|
+RENDER_LDFLAGS += -lmapnik2 -Liniparser3.0b -liniparser
|
||||||
|
|
||||||
|
ifeq ($(UNAME), Darwin)
|
||||||
|
RENDER_LDFLAGS += -licuuc -lboost_regex
|
||||||
|
|
||||||
|
Because Mapnik2 headers are not renamed 'include/mapnik' it is not possible to simultaneously compile C++ applications against headers of both Mapnik2 and Mapnik 0.7.x.
|
||||||
|
|
||||||
|
However, Python applications should be able to work against either Mapnik or Mapnik2 if both are installed.
|
||||||
|
|
||||||
|
So, for C++ compiles if you currently have old mapnik headers installed you must remove them and install mapnik2 headers in their place:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
rm -rf /usr/local/include/mapnik
|
||||||
|
# re-install mapnik2 headers
|
||||||
|
cd <mapnik2 sources>
|
||||||
|
sudo scons install
|
||||||
|
# build mod_tile/renderd with above patch
|
||||||
|
svn co http://svn.openstreetmap.org/applications/utils/mod_tile
|
||||||
|
cd mod_tile
|
||||||
|
make # will take a long time
|
||||||
|
sudo make install
|
||||||
|
# now if you want to later rebuild mod_tile agains Mapnik 0.7.x
|
||||||
|
# just remove the mapnik2 headers and re-install mapnik 0.7.x
|
||||||
|
# this is easy as mapnik2 now supports uninstalling
|
||||||
|
cd <old mapnik sources>
|
||||||
|
sudo scons uninstall # yah!
|
||||||
|
# then recompile mod_tile/ rendered
|
||||||
|
cd mod_tile
|
||||||
|
make clean
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
## Getting Mapnik2 source
|
||||||
|
|
||||||
|
Previously Mapnik2 was in a branch, but as of Dec 16th, 2009 is it mainline trunk
|
||||||
|
|
||||||
|
Checkout trunk with:
|
||||||
|
|
||||||
|
svn co http://svn.mapnik.org/trunk mapnik2
|
||||||
|
|
||||||
|
Or switch from the old branch to trunk by doing:
|
||||||
|
|
||||||
|
|
||||||
|
svn switch http://svn.mapnik.org/trunk .
|
||||||
|
|
||||||
|
Similarly, if you wish to stay on the previous trunk code, that is now the 0.7.1 release:
|
||||||
|
|
||||||
|
|
||||||
|
svn switch http://svn.mapnik.org/tags/release-0.7.1 .
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
Mapnik2 is also about harmonizing C++ coding conventions and thus a few class names have changed:
|
||||||
|
|
||||||
|
see wiki:Mapnik2/Changes
|
||||||
|
|
||||||
|
## Building ICU
|
||||||
|
|
||||||
|
Mapnik2 requires at least icu >= 4.2.
|
||||||
|
|
||||||
|
1. Get the latest release:
|
||||||
|
|
||||||
|
wget http://download.icu-project.org/files/icu4c/4.6/icu4c-4_6-src.tgz
|
||||||
|
tar xzvf icu4c-4_6-src.tgz
|
||||||
|
cd icu/source
|
||||||
|
./runConfigureICU Linux # on os x do: ./runConfigureICU MacOSX
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
sudo ldconfig
|
||||||
|
|
||||||
|
## Building Boost
|
||||||
|
|
||||||
|
You need boost >=1.41 for Mapnik2 (ideally 1.42).
|
||||||
|
|
||||||
|
Grab some dependencies (this is for debian systems)
|
||||||
|
|
||||||
|
sudo apt-get install libbz2-dev
|
||||||
|
|
||||||
|
If you are compiling on Mac OS X see: http://trac.mapnik.org/wiki/MacInstallation#Step1:RouteBC
|
||||||
|
|
||||||
|
Otherwise on linux do:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
wget http://voxel.dl.sourceforge.net/project/boost/boost/1.46.1/boost_1_46_1.tar.bz2
|
||||||
|
tar xjvf boost_1_46_1.tar.bz2
|
||||||
|
cd boost_1_46_1
|
||||||
|
./bootstrap.sh
|
||||||
|
./bjam \
|
||||||
|
--with-thread \
|
||||||
|
--with-filesystem \
|
||||||
|
--with-iostreams \
|
||||||
|
--with-python \
|
||||||
|
--with-regex -sHAVE_ICU=1 -sICU_PATH=/usr/local \
|
||||||
|
--with-program_options \
|
||||||
|
--with-system \
|
||||||
|
link=shared \
|
||||||
|
toolset=gcc \
|
||||||
|
stage
|
||||||
|
sudo ./bjam \
|
||||||
|
--with-thread \
|
||||||
|
--with-filesystem \
|
||||||
|
--with-iostreams \
|
||||||
|
--with-python \
|
||||||
|
--with-regex -sHAVE_ICU=1 -sICU_PATH=/usr/local \
|
||||||
|
--with-program_options \
|
||||||
|
--with-system \
|
||||||
|
toolset=gcc \
|
||||||
|
link=shared \
|
||||||
|
install
|
||||||
|
sudo ldconfig
|
||||||
|
|
||||||
|
Note: see the custom builds of libboost_regex and libboost_python below (if using these then you can remove them from the above lines)
|
||||||
|
|
||||||
|
*Note: Starting from r2760 there is no dependency on boost::iostreams library in shape.input and '--with-iostreams' flag can be omitted while building boost.*
|
||||||
|
|
||||||
|
To rebuild just boost_regex, for example to compile/link in the right ICU support try:
|
||||||
|
* -a forces rebuild/install
|
||||||
|
|
||||||
|
sudo ./bjam --with-regex toolset=gcc -sHAVE_ICU=1 -sICU_PATH=/usr/local -a install
|
||||||
|
|
||||||
|
Note: If later when compiling mapnik you get and error like...
|
||||||
|
|
||||||
|
Checking for C++ library boost_regex... no
|
||||||
|
... it might be because you have two versions of libicu on your system. You have to recompile boost such that `ldd /usr/local/lib/libboost_regex.so` is the latest version. Since bjam tends to give some problem when passing parameters, one way to overcome this could be to move the libicu*.so.40 libraries for example and replace them with the ones compiled on /usr/local/lib/libicu* and then rebuild boost with regex support. You could later return them to the same place so that both `import mapnik` and `import mapnik2` work.
|
||||||
|
|
||||||
|
Note: you may want to (re)build boost_python against a specific version of python on your system. To do this in the most robust way (because passing command line args to bjam is hard!), create a custom jam file:
|
||||||
|
|
||||||
|
|
||||||
|
import option ;
|
||||||
|
import feature ;
|
||||||
|
if ! gcc in [ feature.values <toolset> ]
|
||||||
|
{
|
||||||
|
using gcc ;
|
||||||
|
}
|
||||||
|
project : default-build <toolset>gcc ;
|
||||||
|
using python
|
||||||
|
: 2.5 # version
|
||||||
|
: /usr/bin/python2.5 # cmd-or-prefix
|
||||||
|
: /usr/include/python2.5/ # includes
|
||||||
|
: /usr/lib/python2.5/config/ # directory holding libpython
|
||||||
|
: <toolset>gcc # condition
|
||||||
|
;
|
||||||
|
libraries = --with-python ;
|
||||||
|
|
||||||
|
Then (re) compile the boost python lib using this custom jam file (call it 'user-config.jam'):
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
bjam --with-python -a -j2 --ignore-site-config --user-config=user-config.jam toolset=gcc stage -d2
|
||||||
|
sudo cp stage/lib/libboost_python.so* /path/to/install/dir/lib # modify for your system
|
87
Mapnik2_Changes.md
Normal file
87
Mapnik2_Changes.md
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
<!-- Name: Mapnik2/Changes -->
|
||||||
|
<!-- Version: 21 -->
|
||||||
|
<!-- Last-Modified: 2011/11/16 09:31:04 -->
|
||||||
|
<!-- Author: artem -->
|
||||||
|
# Changes between Mapnik 0.7.x and Mapnik 2.0
|
||||||
|
|
||||||
|
## XML
|
||||||
|
|
||||||
|
## Global Changes
|
||||||
|
|
||||||
|
### Underscores --> Dashes
|
||||||
|
|
||||||
|
All properties that previously used underscores, ie '_' now use dashes ('-'). So, for example: 'allow_overlap' is now 'allow-overlap'
|
||||||
|
* Mapnik 0.7.2 has compatibility with both syntaxes as of r2579
|
||||||
|
* Mapnik 2.0 moved to only dashes in r2582
|
||||||
|
* Note: branch of trunk tagged before r2582: https://trac.mapnik.org/browser/branches/mapnik2-pre-dashes
|
||||||
|
* properties changed include:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
['paths_from_xml','minimum_version','buffer_size','face_name,fonset_name','clear_label_cache','vertical_alignment','halo_fill','halo_radius','text_ratio','wrap_width','wrap_before','wrap_character','text_transform','line_spacing','label_position_tolerance','character_spacing','min_distance','minimum_distance','avoid_edges','allow_overlap','max_char_angle_delta','horizontal_alignment','justify_alignment','unlock_image','no_text']
|
||||||
|
|
||||||
|
### CSSParameters --> Properties
|
||||||
|
|
||||||
|
This change affects the PolygonSymbolizer, LineSymbolizer, RasterSymbolizer, and BuildingSymbolizer only.
|
||||||
|
|
||||||
|
All CSSParameters have been removed, so for example, this:
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<PolygonSymbolizer>
|
||||||
|
<CssParameter name="fill">yellow</CssParameter>
|
||||||
|
</PolygonSymbolizer>
|
||||||
|
|
||||||
|
is now:
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<PolygonSymbolizer fill="yellow" />
|
||||||
|
|
||||||
|
## Changes by Element
|
||||||
|
|
||||||
|
### Map
|
||||||
|
|| *component* || *old* || *new* ||
|
||||||
|
|| Map || bgcolor || background-color ||
|
||||||
|
|| Map || did not exist || background-image ||
|
||||||
|
|
||||||
|
### Symbolizers
|
||||||
|
|
||||||
|
|| *component* || *old* || *new* ||
|
||||||
|
|| TextSymbolizer || name='field' || name='[field]' ||
|
||||||
|
|| TextSymbolizer || text_convert || text-transform ||
|
||||||
|
|| TextSymbolizer || min_distance || minimum-distance ||
|
||||||
|
|| TextSymbolizer || did not exist || minimum-padding ||
|
||||||
|
|| PointSymbolizer / PolygonPatternSymbolizer / LinePatternSymbolizer || width || removed ||
|
||||||
|
|| PointSymbolizer / PolygonPatternSymbolizer / LinePatternSymbolizer || height || removed ||
|
||||||
|
|| PointSymbolizer / PolygonPatternSymbolizer / LinePatternSymbolizer || type || removed ||
|
||||||
|
|
||||||
|
|
||||||
|
# Python API
|
||||||
|
|
||||||
|
|| *component* || *old* || *new* ||
|
||||||
|
|| mapnik || mapnik.Envelope || mapnik.Box2d ||
|
||||||
|
|| TextSymbolizer || set_displacement (function) || displacement (property) ||
|
||||||
|
|| TextSymbolizer || first argument was string || first argument now mapnik2.Expression(['field']) ||
|
||||||
|
|| ShieldSymbolizer || first argument was string || first argument now mapnik2.Expression(['field']) ||
|
||||||
|
|| ShieldSymbolizer || fifth argument was string || fifth argument now mapnik2.PathExpression('/path/to/[field].png') ||
|
||||||
|
|
||||||
|
|
||||||
|
# C++ API
|
||||||
|
|| *component* || *old* || *new* ||
|
||||||
|
|| mapnik::Map || getWidth || width ||
|
||||||
|
|| mapnik::Map || getHeight || height ||
|
||||||
|
|| mapnik::Map || zoomToBox || zoom_to_box ||
|
||||||
|
|| mapnik::Map || setBackground || set_background ||
|
||||||
|
|| mapnik::Map || getCurrentExtent || get_current_extent ||
|
||||||
|
|| mapnik::Map || zoomToBox || zoom_to_box ||
|
||||||
|
|| mapnik:: || mapnik::Layer || mapnik::layer ||
|
||||||
|
|| mapnik:: || mapnik::Envelope || mapnik::box2d ||
|
||||||
|
|| mapnik:: || mapnik::ImageData32 || mapnik::image_data_32 ||
|
||||||
|
|| mapnik:: || mapnik::Image32 || mapnik::image_32 ||
|
||||||
|
|| mapnik:: || mapnik::Image8 || mapnik::image_8 ||
|
||||||
|
|
||||||
|
|
||||||
|
# Planned/Proposed Before Release
|
||||||
|
## Python API
|
||||||
|
* Image.tostring -> Image.encode()
|
||||||
|
* All remaining uses of 'envelope' -> 'box2d' (like ds.envelope())
|
11
MapnikAdmin.md
Normal file
11
MapnikAdmin.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<!-- Name: MapnikAdmin -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2009/12/16 12:44:16 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
When stuff breaks with trac...
|
||||||
|
|
||||||
|
|
||||||
|
error: 'No node trunk/bindings/python/mapnik_filter.cpp at revision 1495'
|
||||||
|
|
||||||
|
|
||||||
|
trac-admin mapnik_trac/ resync
|
20
MapnikCodeSprint.md
Normal file
20
MapnikCodeSprint.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<!-- Name: MapnikCodeSprint -->
|
||||||
|
<!-- Version: 3 -->
|
||||||
|
<!-- Last-Modified: 2010/09/27 10:46:59 -->
|
||||||
|
<!-- Author: rweait -->
|
||||||
|
A code sprint, or hack fest, is a period of software development
|
||||||
|
focused on a given list of goals. The face to face meetings let
|
||||||
|
us approach complex topics with immediate feedback.
|
||||||
|
|
||||||
|
## Upcoming Mapnik Code Sprints
|
||||||
|
|
||||||
|
### [Mapnik Code Sprint 02](/wiki:MapnikCodeSprint/MCS02/)
|
||||||
|
*Date* To Be Determined, early 2011[[BR]]
|
||||||
|
*Location* To Be Determined
|
||||||
|
|
||||||
|
## Previous Mapnik Code Sprints
|
||||||
|
|
||||||
|
### [Mapnik Code Sprint 01 - Committers and Cartographers](/wiki:MapnikCodeSprint/MCS01/)
|
||||||
|
|
||||||
|
*Date* Friday, 24 September 2010 - Sunday, 26 September 2010 [[BR]]
|
||||||
|
*Location* London, England and San Francisco, USA
|
100
MapnikCodeSprint_MCS01.md
Normal file
100
MapnikCodeSprint_MCS01.md
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
<!-- Name: MapnikCodeSprint/MCS01 -->
|
||||||
|
<!-- Version: 31 -->
|
||||||
|
<!-- Last-Modified: 2010/09/29 03:24:53 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[Image(MCS01-devseed.png)]]
|
||||||
|
|
||||||
|
*Committers and Cartographers* was the name and theme selected for the first Mapnik Code Sprint. Grown from the seed of an idea at the OpenStreetMap State of the Map conference in Girona, Spain, July 2010. It germinated on the Mapnik-Devel list to grow into an event on two continents.
|
||||||
|
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
## Date
|
||||||
|
Friday, 24 September 2010 - Sunday, 26 September 2010
|
||||||
|
|
||||||
|
## [Location](/wiki:MapnikCodeSprint/MCS01/Location/)
|
||||||
|
MCS01 will be / was held in [London, England](/wiki:MapnikCodeSprint/MCS01/Location/).
|
||||||
|
|
||||||
|
## [Schedule](/wiki:MapnikCodeSprint/MCS01/Schedule/)
|
||||||
|
This will be a full weekend of Mapnik fun. For details see the [schedule](/wiki:MapnikCodeSprint/MCS01/Schedule/).
|
||||||
|
|
||||||
|
## Code
|
||||||
|
Plan here for code to write and bugs to squish. Please add your thoughts. Discuss. Plan.
|
||||||
|
|
||||||
|
### Cartography Wish List
|
||||||
|
Cartography wish list.
|
||||||
|
|
||||||
|
From Steve Chilton's SotM presentation:
|
||||||
|
* respect the layer tag implicitly
|
||||||
|
* names for lower roads should not appear where other roads pass over them
|
||||||
|
* iterate alternative label placement
|
||||||
|
* apply point within polygon labels
|
||||||
|
* allow rotation for icons
|
||||||
|
* accept SVG icons (Done? See [Changeset 1793](http://trac.mapnik.org/changeset/1793) )
|
||||||
|
* apply variable widths to canals and rivers
|
||||||
|
* apply vignettes inside polygons
|
||||||
|
* produce spread text labels
|
||||||
|
* different casing either side of roads (Done as patch for 0.7.1? see offset lines #180 )
|
||||||
|
* text labels either side of a line
|
||||||
|
* more Natural Earth data at low-zooms (May apply more to OSM style than Mapnik-core)
|
||||||
|
|
||||||
|
|
||||||
|
* add your advanced cartography requests
|
||||||
|
|
||||||
|
* as it's already able to replace certain strings in the filename of a Symbolizer, other parameters should be changeable too. Say: I want to define a Template for a Symbolizer in the Stylesheet, but define its parameters (color, width, etc.) from database columns.
|
||||||
|
|
||||||
|
### Bug list
|
||||||
|
List of bugs for squishing or topics to discuss:
|
||||||
|
* http://trac.mapnik.org/milestone/MCS1%20Tickets
|
||||||
|
|
||||||
|
### Cascadenik
|
||||||
|
|
||||||
|
Rob's going to be working on [Cascadenik](http://code.google.com/p/mapnik-utils/wiki/Cascadenik):
|
||||||
|
- adding all the currently supported symbolizer attributes
|
||||||
|
- supporting Mapnik2 alongside 0.x
|
||||||
|
- supporting the new parameterized symbolizer attributes
|
||||||
|
- merging the `-xmlbad` branch to trunk
|
||||||
|
- cleaning, testing, and fixing bugs
|
||||||
|
- fixing mapnik bugs uncovered by the above :)
|
||||||
|
- one being #612 (dane will try to close during sprint)
|
||||||
|
|
||||||
|
### Profiling
|
||||||
|
|
||||||
|
Fred's interested in performance:
|
||||||
|
- how long did it take to render this?
|
||||||
|
- how much time was spent acquiring the data,
|
||||||
|
- how much was spent processing each layer/style,
|
||||||
|
- etc
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
[http://trac.mapnik.org/wiki/MapnikCodeSprint/MCS01/Results]
|
||||||
|
|
||||||
|
## Participants
|
||||||
|
|
||||||
|
London:
|
||||||
|
* Artem Pavlenko - Mapnik Founder
|
||||||
|
* Dane Springmeyer - Mapnik Project Release Manager
|
||||||
|
* Steve Chilton - Chair, Society of Cartographers
|
||||||
|
* Andy Allan - Founder OpenCycleMap
|
||||||
|
* Iván Sánchez Ortega - OSM España (arriving Fri late evening)
|
||||||
|
* AJ Ashton - Cartographer, Development Seed
|
||||||
|
* Tom MacWright - GIS Developer, Development Seed
|
||||||
|
* Tom Hughes - OSM SysAdmin and author of Mapnik Cairo backend
|
||||||
|
* Andrii Mishkovskyi - GIS Developer, CloudMade
|
||||||
|
* Frederik Ramm - geofabrik.de (from Fri noon)
|
||||||
|
* and a cast of thousands (some shy folks not listed here)
|
||||||
|
|
||||||
|
San Francisco:
|
||||||
|
* Michal Migurski - Walking-Papers Founder
|
||||||
|
* Nino Walker
|
||||||
|
* Katie Filbert (Friday ?)
|
||||||
|
|
||||||
|
Remote:
|
||||||
|
* Rob Coup - Koordinates
|
||||||
|
* Craig de Stigter - Koordinates
|
||||||
|
|
||||||
|
## Oh look, Development Seed made a logo for us!
|
||||||
|
How cool are they? Pretty cool!
|
||||||
|
|
||||||
|
The logo is © 2010 Development Seed, [OpenStreetMap](http://www.openstreetmap.org/) and Contributors
|
||||||
|
and is licensed [CC-By-SA](http://creativecommons.org/licenses/by-sa/2.0/)
|
16
MapnikCodeSprint_MCS01_Location.md
Normal file
16
MapnikCodeSprint_MCS01_Location.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!-- Name: MapnikCodeSprint/MCS01/Location -->
|
||||||
|
<!-- Version: 5 -->
|
||||||
|
<!-- Last-Modified: 2010/09/25 09:27:07 -->
|
||||||
|
<!-- Author: migurski -->
|
||||||
|
[MSC01](/wiki:MapnikCodeSprint/MCS01/) will be / was held in London, England and San Francisco, USA.
|
||||||
|
|
||||||
|
Friday, 24 September 2010 - Sunday, 26 September 2010
|
||||||
|
|
||||||
|
=== London, England ===
|
||||||
|
|
||||||
|
CloudMade [[BR]]
|
||||||
|
Enterprise House[[BR]]
|
||||||
|
1/2 Hatfields[[BR]]
|
||||||
|
London[[BR]]
|
||||||
|
SE1 9PG[[BR]]
|
||||||
|
[Map](http://osm.org/go/euu4oTw8O--?m)
|
78
MapnikCodeSprint_MCS01_Results.md
Normal file
78
MapnikCodeSprint_MCS01_Results.md
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
<!-- Name: MapnikCodeSprint/MCS01/Results -->
|
||||||
|
<!-- Version: 4 -->
|
||||||
|
<!-- Last-Modified: 2010/09/30 12:04:24 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
## Blogs
|
||||||
|
|
||||||
|
Bonnie Bogle
|
||||||
|
[http://developmentseed.org/blog/2010/sep/24/mapnik-code-sprint-london-weekend]
|
||||||
|
|
||||||
|
Tom MacWright
|
||||||
|
[http://developmentseed.org/blog/2010/sep/27/report-mapnik-code-sprint]
|
||||||
|
|
||||||
|
OpenGeoData
|
||||||
|
[http://opengeodata.org/mapnik-code-sprint-committers-and-cartographe]
|
||||||
|
|
||||||
|
Mike Migurski
|
||||||
|
[http://mike.teczno.com/notes/map-sprint.html]
|
||||||
|
|
||||||
|
Dane Springmeyer
|
||||||
|
* Kickoff - [http://mapnik.org/news/2010/sep/24/mcs01_day1/]
|
||||||
|
* Faster Mapnik - [http://mapnik.org/news/2010/sep/29/mcs01_roundup1/]
|
||||||
|
* Community - [http://mapnik.org/news/2010/sep/29/mcs01_roundup2/]
|
||||||
|
|
||||||
|
|
||||||
|
## Photos
|
||||||
|
|
||||||
|
Hard at work on Mapnik
|
||||||
|
[http://www.flickr.com/photos/developmentseed/5029925686/in/photostream/]
|
||||||
|
|
||||||
|
Dane and Artem meet in person
|
||||||
|
[http://yfrog.com/50o6xj]
|
||||||
|
|
||||||
|
Intensely following TileMill demonstration
|
||||||
|
[http://yfrog.com/n4go6sj]
|
||||||
|
|
||||||
|
Toasting a successful sprint
|
||||||
|
[http://yfrog.com/jvegpqj]
|
||||||
|
|
||||||
|
|
||||||
|
## Fixes and Improvements
|
||||||
|
|
||||||
|
This is a quick list of things we started work on or achieved during the sprint:
|
||||||
|
|
||||||
|
(please add anything I missed - dane)
|
||||||
|
|
||||||
|
* Discussed next stable release (.7x series and Mapnik2 work, what to backport)
|
||||||
|
* Forward compatibility of .7.x series a priority (springmeyer)
|
||||||
|
* Lots of work on new prototype for documentation (dodobas) #288
|
||||||
|
* Moved Cascadenik to github and refactored lots of code, merging in XML-bad branch (migurski, rcoup, ninow) (http://github.com/mapnik/Cascadenik)
|
||||||
|
* Came up with lots of new ideas and pushed they into tickets against [Sprint Milestone](http://trac.mapnik.org/milestone/MCS1%20Tickets)
|
||||||
|
* Many sprinters installed Mapnik2 - we updated docs with lessons learned (springmeyer)
|
||||||
|
* Extensive review and prioritization of tickets relating to cartographic features (ldp)
|
||||||
|
* Work towards native boost::spirit WKT parser (artem)
|
||||||
|
* Number of improvements to python api documentation (tmcw)
|
||||||
|
* Add functions to set the alpha of overall rendering map image (springmeyer)
|
||||||
|
* Started work on better warning output during XML parsing for misspelled property names (springmeyer) #110
|
||||||
|
* Added function to convert grayscale channel to alpha channel for "World Glass" effect (springmeyer)
|
||||||
|
* Added support for faster multi-threaded reprojection through use of proj ctx (#605) (tomhughes)
|
||||||
|
* Addition of RTL test XML (r2244, ajashton)
|
||||||
|
* Worked on scoping Cairo context.scale() bugs - no solution quite yet (mishok13)
|
||||||
|
* Added support for "late-binding" of datasources for better control over object creation from calling apps like Cascadenik (#622) (rcoup)
|
||||||
|
* Various Improvements to shield and text positioning (artem)
|
||||||
|
* Improvements to SVG parsing and rendering (artem)
|
||||||
|
* Fixed feature caching when using multiple styles for faster rendering (woodpeck) (#624)
|
||||||
|
* Brainstormed and scoped on wiki ideas around [Compositing](/wiki:Ideas/Compositing/) and [Legends](/wiki:Legending/) (gravitystorm, ivansanchez)
|
||||||
|
* Added Python3 support (haoyu,springmeyer) [wiki:Python3k]
|
||||||
|
* Wrote a render_debug() function to output statistics on rendering times (woodpeck)
|
||||||
|
* Added the ability to control the timeout of expensive PostGIS queries (jburgess) #632
|
||||||
|
* Started writing Spreadnik v2 in python (ivansanchez)
|
||||||
|
* Doubled speed of the [Paleoserver](http://trac.mapnik.org/wiki/Paleoserver) for returning transparent tiles (springmeyer)
|
||||||
|
* Fixed bugs in nik2img around double-opening of images on linux and recursively registering fonts (springmeyer)
|
||||||
|
|
||||||
|
## Trac timeline
|
||||||
|
|
||||||
|
[http://trac.mapnik.org/timeline?from=09%2F29%2F10&daysback=10&ticket=on&ticket_details=on&changeset=on&update=Update]
|
||||||
|
|
||||||
|
## Tickets
|
||||||
|
[http://trac.mapnik.org/milestone/MCS1%20Tickets]
|
38
MapnikCodeSprint_MCS01_Schedule.md
Normal file
38
MapnikCodeSprint_MCS01_Schedule.md
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<!-- Name: MapnikCodeSprint/MCS01/Schedule -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2010/09/29 03:23:46 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
## London Schedule for [MCS01](/wiki:MapnikCodeSprint/MCS01/)
|
||||||
|
|
||||||
|
=== Friday, 24 September 2010 ===
|
||||||
|
* 10:30 start
|
||||||
|
* Advanced cartography needs and dreams (Steve8 from OSM lead)
|
||||||
|
* History, design, and architecture of Mapnik (Artem lead)
|
||||||
|
* Future features and designs (whole group discussion, Dane Lead)
|
||||||
|
* Lunch
|
||||||
|
* Coding!
|
||||||
|
* 6pm wrap up
|
||||||
|
|
||||||
|
*Friday evening*: Cloudmade sponsoring drinks at Mulberry Bush (just around the corner from office)
|
||||||
|
|
||||||
|
### Saturday, 25 September 2010
|
||||||
|
* Morning interactive code dive, C++ and Python (Artem and Dane lead)
|
||||||
|
* Sprint afternoon on documentation and performance
|
||||||
|
|
||||||
|
### Sunday, 26 September 2010
|
||||||
|
* More sprinting on docs and speed improvements
|
||||||
|
* Afternoon: recap, reports, pub
|
||||||
|
|
||||||
|
|
||||||
|
## San Francisco Schedule
|
||||||
|
|
||||||
|
=== Friday, 24 September 2010 ===
|
||||||
|
* 5pm start
|
||||||
|
|
||||||
|
### Saturday, 25 September 2010
|
||||||
|
* Cascadenik dev
|
||||||
|
|
||||||
|
### Sunday, 26 September 2010
|
||||||
|
* Cascadenik dev
|
||||||
|
|
||||||
|
Please note that additional pub times may be added to the schedule as required.
|
47
MapnikCodeSprint_MCS02.md
Normal file
47
MapnikCodeSprint_MCS02.md
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
<!-- Name: MapnikCodeSprint/MCS02 -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2010/09/27 08:51:38 -->
|
||||||
|
<!-- Author: rweait -->
|
||||||
|
The second Mapnik Code Sprint: Code Name To Be Determined, is in the early planning stages. Do you have hopes and dreams for future Mapnik code sprints? Tell us what you think!
|
||||||
|
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
## Details
|
||||||
|
### Date
|
||||||
|
|
||||||
|
Date TBD
|
||||||
|
|
||||||
|
### Location
|
||||||
|
|
||||||
|
Location TBD
|
||||||
|
|
||||||
|
### Schedule
|
||||||
|
|
||||||
|
Schedule TBD
|
||||||
|
|
||||||
|
## Code
|
||||||
|
|
||||||
|
Plan here for code to write and bugs to squish. Please add your thoughts. Discuss. Plan.
|
||||||
|
|
||||||
|
### Plans
|
||||||
|
|
||||||
|
Features, enhancements and cool stuff.
|
||||||
|
#### Documentation
|
||||||
|
#### Packaging
|
||||||
|
#### Testing
|
||||||
|
#### Community
|
||||||
|
|
||||||
|
|
||||||
|
### Bug list
|
||||||
|
|
||||||
|
List of bugs for squishing or topics to discuss:
|
||||||
|
|
||||||
|
## Participants
|
||||||
|
|
||||||
|
Attending:
|
||||||
|
- On Site Attendee
|
||||||
|
|
||||||
|
Remote:
|
||||||
|
- Remote Attendee
|
||||||
|
|
||||||
|
## Results
|
44
MapnikDependencies.md
Normal file
44
MapnikDependencies.md
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<!-- Name: MapnikDependencies -->
|
||||||
|
<!-- Version: 3 -->
|
||||||
|
<!-- Last-Modified: 2009/11/11 11:10:04 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
## Mapnik Dependencies
|
||||||
|
|
||||||
|
Mapnik requires the Boost libraries, International Components for Unicode (ICU), Freetype, Proj4, and a variety of image libraries.
|
||||||
|
|
||||||
|
Installing Boost is often new to mapnik users, but the majority of remaining dependencies are more familiar.
|
||||||
|
|
||||||
|
If you have previously built or installed other open source graphics or mapping applications it is likely that many of the remaining dependencies are already installed.
|
||||||
|
|
||||||
|
Notes on installing Mapnik dependencies are included within each [MapnikInstallation platform specific instructions].
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
* *Input Format Plugins*
|
||||||
|
* PostGIS/PostgreSQL - to read data using the Mapnik PostGIS plugin.
|
||||||
|
* [PostgreSQL](http://www.postgresql.org/): Relational database system
|
||||||
|
* [PostGIS](http://www.postgis.org/): Spatial extension to PostgreSQL
|
||||||
|
* [GDAL](http://trac.osgeo.org/gdal/wiki/FAQGeneral#WhatdoesGDALstandsfor) - to read raster data using the Mapnik GDAL plugin
|
||||||
|
* [GDAL](http://www.gdal.org/): Geospatial Data Abstraction Library
|
||||||
|
* [GDAL Formats](http://www.gdal.org/formats_list.html): Raster Formats supported by GDAL
|
||||||
|
|
||||||
|
* *Libraries* for Imaging
|
||||||
|
* libcairo - [Multi-platform 2D graphics library](http://www.cairographics.org/)
|
||||||
|
* libcairomm - [C++ wrapper for Cairo graphics](http://www.cairographics.org/cairomm/)
|
||||||
|
* pycairo - [Python bindings for the cairo graphics library](http://www.cairographics.org/pycairo/)
|
||||||
|
* tinyxml, spirit, or libxml2 - for XML parsing extensions, see: ManagingLargeXmlFiles
|
||||||
|
|
||||||
|
* *Mapnik WMS* (Web Map Service) dependencies - [WMS on wikipedia](http://en.wikipedia.org/wiki/Web_Map_Service)
|
||||||
|
* jonpy.fcgi - [Jon's FastCGI Python module](http://jonpy.sourceforge.net/)
|
||||||
|
* libxslt - [XSLT(Extensible Stylesheet Language Transformations) C library](http://xmlsoft.org/XSLT/)
|
||||||
|
* libxml2 - [XML C parser](http://xmlsoft.org/)
|
||||||
|
* lxml - [Python bindings for the libxml2 and libxslt libraries](http://codespeak.net/lxml/index.html)
|
||||||
|
* PIL [Python Imaging Library](http://www.pythonware.com/products/pil/)
|
||||||
|
* Proj.4 - see above
|
||||||
|
* Apache webserver: Comes pre-installed on Mac OS X
|
||||||
|
* Apache2 config is in: /etc/apache2/
|
||||||
|
* Apache2 web root is: /Library/WebServer
|
||||||
|
* Apache2 cgi-bin is: /Library/WebServer/CGI-Executables
|
||||||
|
* Apache2 logs are in: /var/log/apache2/
|
||||||
|
* Python handler run as either [FastCGI](http://www.fastcgi.com/) or [mod-fcgid](http://fastcgi.coremail.cn/)
|
||||||
|
* WSGI handler also possible, but undocumented
|
112
MapnikInstallation.md
Normal file
112
MapnikInstallation.md
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
<!-- Name: MapnikInstallation -->
|
||||||
|
<!-- Version: 32 -->
|
||||||
|
<!-- Last-Modified: 2011/09/03 06:56:34 -->
|
||||||
|
<!-- Author: herm -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
## Get the Source
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<a href="http://prdownload.berlios.de/mapnik/mapnik-0.7.1.tar.bz2"><img style="float: left; margin-right:15px;" src="http://media.mapnik.org/images/release-0.7.1.png" /> </a>
|
||||||
|
|
||||||
|
[Latest Release ](http://prdownload.berlios.de/mapnik/mapnik-0.7.1.tar.bz2) | [All past releases](http://download.berlios.de/mapnik/)
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
Latest stable release:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
svn co http://svn.mapnik.org/tags/release-0.7.1/ mapnik
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLING Mapnik trunk? If so, see [wiki:Mapnik2].
|
||||||
|
|
||||||
|
Trunk (Warning UNSTABLE):
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
svn co http://svn.mapnik.org/trunk/ mapnik-trunk
|
||||||
|
|
||||||
|
|
||||||
|
## General Resources
|
||||||
|
* Quickstart InstallGuide (also included in source code as 'INSTALL')
|
||||||
|
* Guide for UsingScons (Mapnik's python build system)
|
||||||
|
* Background on MapnikDependencies
|
||||||
|
* Guide for [Building with Autotools](/wiki:BuildingwithAutotools/) (The alternative way to build Mapnik)
|
||||||
|
|
||||||
|
## Mapnik on Linux
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<img style="float: left; margin-right:15px;" src="http://media.mapnik.org/linux.png" />
|
||||||
|
|
||||||
|
LinuxInstallation -- Notes on a variety of Linux Distributions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
## Mapnik on FreeBSD
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<img style="float: left; margin-right:15px;" src="http://trac.mapnik.org/raw-attachment/wiki/MapnikInstallation/dae_up3.gif" />
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
|
||||||
|
[FreeBSDInstallation](/wiki:FreeBSDInstallation/) -- Notes on installing on FreeBSD 8.1
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
|
||||||
|
|
||||||
|
## Mapnik on Windows
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<img style="float: left; margin-right:15px;" src="http://media.mapnik.org/win32.png" />
|
||||||
|
|
||||||
|
WindowsInstallation
|
||||||
|
|
||||||
|
[BuildingOnWindows From source instructions]
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<br/>
|
||||||
|
## Mapnik on Mac OS X
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<img style="float: left; margin-right:15px;" src="http://dbsgeo.com/media/images/mac_pkg_small.png" />
|
||||||
|
|
||||||
|
[Mac Binary Installers](http://dbsgeo.com/downloads)
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<img style="float: left; margin-right:15px;" src="http://media.mapnik.org/osx.png" />
|
||||||
|
|
||||||
|
[MacInstallation Source install instructions for Mac]
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Mapnik on Open Solaris
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<img style="float: left; margin-right:15px;" src="http://media.mapnik.org/images/osol.png" />
|
||||||
|
|
||||||
|
OpenSolarisInstallation
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
|
||||||
|
|
||||||
|
### Gochas
|
||||||
|
* InstallationTroubleshooting (Find/Report hints here)
|
||||||
|
|
||||||
|
### Additional Resources
|
||||||
|
* [Frequently Ask Mapnik Questions](http://mapnik.org/faq/)
|
||||||
|
* [Mapnik-users community list](http://lists.berlios.de/mailman/listinfo/mapnik-users)
|
5
MapnikInstallationSvn.md
Normal file
5
MapnikInstallationSvn.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!-- Name: MapnikInstallationSvn -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2008/11/14 15:05:27 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[ReST(/trunk/INSTALL)]]
|
27
MapnikOverview.md
Normal file
27
MapnikOverview.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<!-- Name: MapnikOverview -->
|
||||||
|
<!-- Version: 6 -->
|
||||||
|
<!-- Last-Modified: 2009/02/15 23:26:31 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
From [the Mapnik FAQ](http://mapnik.org/faq/):
|
||||||
|
|
||||||
|
Mapnik is a Free Toolkit for developing mapping applications. It is written in modern C++ and has Python bindings that support fast-paced agile development. It can comfortably be used for both desktop map design and web development.
|
||||||
|
|
||||||
|
|
||||||
|
#!html
|
||||||
|
<img style="float: right; border: 1px lightgrey solid;" src="http://media.mapnik.org/images/biodiver_canada.png" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*Mapnik is about making beautiful maps*. It uses the AGG graphics library, which offers world-class anti-aliasing rendering with subpixel accuracy for geographic data.
|
||||||
|
|
||||||
|
|
||||||
|
See the [the Mapnik FAQ](http://mapnik.org/faq/) for more information.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Blog posts about Mapnik:
|
||||||
|
|
||||||
|
* [making sense of mapnik](http://mike.teczno.com/notes/mapnik.html) (Michal Migurski)
|
||||||
|
* [A List Apart: take control of your maps!](http://www.alistapart.com/articles/takecontrolofyourmaps)
|
||||||
|
* [Using the OSM export tab to render mapnik maps with no programming](http://www.dankarran.com/blog/archives/2008/09/16/making_maps_from_openstreetmap_geodata.php)
|
||||||
|
* [Mapnik - Maybe the best Python Mapping Platform Yet](http://geospatialpython.com/2009/02/mapnik-maybe-best-python-mapping.html)
|
11
MapnikReferences.md
Normal file
11
MapnikReferences.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<!-- Name: MapnikReferences -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2010/03/12 14:53:37 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
## Listing of various references relevant to (improving) Mapnik
|
||||||
|
|
||||||
|
### Improving Mapnik with Label Placement Algorithms
|
||||||
|
http://home.fuzzie.org/~bbz/scriptie.pdf
|
||||||
|
|
||||||
|
### Map rotation and resolution
|
||||||
|
http://www.ancalime.de/demo.html
|
182
MapnikReleaseSteps.md
Normal file
182
MapnikReleaseSteps.md
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
<!-- Name: MapnikReleaseSteps -->
|
||||||
|
<!-- Version: 42 -->
|
||||||
|
<!-- Last-Modified: 2011/08/30 14:31:08 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Steps for Mapnik Releases
|
||||||
|
|
||||||
|
|
||||||
|
#!text/x-rst
|
||||||
|
|
||||||
|
Prepare
|
||||||
|
-------
|
||||||
|
|
||||||
|
Catch up on CHANGELOG by going through all commits
|
||||||
|
|
||||||
|
Set release date (http://trac.mapnik.org/roadmap), after checkins with development team
|
||||||
|
|
||||||
|
Announce release plans to mapnik-devel/mapnik-users
|
||||||
|
|
||||||
|
Recruit volunteers to help with release laundry-list.
|
||||||
|
|
||||||
|
Develop and add to laundry-list on this page.
|
||||||
|
|
||||||
|
Sort Trac tickets, prioritize, assign, close or push.
|
||||||
|
|
||||||
|
|
||||||
|
Bundled fonts and scons
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Consider updating Scons-local to latest release.
|
||||||
|
|
||||||
|
The last scons update was 2.1.0.alpha::
|
||||||
|
|
||||||
|
wget http://prdownloads.sourceforge.net/scons/scons-local-2.1.0.alpha.20101125.zip
|
||||||
|
rm -rf scons
|
||||||
|
unzip -o scons-local-2.1.0.alpha.20101125.zip -d scons/
|
||||||
|
rm scons-local-2.1.0.alpha.20101125.zip
|
||||||
|
|
||||||
|
|
||||||
|
Consider updating DeJaVu Fonts:
|
||||||
|
|
||||||
|
The last version updated was 2.33::
|
||||||
|
|
||||||
|
cd fonts
|
||||||
|
svn rm dejavu-fonts-ttf-
|
||||||
|
wget http://sourceforge.net/projects/dejavu/files/dejavu/2.33/dejavu-fonts-ttf-2.33.tar.bz2
|
||||||
|
tar xvf dejavu-fonts-ttf-2.33.tar.bz2
|
||||||
|
svn add dejavu-fonts-ttf-2.33
|
||||||
|
|
||||||
|
And unifont from: http://unifoundry.com/unifont.html
|
||||||
|
|
||||||
|
|
||||||
|
Testing
|
||||||
|
-------
|
||||||
|
Buildbot: http://miranda.nwcr.net:8010/waterfall
|
||||||
|
|
||||||
|
|
||||||
|
Trac Pre-Release
|
||||||
|
----------------
|
||||||
|
Update Roadmap details for Milestone
|
||||||
|
|
||||||
|
Change default Ticket Milestone
|
||||||
|
|
||||||
|
Change default Ticket Version adding new release
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SVN updates
|
||||||
|
-----------
|
||||||
|
Generate Python API docs::
|
||||||
|
|
||||||
|
$ sudo easy_install epydoc
|
||||||
|
$ cd docs/epydoc_config
|
||||||
|
$ ./test_build_epydoc.sh # will output sample docs in 'test_api' folder, view the 'index.html' file
|
||||||
|
$ ./build_epydoc.sh # will build and add to to ../api_docs/python
|
||||||
|
|
||||||
|
* Then upload these docs to media.mapnik.org/api_docs replacing what is already there.
|
||||||
|
|
||||||
|
Commit in trunk:
|
||||||
|
* Update version number in http://trac.mapnik.org/browser/trunk/include/mapnik/version.hpp
|
||||||
|
* Update `abi_fallback` in http://trac.mapnik.org/browser/trunk/SConstruct
|
||||||
|
* Update libmapnik.dylib `current_version` and `compatibility_version` in http://trac.mapnik.org/browser/trunk/src/SConscript
|
||||||
|
|
||||||
|
Update CHANGELOG with the svn r the tagged release is made from.
|
||||||
|
|
||||||
|
Tag release
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Packaging
|
||||||
|
---------
|
||||||
|
Strip autotools/makefiles from tag::
|
||||||
|
|
||||||
|
rm -rf config/
|
||||||
|
rm bootstrap
|
||||||
|
rm configure.ac
|
||||||
|
rm autogen.sh
|
||||||
|
rm mapnik.anjuta
|
||||||
|
rm mapnik-uninstalled.pc.in
|
||||||
|
rm mapnik.pc.in
|
||||||
|
for i in $(find . -name Makefile*); do rm $i; done;
|
||||||
|
|
||||||
|
Strip svn data from tag::
|
||||||
|
|
||||||
|
$ find . -name '.svn' -exec rm -rf {} \;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Package tarball/gzip::
|
||||||
|
|
||||||
|
$ NAME=mapnik_VERSION
|
||||||
|
$ cd ../
|
||||||
|
$ svn co http://svn.mapnik.org/tags/release-0.7.1 $NAME
|
||||||
|
$ cd $NAME
|
||||||
|
$ find . -name '.svn' -exec rm -rf {} \;
|
||||||
|
$ cd ../
|
||||||
|
$ tar --exclude=".*" -cvf $NAME.tar $NAME/*
|
||||||
|
$ gzip $NAME.tar
|
||||||
|
|
||||||
|
Make sure to include:
|
||||||
|
* Updated Python bindings (__init__.py)
|
||||||
|
* Customize __init__.py to remove unix specific DL open stuff
|
||||||
|
* demo/python/rundemo.py, etc
|
||||||
|
|
||||||
|
Post tarball (gzip and bz2) of source at berlios (http://developer.berlios.de/projects/mapnik) and http://media.mapnik.org.
|
||||||
|
* mapnik-VERSION.tar.gz
|
||||||
|
* mapnik-VERSION.tar.bz2
|
||||||
|
|
||||||
|
Post win32 build (by python version) at [ berlios (http://developer.berlios.de/projects/mapnik) and http://media.mapnik.org.
|
||||||
|
* mapnik-VERSION-win32-pyVERSION.zip
|
||||||
|
* make sure to zip with command line to avoid '__MACOSX/' files
|
||||||
|
|
||||||
|
$ zip -9vr mapnik-0.7.1-win32-py25_26.zip mapnik-0.7.1/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Builds
|
||||||
|
--------
|
||||||
|
Windows (debug builds and py25/py26 builds)
|
||||||
|
|
||||||
|
Mac (debug builds and py25/py26 builds)
|
||||||
|
|
||||||
|
Submit patch for updated Mapnik Portfile (http://trac.macports.org/browser/trunk/dports/python/py26-mapnik/Portfile)
|
||||||
|
|
||||||
|
|
||||||
|
Web
|
||||||
|
---
|
||||||
|
|
||||||
|
New icon for release at media.mapnik.org/images/release-VERSION.png
|
||||||
|
|
||||||
|
Add a new 'release' item in the admin to update all links on mapnik.org
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Trac Post-Release
|
||||||
|
-----------------
|
||||||
|
Update :trac:`MapnikInstallation`, :trac:`MacInstallation`, :trac:`LinuxInstallation` and :trac:`WindowsInstallation` links
|
||||||
|
|
||||||
|
Create a release page from the relevant section of CHANGELOG like this page: :trac:`Release0.7.1`
|
||||||
|
|
||||||
|
Update :trac:`MapnikReleases`, a starting page for users to learn about Mapnik development
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Announce
|
||||||
|
--------
|
||||||
|
Notify Packagers for Linux distros (:trac:`PackageBuilding`)
|
||||||
|
|
||||||
|
Notify Packagers for OSGEO4w: http://norbit.de/
|
||||||
|
|
||||||
|
Mapnik lists
|
||||||
|
|
||||||
|
Mapnik.org news
|
||||||
|
|
||||||
|
OSGEO News item: http://www.osgeo.org/content/news/submit_news.html
|
||||||
|
|
||||||
|
Freshmeat : http://freshmeat.net/projects/mapnik
|
||||||
|
|
||||||
|
FreeGIS : http://www.freegis.org
|
||||||
|
|
||||||
|
SlashGeo : http://slashgeo.org/
|
||||||
|
|
||||||
|
OpenStreetMap : [OSM-Dev] [OSM-Talk] ??
|
54
MapnikReleases.md
Normal file
54
MapnikReleases.md
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<!-- Name: MapnikReleases -->
|
||||||
|
<!-- Version: 14 -->
|
||||||
|
<!-- Last-Modified: 2011/10/03 14:26:07 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Mapnik Releases
|
||||||
|
|
||||||
|
Learn about about past, current, and future releases.
|
||||||
|
|
||||||
|
## Upgrade Notes
|
||||||
|
|
||||||
|
### Backwards Incompatibility
|
||||||
|
|
||||||
|
## 0.5.x -> 0.6.1
|
||||||
|
|
||||||
|
Changelog: wiki:Release0.6.0
|
||||||
|
|
||||||
|
Changelog: wiki:Release0.6.1
|
||||||
|
|
||||||
|
* No known backward incompatible changes
|
||||||
|
|
||||||
|
## 0.7.0
|
||||||
|
|
||||||
|
Changelog: wiki:Release0.7.0
|
||||||
|
|
||||||
|
* Major behavior change: PostGIS plugin now throws `mapnik::datasource_exception` when queries fail.
|
||||||
|
* Width/height/type attributes of PointSymbolizer and ShieldSymbolizer now optional (auto-calculated).
|
||||||
|
* Text vertical_alignment now dependent on dy (#485, r1527).
|
||||||
|
|
||||||
|
## 0.7.1
|
||||||
|
|
||||||
|
Changelog: wiki:Release0.7.1
|
||||||
|
|
||||||
|
* Behavior change in SCons build, should now prefer linking to user installed libraries over system libs.
|
||||||
|
* Width/height/type attributes of PolygonPatternSymbolizer and LinePatternSymbolizer now optional (auto-calculated).
|
||||||
|
* Better quantized PNG output
|
||||||
|
|
||||||
|
## 0.7.2
|
||||||
|
|
||||||
|
Changelog: TBA
|
||||||
|
|
||||||
|
* Bug fix and forward compatibility (with Mapnik 2.0.0) release
|
||||||
|
* No backwards incompatible changes, except that it will default to using Mapnik 2 XML syntax for `mapnik.save_map()` format.
|
||||||
|
|
||||||
|
## 2.0.0
|
||||||
|
|
||||||
|
Changelog: wiki:Release2.0.0
|
||||||
|
|
||||||
|
* This release include significant refactoring in Mapnik core.
|
||||||
|
* This release is a major new version and brings several deprecation warnings and backward incompatible changes. See http://trac.mapnik.org/wiki/Mapnik2/Changes for more details.
|
||||||
|
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
* [Learn about development Milestones](http://trac.mapnik.org/roadmap?show=all)
|
||||||
|
* Download source code for releases at MapnikInstallation
|
109
MapnikRenderers.md
Normal file
109
MapnikRenderers.md
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
<!-- Name: MapnikRenderers -->
|
||||||
|
<!-- Version: 23 -->
|
||||||
|
<!-- Last-Modified: 2011/05/16 11:21:27 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
# Mapnik Renderers
|
||||||
|
|
||||||
|
Mapnik supports a variety of rendering backends. See OutputFormats for comparisons of different output formats.
|
||||||
|
|
||||||
|
## agg_renderer | Anti-Grain Geometry
|
||||||
|
|
||||||
|
The AGG renderer ([Antigrain Geometry](http://antigrain.com)) is the primary renderer in Mapnik.
|
||||||
|
* AGG 's fast scanline rendering with subpixel *anti-aliasing* is the standout reason for the beauty of Mapnik output.
|
||||||
|
* [Anti-Aliasing](http://en.wikipedia.org/wiki/Antialiasing) and [Subpixel Rendering](http://en.wikipedia.org/wiki/Subpixel_rendering) on Wikipedia
|
||||||
|
* The AGG renderer's buffer can easily be encoded in a variety of formats. Currently Mapnik supports writing to png and jpeg.
|
||||||
|
* 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
|
||||||
|
|
||||||
|
|
||||||
|
== 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
|
||||||
|
* http://trac.mapnik.org/log/trunk/src/cairo_renderer.cpp
|
||||||
|
* Cairo has the '''added advantage''' of supporting both Vector and Raster output.
|
||||||
|
* Mapnik can render to any [http://www.cairographics.org/manual/cairo-surfaces.html surface] supported by cairo, either directly or by rendering to a cairo [http://www.cairographics.org/manual/cairo-context.html context].
|
||||||
|
* 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
|
||||||
|
|
||||||
|
|
||||||
|
### Python Example Code
|
||||||
|
|
||||||
|
Writing to SVG with Mapnik's Cairo renderer:
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
import mapnik
|
||||||
|
import cairo
|
||||||
|
|
||||||
|
mapfile = 'mapfile.xml'
|
||||||
|
projection = '+proj=latlong +datum=WGS84'
|
||||||
|
|
||||||
|
mapnik_map = mapnik.Map(1000, 500)
|
||||||
|
mapnik.load_map(mapnik_map, mapfile)
|
||||||
|
bbox = mapnik.Envelope(-180.0,-90.0,180.0,90.0)
|
||||||
|
mapnik_map.zoom_to_box(bbox)
|
||||||
|
|
||||||
|
# Write to SVG
|
||||||
|
surface = cairo.SVGSurface('mapfile.svg', mapnik_map.width, mapnik_map.height)
|
||||||
|
mapnik.render(mapnik_map, surface)
|
||||||
|
surface.finish()
|
||||||
|
|
||||||
|
# Or write to PDF
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
## svg_renderer
|
||||||
|
The SVG renderer is written by Carlos López Garcés, started as part of GSOC 2010 and the "better printing project". The idea is that while the Cairo backend offers both PDF and SVG support, we can do better by having a custom implementation to handle things such as layer grouping, re-used of svg/bitmap symbols, and texts on paths. Only the basics are implemented at this point and those needed custom features are still a ways off, but the renderer has much promise. Currently is is not built by default but can be enabled with the build flag `SVG_RENDERER=True`.
|
||||||
|
|
||||||
|
The svg_renderer uses some very cool features of boost karma to generate SVG really fast and should be a good example of ways to leverage boost karma more in the future, potentially for other types of innovative vector output.
|
||||||
|
|
||||||
|
## grid_renderer
|
||||||
|
The Grid renderer is designed to output highly optimized feature "hit grids". It does this by leveraging and extending modular parts of the antigrain geometry library to rasterize feature id's into a buffer, then outputs metadata about the relevant feature attributes for the given ids, all enclosed within a compact, highly compressible json file. The grid_renderer will first be available in the Mapnik 2.0 release and landed in trunk in r2840.
|
||||||
|
|
||||||
|
There is a sample application showing how to use the output at https://github.com/springmeyer/gridsforkids#readme.
|
||||||
|
|
||||||
|
The grid renderer output targets >= 1.1 of the mbtiles interaction spec found at https://github.com/mapbox/mbtiles-spec/. Specifically it targets "grid.json" a [UTF8 Grid format](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md) which is then handled by client javascript code as detailed in the [Interaction spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/interaction.md).
|
||||||
|
|
||||||
|
The client javascript library that works with all major javascript mapping APIs and has the logic to interface with the json grids is called WAX and is located at https://github.com/mapbox/wax. Specifically the control for parsing the grid.json is in https://github.com/mapbox/wax/blob/master/control/lib/gridutil.js and depends on a metadata file called layer.json to instruct about how the feature data should be formatted in the browser.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Further References
|
||||||
|
|
||||||
|
* [OSGEO Discussion of Rendering](http://wiki.osgeo.org/wiki/OSGeo_Cartographic_Library)
|
||||||
|
* [GRASS GIS use of Cairo](http://trac.osgeo.org/grass/browser/grass/trunk/lib/cairodriver)
|
||||||
|
* [Cairo Vs. AGG Comparison](http://goodythoughts.blogspot.com/2008/03/why-cairo-vs-agg.html)
|
||||||
|
* [Blog post on Skia (Chrome Renderer) in context of AGG and Cairo](http://www.gnashdev.org/?q=node/57)
|
||||||
|
* [Agg inclusion in Boost thread - see 'A preliminary proposal: AGG project'](http://lists.boost.org/Archives/boost/2002/05/index.php)
|
||||||
|
* [Good intro into anti-aliased font issues](http://www.joelonsoftware.com/items/2007/06/12.html)
|
||||||
|
|
34
MapnikTutorials.md
Normal file
34
MapnikTutorials.md
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<!-- Name: MapnikTutorials -->
|
||||||
|
<!-- Version: 8 -->
|
||||||
|
<!-- Last-Modified: 2010/01/25 15:40:55 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
# Mapnik Tutorials
|
||||||
|
|
||||||
|
Make sure to see LearningMapnik for more topics
|
||||||
|
|
||||||
|
## Hello World
|
||||||
|
|
||||||
|
GettingStarted - 'Hello,world!' using the Python bindings.
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
[[Image(hello.png)]]
|
||||||
|
|
||||||
|
## World Population
|
||||||
|
|
||||||
|
[wiki:XMLGettingStarted] - Python and XML styling
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
[[Image(population.png)]]
|
||||||
|
|
||||||
|
|
||||||
|
## Advanced Resources
|
||||||
|
[[BR]]
|
||||||
|
[[Image(14__5531__9871.png)]]
|
||||||
|
|
||||||
|
* MapsFromScratch - http://mapsfromscratch.com/
|
||||||
|
* Cascadenik Tutorial - http://mapnik-utils.googlecode.com/svn/trunk/serverside/cascadenik/doc/index.html
|
||||||
|
* Quantumnik - http://bitbucket.org/springmeyer/quantumnik
|
||||||
|
* ExampleCode -- Code snippets from Mapnik users
|
||||||
|
|
||||||
|
|
||||||
|
For details on Mapnik features see LearningMapnik
|
82
MapnikUtilities.md
Normal file
82
MapnikUtilities.md
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<!-- Name: MapnikUtilities -->
|
||||||
|
<!-- Version: 7 -->
|
||||||
|
<!-- Last-Modified: 2011/04/28 09:41:33 -->
|
||||||
|
<!-- Author: manelclos -->
|
||||||
|
## Mapnik Utilities
|
||||||
|
|
||||||
|
Third party scripts, applications, and approaches for working with mapnik
|
||||||
|
|
||||||
|
Add more here as you find them.
|
||||||
|
|
||||||
|
|
||||||
|
## Styling Tools
|
||||||
|
### Cascadenik
|
||||||
|
|
||||||
|
[Mapnik-utils](http://code.google.com/p/mapnik-utils/) - Cascading Stylesheets For Mapnik
|
||||||
|
|
||||||
|
### Spreadnik
|
||||||
|
|
||||||
|
[Spreadnik](http://wiki.openstreetmap.org/wiki/Spreadnik) - An utility to simplify work with big mapnik stylesheets
|
||||||
|
|
||||||
|
### mess.js
|
||||||
|
|
||||||
|
[mess.js](https://github.com/developmentseed/mess.js) - Extended, Fast Styling for Mapnik
|
||||||
|
|
||||||
|
## Mapping UI
|
||||||
|
### OpenLayers
|
||||||
|
|
||||||
|
[OpenLayers and Custom Tiles](http://trac.openlayers.org/wiki/UsingCustomTiles) - Tips for server pre-generated Mapnik tiles with OpenLayers
|
||||||
|
|
||||||
|
=== Polymaps ===
|
||||||
|
|
||||||
|
http://polymaps.org/
|
||||||
|
|
||||||
|
|
||||||
|
## Tile Servers
|
||||||
|
|
||||||
|
### Mod Tile
|
||||||
|
|
||||||
|
[Mod Tile](http://wiki.openstreetmap.org/index.php/Mod_tile) - The tool OSM uses to render mapnik tiles for http://tile.openstreetmap.org/
|
||||||
|
* [OSM Slippy Map](http://wiki.openstreetmap.org/index.php/Slippy_Map) - Overview OSM rendering | [Roll your own](http://wiki.openstreetmap.org/index.php/Deploying_your_own_Slippy_Map)
|
||||||
|
|
||||||
|
### TileCache
|
||||||
|
|
||||||
|
[TileCache](http://tilecache.org/) - Use WMS-C to render tiles dynamically, or cached | [Example in OL](http://labs.metacarta.com/osm/)
|
||||||
|
|
||||||
|
|
||||||
|
## WMS Servers
|
||||||
|
|
||||||
|
### OgcServer
|
||||||
|
|
||||||
|
Python-based WMS 1.1 and 1.3 server.
|
||||||
|
|
||||||
|
See [OgcServer](https://github.com/mapnik/OGCServer) for more info.
|
||||||
|
|
||||||
|
### Paleoserver
|
||||||
|
|
||||||
|
C++ WMS server.
|
||||||
|
|
||||||
|
See [wiki:Paleoserver] for more info.
|
||||||
|
|
||||||
|
## Desktop Tools
|
||||||
|
|
||||||
|
### MapnikViewer
|
||||||
|
|
||||||
|
A QT Desktop App for interactively viewing XML mapfiles
|
||||||
|
|
||||||
|
See MapnikViewer for more info.
|
||||||
|
|
||||||
|
### Quantumnik
|
||||||
|
Plugin to QGIS for using Mapnik
|
||||||
|
|
||||||
|
See http://bitbucket.org/springmeyer/quantumnik/
|
||||||
|
|
||||||
|
## Nik2Img
|
||||||
|
|
||||||
|
[wiki:Nik2Img] -- Read in an XML mapfile and output a map
|
||||||
|
|
||||||
|
## Shapeindex
|
||||||
|
|
||||||
|
[Shapeindex](https://trac.mapnik.org/browser/trunk/utils/shapeindex) - Quad-tree shapefile indexes for a serious speed boost
|
||||||
|
|
||||||
|
Installed as part of the SCons build.
|
133
MapnikViewer.md
Normal file
133
MapnikViewer.md
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
<!-- Name: MapnikViewer -->
|
||||||
|
<!-- Version: 21 -->
|
||||||
|
<!-- Last-Modified: 2011/02/07 21:46:12 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
The Mapnik Viewer is a GUI tool for rendering and viewing maps based on Mapnik XML mapfiles.
|
||||||
|
|
||||||
|
It's available under source:trunk/demo/viewer and needs to be compiled after manually modifying the build settings.
|
||||||
|
|
||||||
|
----
|
||||||
|
[[BR]]
|
||||||
|
[[Image(mapnik_viewer.png)]]
|
||||||
|
----
|
||||||
|
|
||||||
|
== A Desktop XML Viewer ==
|
||||||
|
|
||||||
|
1. View tile images on-the-fly.
|
||||||
|
2. Debug information on bad config files, points to the erroneous line.
|
||||||
|
3. Shows scale and envelope for current view.
|
||||||
|
4. Fast zooming and point-based attribute queries.
|
||||||
|
5. Export to a variety of formats including tif.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
* A working Mapnik installation
|
||||||
|
* A Mapnik XML file to view
|
||||||
|
* Qt4 including dev files (for example, see [Qt/Mac Open Source Edition](http://trolltech.com/developer/downloads/qt/mac))
|
||||||
|
* Qmake
|
||||||
|
|
||||||
|
## Compiling
|
||||||
|
|
||||||
|
1. Modify [source:trunk/demo/viewer/viewer.pro viewer.pro] to match your system include and lib directories for boost, your mapnik build, unicode, and freetype.
|
||||||
|
* Most default installs put the mapnik libs and includes in `usr/local`, thus requiring an include like:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
INCLUDEPATH += /usr/local/include/mapnik
|
||||||
|
* And a lib like:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
unix:LIBS += -L/usr/local/lib -lmapnik
|
||||||
|
* And to link boost, freetype, and unicode from macports on Mac 10.5, for example, would require:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
INCLUDEPATH += /opt/local/include/boost-1_35
|
||||||
|
INCLUDEPATH += /opt/local/include/unicode
|
||||||
|
INCLUDEPATH += /opt/local/include/freetype2
|
||||||
|
INCLUDEPATH += /opt/local/include
|
||||||
|
unix:LIBS += -L/opt/local/lib -lfreetype
|
||||||
|
|
||||||
|
* Since Ubuntu 10.04 those settings are enough:
|
||||||
|
|
||||||
|
QMAKE_CXXFLAGS +=' -ansi'
|
||||||
|
INCLUDEPATH += /usr/include/freetype2
|
||||||
|
LIBS += -lmapnik
|
||||||
|
|
||||||
|
* A patch for Mac OS 10.5 is [attachment:wiki:MapnikViewer:viewer.patch viewable here], and [downloadable here](http://trac.mapnik.org/raw-attachment/wiki/MapnikViewer/viewer.patch)
|
||||||
|
|
||||||
|
2. Modify main.cpp by setting the correct paths to Mapnik's plug-ins and fonts directories
|
||||||
|
* [source:trunk/demo/viewer/main.cpp?order=date&desc=1#L33 Lines 33 - 37]
|
||||||
|
* On most systems these lines should point to`/usr/local/lib/mapnik/`
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
datasource_cache::instance()->register_datasources("/usr/local/lib/mapnik/input");
|
||||||
|
freetype_engine::register_font("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf");
|
||||||
|
freetype_engine::register_font("/usr/local/lib/mapnik/fonts/DejaVuSans-Bold.ttf");
|
||||||
|
freetype_engine::register_font("/usr/local/lib/mapnik/fonts/DejaVuSansMono.ttf");
|
||||||
|
|
||||||
|
3. Then run Qmake to generate a makefile
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
cd mapnik-svn-tree/demo/viewer
|
||||||
|
qmake -makefile
|
||||||
|
|
||||||
|
On Mac OSX the above will generate an Xcodeproject. To generate a normal Makefile do:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
qmake -spec macx-g++
|
||||||
|
|
||||||
|
4. Finally, run Make to build the *viewer.app* or *viewer.exe*
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
make
|
||||||
|
|
||||||
|
(On OS X, you may need to instead run "open viewer.xcodeproj" to open the project in Apple's XCode environment.)
|
||||||
|
|
||||||
|
* Your make output should be something like:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ make
|
||||||
|
make -f Makefile.Release
|
||||||
|
/opt/local/bin/uic forms/about.ui -o ui_about.h
|
||||||
|
/opt/local/bin/uic forms/info.ui -o ui_info.h
|
||||||
|
/opt/local/bin/uic forms/layer_info.ui -o ui_layer_info.h
|
||||||
|
c++ -c -pipe -DDARWIN -Os -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/local/share/qt4/mkspecs/macx-g++ -I. -I/opt/local/include/qt4/QtCore -I/opt/local/include/qt4/QtCore -I/opt/local/include/qt4/QtGui -I/opt/local/include/qt4/QtGui -I/opt/local/include/qt4 -I/usr/local/include/mapnik -I/opt/local/include/boost-1_35 -I/opt/local/include/unicode -I/opt/local/include -I/opt/local/include/freetype2 -I. -Irelease -I. -o release/main.o main.cpp
|
||||||
|
[...]
|
||||||
|
* If it fails you need to go back to the viewer.pro and set more lib and include paths
|
||||||
|
* A successful build will output the ready to run graphical program in that directory.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Double click on the resulting application (viewer.app on Mac OS)
|
||||||
|
* You can then load map files from the file menu (make sure you have absolute paths set to datasources).
|
||||||
|
* Hit the *Home* button to zoom to the data extent.
|
||||||
|
* The rest should be obvious.
|
||||||
|
|
||||||
|
You can also load your XML files when launching the viewer from a terminal:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# On linux this would look like:
|
||||||
|
# ./viewer /path/to/your.xml
|
||||||
|
# On mac this would look like:
|
||||||
|
$ ./viewer.app/Contents/MacOS/viewer /path/to/your.xml
|
||||||
|
# or
|
||||||
|
$ open -a viewer
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# ./viewer your.xml -1,50,1,52
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# ./viewer # (open your.xml from file menu)
|
||||||
|
|
||||||
|
## Further Reading
|
||||||
|
|
||||||
|
Related mailing list discussions:
|
||||||
|
|
||||||
|
* https://lists.berlios.de/pipermail/mapnik-devel/2008-February/000501.html
|
62
MarkersSymbolizer.md
Normal file
62
MarkersSymbolizer.md
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<!-- Name: MarkersSymbolizer -->
|
||||||
|
<!-- Version: 9 -->
|
||||||
|
<!-- Last-Modified: 2010/09/26 07:50:00 -->
|
||||||
|
<!-- Author: Ldp -->
|
||||||
|
MarkersSymbolizer, is experimental and added in r557. It currently accepts no options (see #408) but the development version supports these options:
|
||||||
|
|
||||||
|
||*Name*||*Description*||*Default*|| Applies to SVG ||
|
||||||
|
||allow_overlap||Allow the symbolizer to overlap others.||false||yes ||
|
||||||
|
||spacing||Distance between markers in pixels.||100||yes ||
|
||||||
|
||max_error||Maximum amount the marker can be move from its designated place to avoid collisions. This value is a fraction of "spacing", e.g. spacing = 100, max_error = 0.2 then the maximum the marker can be moved is 20pixels, if this is not enough it isn't drawn at all. || 0.2 ||yes ||
|
||||||
|
||filename||The SVG file to use for the marker ||built-in marker||yes ||
|
||||||
|
||transform||[SVG transform](http://www.w3.org/TR/SVG/coords.html#TransformAttribute) || identity || yes ||
|
||||||
|
||opacity|| Opacity||1.0|| yes ||
|
||||||
|
||fill||Color of the marker fill, e.g. #FFFFFF. This property is only used when the marker is NOT an SVG graphic. || blue|| no ||
|
||||||
|
|| stroke || CSS colour - A Color value such as 'green' or #A3D979 || black || no ||
|
||||||
|
|| stroke-width || 0.0 - n - Width of outline in pixels || 1.0 || no ||
|
||||||
|
|| stroke-opacity || 0.0 - 1.0 - 1 is fully opaque while zero is fully transparent and .5 would be 50% transparent || 1.0 || no ||
|
||||||
|
|| width || width of marker || 5 || no ||
|
||||||
|
|| height || height of marker || 5 || no ||
|
||||||
|
|| placement || "point" or "line" || line || no (todo) ||
|
||||||
|
|| marker_type || "arrow" "ellipse" || "arrow" if line placement, "ellipse" if point placement || no ||
|
||||||
|
|
||||||
|
It can be added to a Rule with line features like:
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<MarkersSymbolizer />
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
[[Image(http://trac.mapnik.org/raw-attachment/ticket/180/offsets_directions.png)]]
|
||||||
|
|
||||||
|
The MarkersSymbolizer should draw blue directional arrows *in the direction of the geometry* (for things like one-way streets).[[BR]]
|
||||||
|
In case you notice arrows pointing the wrong direction, this means that the segment has been coded in the wrong way.[[BR]]
|
||||||
|
The ST_reverse function of Postgis can fix this (The problem will then be to identify the geometries that need to be updated).
|
||||||
|
|
||||||
|
### SVG markers
|
||||||
|
*NEW*: Staring from r1793 MarkersSymbolizer supports [Scalable Vector Graphics (SVG)](http://www.w3.org/TR/SVG/) as input images:
|
||||||
|
|
||||||
|
[[Image(markers_symbolizer.png)]]
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Rule>
|
||||||
|
<MaxScaleDenominator>10000</MaxScaleDenominator>
|
||||||
|
<MarkersSymbolizer spacing="100" file="/Users/artem/Desktop/svg/ladybird.svg" transform="translate(0 -16) scale(2.0)"/>
|
||||||
|
</Rule>
|
||||||
|
|
||||||
|
### Dynamic Ellipses
|
||||||
|
*NEW*: Starting from r2158 MarkersSymbolizer supports width/height/fill/stroke properties to dynamically draw circles (w == h) or ellipses (w != h) when no SVG file is supplied:
|
||||||
|
|
||||||
|
[[Image(dynamic_ellipse_markers.png)]]
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<MarkersSymbolizer fill="darkorange" opacity=".7" width="20" height="10" stroke="orange" stroke-width="7" stroke-opacity=".2" placement="point" marker_type="ellipse"/>
|
||||||
|
|
||||||
|
CAVEAT: these properties do not apply to SVG files, and SVG transforms are not supported for modifying ellipses (yet).
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
OSM currently renders one-way street arrows with Mapnik using several stacked LineSymbolizers with varying dash-arrays, but could potentially use the MarkersSymbolizer in the future:
|
||||||
|
|
||||||
|
|
||||||
|
<LinePatternSymbolizer file="/home/mapnik/mapnik/symbols/arrow.png" type="png" width="74" height="8" />
|
17
MaxScaleDenominator.md
Normal file
17
MaxScaleDenominator.md
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<!-- Name: MaxScaleDenominator -->
|
||||||
|
<!-- Version: 2 -->
|
||||||
|
<!-- Last-Modified: 2008/12/05 08:53:23 -->
|
||||||
|
<!-- Author: sven -->
|
||||||
|
Activates the rule, if [ScaleAndPpi scale] < MaxScaleDenominator + 1e-6
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Style name="text">
|
||||||
|
<Rule>
|
||||||
|
<Filter>[place] = 'city'</Filter>
|
||||||
|
<MaxScaleDenominator>10000000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>2000000</MinScaleDenominator>
|
||||||
|
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="10" fill="#000" dy="0" halo_radius="1" wrap_width="0"/>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
16
MemoryDatasource.md
Normal file
16
MemoryDatasource.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!-- Name: MemoryDatasource -->
|
||||||
|
<!-- Version: 2 -->
|
||||||
|
<!-- Last-Modified: 2011/09/01 13:38:53 -->
|
||||||
|
<!-- Author: Ollie -->
|
||||||
|
# MemoryDatasource
|
||||||
|
|
||||||
|
*New in 0.8 (aka mapnik2)*
|
||||||
|
|
||||||
|
A in-memory datasource. Sample usage:
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
|
||||||
|
from mapnik2 import Feature, MemoryDatasource, Geometry2d
|
||||||
|
ds = MemoryDatasource()
|
||||||
|
ds.add_feature(Feature(1, Geometry2d.from_wkt("POINT(2 5)"), name="Alberto"))
|
185
MetaWriter.md
Normal file
185
MetaWriter.md
Normal file
|
@ -0,0 +1,185 @@
|
||||||
|
<!-- Name: MetaWriter -->
|
||||||
|
<!-- Version: 25 -->
|
||||||
|
<!-- Last-Modified: 2011/07/23 05:22:36 -->
|
||||||
|
<!-- Author: herm -->
|
||||||
|
# MetaWriter
|
||||||
|
|
||||||
|
[[subpage(DevFeature,false)]]
|
||||||
|
|
||||||
|
MetaWriters are a way of outputting vector features from Mapnik that exactly match the representations of rendered features. The idea is to allow for highly customizable output of specific features rendered into tiles that should also be made available as vectors to a web browser for interactivity. This support was added by Hermann Kraus (mail: herm @@@ scribus.info) in the GSOC project "Hit Areas" http://trac.mapnik.org/wiki/GSOC2010/Ideas#Supportforoutputtinghit-areas.
|
||||||
|
|
||||||
|
A blog post on the idea is at: http://mapnik.org/news/2010/jul/06/gsoc2010_halfway/.
|
||||||
|
|
||||||
|
Slides from State of the Map Europe 2011 are [available](http://trac.mapnik.org/attachment/wiki/MetaWriter/metawriter-slides-sotmeu.pdf).
|
||||||
|
|
||||||
|
See also Herm's demo, which highlights both visible and invisible features: http://r2d2.stefanm.com/mapnik/demo.html
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
[[Image(metawriter_bbox_around_width_plus_stroke.png)]]
|
||||||
|
[[BR]]
|
||||||
|
The above graphic highlights output (geojson) representing the clickable area of a MarkersSymbolizer rendered circle. This circle can change size dynamically depending on the width/height of the shape plus the thickness of the stroke and the bbox output by the MetaWriter will be intelligent to all rendering parameters.
|
||||||
|
|
||||||
|
## MetaWriter Configuration
|
||||||
|
The configuration for a MetaWriter is done as a child element of the Map.
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Map>
|
||||||
|
|
||||||
|
<MetaWriter name="meta1" type="json" file="map_meta.json"/>
|
||||||
|
|
||||||
|
<!--..snip..-->
|
||||||
|
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
Parameters are:
|
||||||
|
* `name` (required)
|
||||||
|
* Assign a name to your metawriter so that it can be referenced from a symbolizer
|
||||||
|
* `type` (required)
|
||||||
|
* currently 'json' and 'inmem' are the only supported types
|
||||||
|
* `file` (json only, required)
|
||||||
|
* relative or absolute path to the file-based output (currently json) - in the future could potentially be other kinds of output
|
||||||
|
* NOTE: this parameter accepts variable replacement (internally it is a PathExpression) so that for a given render the path can be dynamically constructed (see below for more details)
|
||||||
|
* `output-empty` (json only, optional)
|
||||||
|
* if true (default) output json files even if no features are intersected, which will write an FeatureCollection with an empty features list
|
||||||
|
* `default-output` (optional)
|
||||||
|
* this is a comma delimited list of attributes to output for every metawriter attached to a symbolizer
|
||||||
|
* example: `default-output="field1,field2"`
|
||||||
|
* if not specified, for attributes to be output they must be requested in the symbolizer using the `meta-output` parameter
|
||||||
|
* `pixel-coordinates` (relevant to json output format only, default=off) Output in image coordinates rather than long/lat (epsg:4326).
|
||||||
|
|
||||||
|
|
||||||
|
## Caveats
|
||||||
|
* If no features are encountered no json file is output (unless you pass the option `output-empty="true"`)
|
||||||
|
* output projection is currently hardcoded to WGS84/EPSG:4326
|
||||||
|
* precision for geometries is currently fixed at 8
|
||||||
|
|
||||||
|
## Attaching writers to symbolizers
|
||||||
|
|
||||||
|
To actually trigger a metawriter to output features you need to attach one to a symbolizer.
|
||||||
|
|
||||||
|
Parameters that symbolizers accept (the relate to metawriters) are:
|
||||||
|
* `meta-writer` - the name of the MetaWriter to use
|
||||||
|
* `meta-output` - attributes to write out for this specific symbolizer
|
||||||
|
|
||||||
|
For example, this would output geojson features (bbox's as polygons) for every point rendered by the symbolizer:
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<PointSymbolizer meta-writer="meta1"/>
|
||||||
|
|
||||||
|
Example feature output:
|
||||||
|
|
||||||
|
#!py
|
||||||
|
{ "type": "Feature",
|
||||||
|
"geometry": { "type": "Polygon",
|
||||||
|
"coordinates": [ [ [11.07451289, 49.45187982], [11.07481352, 49.45187982], [11.07481352, 49.45218044], [11.07451289, 49.45218044] ] ]},
|
||||||
|
"properties": {
|
||||||
|
} },
|
||||||
|
|
||||||
|
This would do the same but also dump out the values for the attributes of 'amenity' and 'name':
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<PointSymbolizer meta-writer="meta1" meta-output="amenity,name"/>
|
||||||
|
|
||||||
|
Example feature output:
|
||||||
|
|
||||||
|
|
||||||
|
#!py
|
||||||
|
{ "type": "Feature",
|
||||||
|
"geometry": { "type": "Polygon",
|
||||||
|
"coordinates": [ [ [11.07804522, 49.45285684], [11.07834585, 49.45285684], [11.07834585, 49.45315747], [11.07804522, 49.45315747] ] ]},
|
||||||
|
"properties": {
|
||||||
|
"amenity":"pharmacy",
|
||||||
|
"name":"Spital Apotheke"
|
||||||
|
} },
|
||||||
|
## Dynamically constructing metawriter file path
|
||||||
|
|
||||||
|
To dynamically contruct a file path for where to write out meta-features you can use variable replacement like:
|
||||||
|
|
||||||
|
### in your xml
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<MetaWriter name="meta1" type="json" file="[tile_dir]/[z]/[x]/[y].json"/>
|
||||||
|
|
||||||
|
### in your calling program
|
||||||
|
|
||||||
|
#!py
|
||||||
|
import os
|
||||||
|
import mapnik2 as mapnik
|
||||||
|
|
||||||
|
m = mapnik.Map(256,256)
|
||||||
|
x,y,z = 0,1,1
|
||||||
|
tile_dir = '.'
|
||||||
|
mapnik.load_map(m,'map.xml') # this 'map.xml' must contain a MetaWriter like above
|
||||||
|
m.zoom_all()
|
||||||
|
m.set_metawriter_property("x", str(x))
|
||||||
|
m.set_metawriter_property("y", str(y))
|
||||||
|
m.set_metawriter_property("z", str(z))
|
||||||
|
m.set_metawriter_property("tile_dir", tile_dir)
|
||||||
|
dir_ = '%s/%s/%s' % (tile_dir,z,x)
|
||||||
|
if not os.path.exists(dir_):
|
||||||
|
os.makedirs(dir_)
|
||||||
|
mapnik.render_to_file(m,'%s/%s/%s/%s.png' % (tile_dir,z,x,y))
|
||||||
|
|
||||||
|
|
||||||
|
## Example XML (with PathExpresion)
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Map bgcolor="white" srs="+proj=latlong +datum=WGS84">
|
||||||
|
|
||||||
|
<MetaWriter name="points" type="json" file="[tile_dir]/[z]/[x]/[y].json"/>
|
||||||
|
|
||||||
|
<Style name="points">
|
||||||
|
<Rule>
|
||||||
|
<Filter>([amenity] neq '') and ([name] neq '')</Filter>
|
||||||
|
<PointSymbolizer meta-writer="points" meta-output="amenity,name"/>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Layer name="osm" srs="+proj=latlong +datum=WGS84">
|
||||||
|
<StyleName>points</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="type">osm</Parameter>
|
||||||
|
<Parameter name="file">testing.osm</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
</Map>
|
||||||
|
|
||||||
|
|
||||||
|
## Example XML (without PathExpresion)
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Map bgcolor="white" srs="+proj=latlong +datum=WGS84">
|
||||||
|
|
||||||
|
<MetaWriter name="points" type="json" file="points.json"/>
|
||||||
|
|
||||||
|
<MetaWriter name="lines" type="json" file="lines.json"/>
|
||||||
|
|
||||||
|
<Style name="points">
|
||||||
|
<Rule>
|
||||||
|
<Filter>([amenity] neq '') and ([name] neq '')</Filter>
|
||||||
|
<PointSymbolizer meta-writer="points" meta-output="amenity,name"/>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style name="lines">
|
||||||
|
<Rule>
|
||||||
|
<Filter>([highway] neq '') and ([name] neq '')</Filter>
|
||||||
|
<LineSymbolizer stroke-width="5" stroke="green" meta-writer="lines" meta-output="highway,name"/>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Layer name="osm" srs="+proj=latlong +datum=WGS84">
|
||||||
|
<StyleName>lines</StyleName>
|
||||||
|
<StyleName>points</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="type">osm</Parameter>
|
||||||
|
<Parameter name="file">testing.osm</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
</Map>
|
||||||
|
|
28
MinScaleDenominator.md
Normal file
28
MinScaleDenominator.md
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!-- Name: MinScaleDenominator -->
|
||||||
|
<!-- Version: 3 -->
|
||||||
|
<!-- Last-Modified: 2009/04/03 14:37:17 -->
|
||||||
|
<!-- Author: tmcw -->
|
||||||
|
Activates the rule, if [ScaleAndPpi scale] >= minScaleDenominator - 1e-6
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Style name="text">
|
||||||
|
<Rule>
|
||||||
|
<Filter>[place] = 'city'</Filter>
|
||||||
|
<MaxScaleDenominator>10000000</MaxScaleDenominator>
|
||||||
|
<MinScaleDenominator>2000000</MinScaleDenominator>
|
||||||
|
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="10" fill="#000" dy="0" halo_radius="1" wrap_width="0"/>
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
|
#!python
|
||||||
|
thin_lines_rule = Rule()
|
||||||
|
thin_lines_rule.min_scale = 2500001
|
||||||
|
thin_lines_rule.max_scale = 5000000000000
|
||||||
|
thin_state_line = LineSymbolizer(Color('#A0A0AA'),.5)
|
||||||
|
thin_lines_rule.symbols.append(thin_state_line)
|
||||||
|
state_borders.rules.append( thin_lines_rule )
|
||||||
|
|
||||||
|
It appears that both min and max scale denominators are required. Also, note that if you are writing multiple rules which format items different on x > y > z, reformat to rules which format on x > y + 1, y > z
|
16
ModServer.md
Normal file
16
ModServer.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!-- Name: ModServer -->
|
||||||
|
<!-- Version: 2 -->
|
||||||
|
<!-- Last-Modified: 2008/11/23 18:15:43 -->
|
||||||
|
<!-- Author: tom -->
|
||||||
|
ModServer is an experimental mod_python driver, just like the cgi and wsgi drivers, etc., for Mapnik.
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Mainly it was developed because Mapnik was missing a mod_python-based WMS server. Internally, it's extremely similar to cgiserver.py, and externally, it is identical - as far as WMS compatibility, etc.
|
||||||
|
|
||||||
|
Modserver isn't meant to be a replacement for TileCache - it is quite different in a few ways:
|
||||||
|
|
||||||
|
* Modserver, like cgiserver, etc., supports WMS, not WMS-C
|
||||||
|
* Modserver doesn't have any caching mechanism built in. [We're](http://www.developmentseed.org/) using it with a lightweight PHP cache layer - something Python-based or something that uses memcached is a possibility but right now just plug in what you have.
|
||||||
|
|
||||||
|
Currently the code is available on a [Trac ticket here.](http://trac.mapnik.org/ticket/101) A well-polished patch with error handling is in the works.
|
91
Nik2Img.md
Normal file
91
Nik2Img.md
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<!-- Name: Nik2Img -->
|
||||||
|
<!-- Version: 12 -->
|
||||||
|
<!-- Last-Modified: 2009/10/10 17:37:57 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
* No python coding is required, only a working Mapnik installation and an XML mapfile.
|
||||||
|
* *Nik2img* has a variety of options that make it a useful mapfile debugger.
|
||||||
|
* Using *Nik2img* is an easy way to test and develop your xml mapfiles before launching on a server.
|
||||||
|
* *Nik2img* should automatically open the rendered map once completed.
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
|
||||||
|
[[BR]]
|
||||||
|
[[Image(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
|
121
OCCI.md
Normal file
121
OCCI.md
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
<!-- Name: OCCI -->
|
||||||
|
<!-- Version: 10 -->
|
||||||
|
<!-- Last-Modified: 2010/11/22 03:02:02 -->
|
||||||
|
<!-- Author: kunitoki -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
Mapnik's PluginArchitecture supports the use of different input formats.
|
||||||
|
|
||||||
|
One such plugin supports the Oracle Spatial ([Oracle Spatial](http://en.wikipedia.org/wiki/Oracle_Spatial)) extension to the popular ORACLE database.
|
||||||
|
|
||||||
|
*At the current time, only oracle 10g version >= 10.2.0.1 is supported*
|
||||||
|
|
||||||
|
|
||||||
|
## Installation (On Linux)
|
||||||
|
|
||||||
|
Install the [Oracle Instant Client](http://www.oracle.com/technology/software/tech/oci/instantclient/index.html) package on your system.
|
||||||
|
|
||||||
|
Make sure you define where the includes and library files resides in _config.py_:
|
||||||
|
|
||||||
|
|
||||||
|
OCCI_INCLUDES='/usr/lib/oracle/10.2.0.4/client/include'
|
||||||
|
OCCI_LIBS='/usr/lib/oracle/10.2.0.4/client/lib'
|
||||||
|
|
||||||
|
Make sure that running _python scons/scons.py DEBUG=y_ shows the following line
|
||||||
|
|
||||||
|
Checking for C++ library ociei... yes
|
||||||
|
|
||||||
|
To check if the occi plugin built and was installed correctly, try the usual Python _from mapnik import *_ on a DEBUG=y build, and look for the following debug line
|
||||||
|
|
||||||
|
registered datasource : occi
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### double free or corruption error
|
||||||
|
|
||||||
|
If you have problems when running the oracle input plugin and get this when accessing geometries:
|
||||||
|
|
||||||
|
|
||||||
|
*** glibc detected *** double free or corruption (!prev): 0x08c52568 ***
|
||||||
|
|
||||||
|
go to [http://www.oracle.com/technology/tech/oci/occi/occidownloads.html] and download the package 10.2.0.3.0 and overwrite the libraries in your oracle instantclient install path.
|
||||||
|
|
||||||
|
Look [here](http://bugs.gentoo.org/show_bug.cgi?id=257431) for references on the problem.
|
||||||
|
|
||||||
|
### libtool error: libstdc++.so.5
|
||||||
|
|
||||||
|
libtool error: libstdc++.so.5: cannot open shared object file: No such file or directory
|
||||||
|
Make sure you have compat-libstdc++-33 installed.
|
||||||
|
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
|| *parameter* || *value* || *description* || *default* ||
|
||||||
|
|| host || string || name of the oracle host || ||
|
||||||
|
|| user || string || username to use for connecting || ||
|
||||||
|
|| password || string || user password to use for connecting || ||
|
||||||
|
|| table || string || name of the table to fetch, this can be a sub-query || ||
|
||||||
|
|| geometry_field || string || name of the geometry field, in case you have more than one in a single table || GEOLOC ||
|
||||||
|
|| extent || string || maxextent of the geometries || determined by querying the oracle metadata for the table ||
|
||||||
|
|| row_limit || integer || max number of rows to return when querying data, 0 means no limit || 0 ||
|
||||||
|
|| row_prefetch || integer || number of rows to prefetch from the query before converting them to mapnik features (this allows to finetune the balance between transfer time and conversion time) || 1000 ||
|
||||||
|
|| initial_size || integer || initial size of the stateless connection pool || 1 ||
|
||||||
|
|| max_size || integer || max size of the stateless connection pool || 10 ||
|
||||||
|
|| use_spatial_index || boolean || choose wheter to use the oracle spatial index when fetching data || true ||
|
||||||
|
|| multiple_geometries || boolean || wheter to use multiple different objects or a single one when dealing with multi-objects (this is mainly related to how the label are used in the map, one label for a multi-polygon or one label for each polygon of a multi-polygon)|| false ||
|
||||||
|
|| encoding || string || internal file encoding || utf-8 ||
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Python
|
||||||
|
|
||||||
|
Instantiate a datasource like:
|
||||||
|
|
||||||
|
#!python
|
||||||
|
lyr = Layer('Geometry from Oracle Spatial')
|
||||||
|
lyr.datasource = OCCI(host='localhost',user='scott',password='tiger',table='worldborders',geometry_field='geom')
|
||||||
|
|
||||||
|
### XML
|
||||||
|
|
||||||
|
If you are using XML mapfiles to style your data, then using a Oracle datasource looks like:
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Layer name="countries" status="on" srs="+proj=latlong +datum=WGS84">
|
||||||
|
<StyleName>countries_style_label</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="type">occi</Parameter>
|
||||||
|
<Parameter name="host">localhost</Parameter>
|
||||||
|
<Parameter name="user">scott</Parameter>
|
||||||
|
<Parameter name="password">tiger</Parameter>
|
||||||
|
<Parameter name="table">worldborders</Parameter>
|
||||||
|
<Parameter name="geometry_field">geom</Parameter>
|
||||||
|
<Parameter name="extent">-180,-90,180,89.99</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
|
||||||
|
### C++
|
||||||
|
|
||||||
|
Plugin datasource initialization example code can be found on PluginArchitecture.
|
||||||
|
|
||||||
|
A OCCI datasource may be created as follows:
|
||||||
|
|
||||||
|
|
||||||
|
#!C
|
||||||
|
{
|
||||||
|
parameters p;
|
||||||
|
p["type"]="occi";
|
||||||
|
p["host"]=oracle_server_hostname;
|
||||||
|
p["username"]=oracle_server_username;
|
||||||
|
p["password"]=oracle_server_password;
|
||||||
|
p["table"]="worldborders";
|
||||||
|
p["geometry_field"]="geom";
|
||||||
|
p["extent"]="2309554.99818767,5024797.73763923,2318414.90507308,5040447.94690007"; // optional
|
||||||
|
|
||||||
|
Layer lyr("World Borders");
|
||||||
|
set_datasource(datasource_cache::instance()->create(p));
|
||||||
|
lyr.add_style("worldborders");
|
||||||
|
m.addLayer(lyr);
|
||||||
|
}
|
116
OGR.md
Normal file
116
OGR.md
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
<!-- Name: OGR -->
|
||||||
|
<!-- Version: 10 -->
|
||||||
|
<!-- Last-Modified: 2011/08/03 13:16:21 -->
|
||||||
|
<!-- Author: tmcw -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
Mapnik's PluginArchitecture supports the use of different input formats.
|
||||||
|
|
||||||
|
This plugin supports the [OGR](http://www.gdal.org/ogr/index.html) library in order to read multiple spatial vector formats.
|
||||||
|
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
Make sure that running _python scons/scons.py DEBUG=y_ shows the following line
|
||||||
|
|
||||||
|
Checking for C library gdal... yes
|
||||||
|
Checking for name of ogr library... gdal
|
||||||
|
|
||||||
|
To check if the ogr plugin built and was installed correctly, try the usual Python _from mapnik import *_ on a DEBUG=y build, and look for the following debug line
|
||||||
|
|
||||||
|
registered datasource : ogr
|
||||||
|
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
|
||||||
|
|| *parameter* || *value* || *description* || *default* ||
|
||||||
|
|| file || string || file to display || ||
|
||||||
|
|| base || string || base path where to search for file parameter || ||
|
||||||
|
|| layer || string || name of the layer to display (a single ogr datasource can contain multiple layers) || ||
|
||||||
|
|| layer_by_index || integer || index of the layer to display, this becomes mandatory if no "layer" parameter is specified || ||
|
||||||
|
|| multiple_geometries || boolean || wheter to use multiple different objects or a single one when dealing with multi-objects (this is mainly related to how the label are used in the map, one label for a multi-polygon or one label for each polygon of a multi-polygon)|| false ||
|
||||||
|
|| encoding || string || internal file encoding || utf-8 ||
|
||||||
|
|| string || string || optional (replaces *file* parameter) string of literal OGR-datasource data, like GeoJSON ||
|
||||||
|
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
*Note*: The layer names of OGR datasources are returned by Mapnik in the error message when you do not provide the `layer` parameter.
|
||||||
|
|
||||||
|
#!python
|
||||||
|
>>> import mapnik
|
||||||
|
>>> mapnik.Ogr(file='test_point_line.gpx')
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<stdin>", line 1, in <module>
|
||||||
|
File "/Library/Python/2.5/site-packages/mapnik/__init__.py", line 295, in Ogr
|
||||||
|
return CreateDatasource(keywords)
|
||||||
|
RuntimeError: missing <layer> parameter, available layers are: 'waypoints' 'routes' 'tracks' 'route_points' 'track_points'
|
||||||
|
>>> mapnik.Ogr(file='test_point_line.gpx',layer='waypoints')
|
||||||
|
<mapnik.Datasource object at 0x23f6b0> # works!
|
||||||
|
|
||||||
|
However the best way to discover the layer names is to use the OGR provided utility called `ogrinfo`. For example running `ogrinfo` on a test GPX files provided with the OGR source code reveals the layer names and geometry types:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ ogrinfo test_point_line.gpx
|
||||||
|
Had to open data source read-only.
|
||||||
|
INFO: Open of `test_point_line.gpx'
|
||||||
|
using driver `GPX' successful.
|
||||||
|
1: waypoints (Point)
|
||||||
|
2: routes (Line String)
|
||||||
|
3: tracks (Multi Line String)
|
||||||
|
4: route_points (Point)
|
||||||
|
5: track_points (Point)
|
||||||
|
|
||||||
|
|
||||||
|
## XML
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Layer name="gps_waypoints">
|
||||||
|
<StyleName>waypoint_styles</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="type">ogr</Parameter>
|
||||||
|
<Parameter name="file">test_point_line.gpx</Parameter>
|
||||||
|
<Parameter name="layer">waypoints</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
|
||||||
|
#!xml
|
||||||
|
<Layer name="states">
|
||||||
|
<StyleName>states_shp_styles</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="type">ogr</Parameter>
|
||||||
|
<Parameter name="base">tests/data</Parameter>
|
||||||
|
<Parameter name="file">us_states.shp</Parameter>
|
||||||
|
<!-- OGR supports formats with multiple layers and while shapefiles
|
||||||
|
only have one, we still need to specify it by name -->
|
||||||
|
<Parameter name="layer">us_states</Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
## C++
|
||||||
|
|
||||||
|
Plugin datasource initialization example code can be found on PluginArchitecture.
|
||||||
|
|
||||||
|
A OGR datasource may be created as follows:
|
||||||
|
|
||||||
|
|
||||||
|
#!C
|
||||||
|
{
|
||||||
|
parameters p;
|
||||||
|
p["type"]="ogr";
|
||||||
|
p["file"]="path/to/my/vector/bridges.tab";
|
||||||
|
p["layer"]="bridges";
|
||||||
|
|
||||||
|
set_datasource(datasource_cache::instance()->create(p));
|
||||||
|
|
||||||
|
// Bridges
|
||||||
|
Layer lyr("Bridges");
|
||||||
|
lyr.add_style("bridges");
|
||||||
|
m.addLayer(lyr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Further References
|
5
OgcServer.md
Normal file
5
OgcServer.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!-- Name: OgcServer -->
|
||||||
|
<!-- Version: 16 -->
|
||||||
|
<!-- Last-Modified: 2010/11/22 10:08:09 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
See https://github.com/mapnik/OGCServer
|
5
OgcServerSvn.md
Normal file
5
OgcServerSvn.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!-- Name: OgcServerSvn -->
|
||||||
|
<!-- Version: 1 -->
|
||||||
|
<!-- Last-Modified: 2008/11/14 17:26:43 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[ReST(/trunk/docs/ogcserver/readme.txt)]]
|
387
OpenSolarisInstallation.md
Normal file
387
OpenSolarisInstallation.md
Normal file
|
@ -0,0 +1,387 @@
|
||||||
|
<!-- Name: OpenSolarisInstallation -->
|
||||||
|
<!-- Version: 44 -->
|
||||||
|
<!-- Last-Modified: 2010/12/08 14:44:45 -->
|
||||||
|
<!-- Author: springmeyer -->
|
||||||
|
[[TOC]]
|
||||||
|
|
||||||
|
# Installing Mapnik and Dependencies on Open Solaris
|
||||||
|
|
||||||
|
This guide will describe getting Mapnik and it's dependencies running on the latest Open Solaris release: *2009.06*.
|
||||||
|
|
||||||
|
This is a *non-trivial* exercise. It is highly recommended that you consider using Linux unless Open Solaris is a must. This document was written in late 2010 - your mileage may vary with later versions of Open Solaris. Basically package names may change and other workarounds below (hopefully) will become unneeded.
|
||||||
|
|
||||||
|
In the future hopefully the latest versions of the [GNU compiler (gcc)](http://gcc.gnu.org/) will become better supported on Open Solaris, or better packaging options may be available with [OpenIndiana](http://openindiana.org/) or [Nexenta](http://www.nexenta.org/).
|
||||||
|
|
||||||
|
Basically the challenge here is boost and old, buggy compilers that sun (or sun packages) provide. If you you simply forge ahead compiling boost with suncc or the g++ provided by sun on open solaris you'd hit boost regex, boost python, and boost thread compile errors. You'll likely see problems such as those detailed at the [Open Solaris Troubleshooting page](/wiki:OpenSolarisInstallation/TroubleShooting/).
|
||||||
|
|
||||||
|
If you are finding this guide and do not need to install the boost libraries then this approach is overkill and likely the wrong approach. Most geospatial packages (like geos, proj4, postgis) should compile just fine on open solaris with the existing versions of gcc available. Instead this guide uses a custom compiled gcc44 which makes compiling boost possible, and works great to compile all other packages. The catch is that this approach requires much more care and attention (and some would likely call it insane to built up a whole geostack using a custom compiler not officially supported on the os).
|
||||||
|
|
||||||
|
If anyone does forge ahead using the old tools available from sun and can compile Mapnik trunk and run the python nosetest successfully, then the approach of using gcc44 below may be able to be avoided. If you are this daft, then please update this page with what you've learned.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Testing Details
|
||||||
|
|
||||||
|
* Tested running VirtualBox on OSX 10.6 (64 bit)
|
||||||
|
* Tested using the latest OSOL iso release:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
$ cat /etc/release
|
||||||
|
OpenSolaris 2009.06 snv_111b X86
|
||||||
|
Assembled 07 May 2009
|
||||||
|
|
||||||
|
## Mapnik Details
|
||||||
|
|
||||||
|
You will need at least:
|
||||||
|
|
||||||
|
* Mapnik trunk (>= r2444) (http://svn.mapnik.org/trunk/)
|
||||||
|
* or
|
||||||
|
* Mapnik 0.7.2 (>= r2444) (http://svn.mapnik.org/branches/0.7.2-dev/)
|
||||||
|
|
||||||
|
For 64 bit builds you need to apply patches from #675 and #676
|
||||||
|
|
||||||
|
## Build Details
|
||||||
|
This guide will rely heavily on existing tools for package management on Open Solaris
|
||||||
|
* The 'pkg' tool supplied by Sun
|
||||||
|
* The community 'pkgtool/pkgbuild' tools
|
||||||
|
* The excellent WikiMedia Toolserver `spec` files for use with `pkgtool`
|
||||||
|
|
||||||
|
|
||||||
|
## OpenSolaris Gotchas
|
||||||
|
* Don't use `sudo` use `pfexec` (alias sudo="pfexec")
|
||||||
|
* Vim keystrokes are broken when logging in via ssh from a mac. But typing `:set nocp` fixes things.
|
||||||
|
* Get info on CPUS: `prtdiag -v`
|
||||||
|
* `-G` is the solaris compiler flag for creating a shared library, but recently gcc versions need `-shared`
|
||||||
|
* If the `-shared` flag is missing then your libs will not be properly 'PIC" (position independent code) and this can be diagnosed with:
|
||||||
|
|
||||||
|
elfdump -d /path/to/mylibrary.so | grep TEX # if PIC this should return nothing, if not PIC it will return a few rows
|
||||||
|
* Library runtime linking works differently on solaris than linux.
|
||||||
|
* It is more like mac osx, where libraries hardcode runtime search paths at build time
|
||||||
|
* Except that Solaris needs a special flag to get this to work: `-R/usr/local/lib`
|
||||||
|
* To figure out where a library looks for depedents at runtime do:
|
||||||
|
|
||||||
|
dump -Lv /usr/local/lib/mylibrary.so
|
||||||
|
|
||||||
|
## Step 1: Updating Open Solaris
|
||||||
|
|
||||||
|
Optional: If running VirtualBox, install the guest additions then reboot
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
pfexec reboot
|
||||||
|
|
||||||
|
First we need to update the package manager
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
pfexec pkg install SUNWipkg
|
||||||
|
|
||||||
|
Next, we update to the latest Open Solaris Development environment
|
||||||
|
|
||||||
|
*Note:* If we update the base os image after setting the publisher to the "dev", the gnome/x11 user interface will break and we will only have a command line interface remaining. But, we want to update to dev (and the below guide depends upon it) because we want the ease of getting various packages from dev (via`pkg`) that otherwise we would need to install from source with `ts-specs/pkgtool`. The error upon rebooting that you will see (indicating the loss of X11) is `inetd[6270[: Failed to update state of instance svc: /application/x11/xfs:default in repository`. So, if you don't want to update to the dev environment as you don't want to break the GUI, don't set the publisher before running image-update (and know that certain commands in this guide will fail because dependencies are not going to be found).
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
pfexec pkg set-publisher -O http://pkg.opensolaris.org/dev opensolaris.org
|
||||||
|
pfexec pkg refresh --full
|
||||||
|
# update the package manager if you did not already (otherwise next command will fail)
|
||||||
|
pfexec pkg install SUNWipkg
|
||||||
|
# optional: test upgrade of system
|
||||||
|
pfexec pkg image-update -nv
|
||||||
|
# do actual upgrade (note: upgrades not possible on ec2)
|
||||||
|
pfexec pkg image-update
|
||||||
|
pfexec reboot # then boot into new 'opensolaris-1'
|
||||||
|
|
||||||
|
When you reboot you should see the new version reflected in `/etc/release`:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
cat /etc/release
|
||||||
|
# should get:
|
||||||
|
OpenSolaris Development snv_134 X86
|
||||||
|
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
Use is subject to license terms.
|
||||||
|
Assembled 01 March 2010
|
||||||
|
|
||||||
|
*Note:* This is a new boot environment, see the [solaris docs](http://developers.sun.com/developer/technicalArticles/opensolaris/bootenvironments/index.html) for more info.
|
||||||
|
|
||||||
|
## Step 2: Setting up Sun Studio and Package Installation Tools
|
||||||
|
|
||||||
|
Install Sun Studio and a few other sun provided base development tools you will need to get started:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# install dev tools from sun needed specifically for mapnik build
|
||||||
|
pfexec pkg install SUNWsvn SUNWpython26 SUNWgmake SUNWgcc developer/sunstudio12u1
|
||||||
|
|
||||||
|
# install other dev tools you'll likely need down the road
|
||||||
|
pfexec pkg install gcc-dev SUNWsshd SUNWgnu-readline SUNWcurl SUNWapr13 SUNWapu13 gd
|
||||||
|
|
||||||
|
* NOTE: python26 is available only due to the pkg-update to `dev` which brings us to `snv_134`. If you can and want to compile your own python version, then updating to dev is less critical.
|
||||||
|
|
||||||
|
* CRITICAL: boost_python and mapnik, compiled with gcc44 can run just fine, but if used with the sun proved python26 (which will be linked to a different version of libgcc) then exception handling will likely be broken: http://mail.python.org/pipermail/cplusplus-sig/2010-December/015822.html. At this time this guide uses this approach and their is not currently a clean solution for this problem (short of compiling python from source and all the issues that may arise from that).
|
||||||
|
|
||||||
|
|
||||||
|
## Step 3: Setting up WikiMedia Toolserver's 'ts-specs'
|
||||||
|
|
||||||
|
The WikiMedia project runs Solaris for many of its systems and maintains an excellent rpm-like set of package specs which can be used to built up a robust development and production environment.
|
||||||
|
|
||||||
|
The CATCH with using these build files is that they are written for Solaris not Open Solaris - so *many* hardcoded paths are correct but some are not and cause packages to break unless you are willing to dig deeply to figure out what may be going wrong. So, we do not recommend using the *ts-specs* for anything other that getting gcc44 built, but in the future the *ts-specs* project may have a lot of promise as an awesome way to build up a geo stack.
|
||||||
|
|
||||||
|
So, overally we choose this route because using suncc (Sun's compiler) or the gcc version available in the standard open solaris packages (4.3.x) will lead to hard and lonely dead-ends compiling boost. Boost is an excellent set of libraries but pushes compilers and exposes their bugs. So, basically we need gcc/g++ 4.4 for building boost, and we can get it built, as well as boost (if we choose to, but in this guide we do not), using spec files from WikiMedia Toolservers 'ts-specs'.
|
||||||
|
|
||||||
|
Download the 'ts-spec' repository:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
svn co http://svn.toolserver.org/svnroot/toolserver/trunk/ts-specs -r 568
|
||||||
|
cd ts-specs
|
||||||
|
# confirm that packages should be downloaded locally
|
||||||
|
echo download >~/.pkgtoolrc
|
||||||
|
|
||||||
|
*NOTE: we fetch a specific revision above just for caution and so that the below patch will be sure to apply cleanly. You can update to the latest *ts-specs* if you wish.
|
||||||
|
|
||||||
|
Now we need the pkgtool program to use these spec files. Ultimately we'll install this tool using ts-specs, but first we fetch it and compile ourselves:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# as the root user build latest pkgbuild
|
||||||
|
# http://pkgbuild.sourceforge.net/pkgtool.html
|
||||||
|
wget http://prdownloads.sourceforge.net/pkgbuild/pkgbuild-1.3.103.tar.bz2
|
||||||
|
tar xvf pkgbuild-1.3.103.tar.bz2
|
||||||
|
cd pkgbuild-1.3.103
|
||||||
|
./configure --prefix=/opt/pkgbuild # use a custom prefix so it is easy to uninstall later
|
||||||
|
make
|
||||||
|
pfexec make install
|
||||||
|
|
||||||
|
If you do not already have a non-root user you are using, then set one up now to run the ts-spec installs (pkgtool insists!).
|
||||||
|
|
||||||
|
Optional: If you don't already have a non-root user with admin access do:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
groupadd dev # or your preferable group name
|
||||||
|
export USERNAME=<user> # your new username
|
||||||
|
useradd -g dev -d /export/home/$USERNAME -m -s /bin/bash -c "$USERNAME" $USERNAME
|
||||||
|
passwd $USERNAME
|
||||||
|
export HOME=/export/home/$USERNAME
|
||||||
|
cd $HOME
|
||||||
|
mkdir src
|
||||||
|
export src=$HOME/src
|
||||||
|
export PATH=/opt/ts/bin/:$PATH
|
||||||
|
# give the user rights
|
||||||
|
# http://developers.sun.com/developer/technicalArticles/opensolaris/pfexec.html
|
||||||
|
usermod -P'File System Management' $USERNAME
|
||||||
|
usermod -P'Software Installation' $USERNAME
|
||||||
|
# giving sudo/admin privs
|
||||||
|
usermod -P'Primary Administrator' $USERNAME
|
||||||
|
|
||||||
|
Once done, log out and back in as this new user
|
||||||
|
|
||||||
|
Then, finally install pkgtool via ts-specs and uninstall the source compiled version.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
cd ts-specs # move into ts-specs directory that you download above
|
||||||
|
# as non-root user...
|
||||||
|
/opt/pkgbuild/bin/pkgtool build sysutils/TSpkgbuild
|
||||||
|
# then remove /opt/pkgbuild
|
||||||
|
pfexec rm -rf /opt/pkgbuild
|
||||||
|
|
||||||
|
The expected output from pkgtool is:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
INFO: Copying %use'd or %include'd spec files to SPECS directory
|
||||||
|
INFO: Processing spec files
|
||||||
|
INFO: Finding sources
|
||||||
|
INFO: Downloading source http://mesh.dl.sourceforge.net/sourceforge/pkgbuild/pkgbuild-1.3.98.4.tar.bz2
|
||||||
|
INFO: Running pkgbuild -ba [...] TSpkgbuild.spec (TSpkgbuild)
|
||||||
|
INFO: TSpkgbuild PASSED
|
||||||
|
INFO: Installing TSpkgbuild
|
||||||
|
libnotify-Message: Unable to get session bus: /usr/bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed.
|
||||||
|
|
||||||
|
Summary:
|
||||||
|
|
||||||
|
package | status | details
|
||||||
|
---------------------------------+-------------+-------------------------------
|
||||||
|
TSpkgbuild | PASSED |
|
||||||
|
|
||||||
|
Later on when using pkgtool you will likely see these harmless errors:
|
||||||
|
|
||||||
|
pkgparam: ERROR: unable to locate parameter information for "SUNWcar"
|
||||||
|
pkgparam: ERROR: unable to locate parameter information for "SUNWkvm"
|
||||||
|
|
||||||
|
Now set up the path to the ts-specs install prefix:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
export PATH=/opt/ts/bin/:$PATH # or put this in your bashrc...
|
||||||
|
|
||||||
|
If you are new to pkgtool check out all the default settings like:
|
||||||
|
|
||||||
|
/opt/ts/bin/pkgtool --dumprc
|
||||||
|
|
||||||
|
## Step 4: Patching ts-specs
|
||||||
|
|
||||||
|
We are almost ready to start cranking away on installs of the latest dev tools via ts-specs.
|
||||||
|
|
||||||
|
One *critical* issue is that gnu tools have a circular dependency on *textinfo*. Luckily ts-specs can build up a base set of tools without using textinfo.
|
||||||
|
|
||||||
|
We just need to patch our ts-specs directory to disable textinfo and bypass this circular dependency.
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
cd ts-specs
|
||||||
|
wget http://trac.mapnik.org/raw-attachment/wiki/OpenSolarisInstallation/ts-spec1-compile-gcc44.patch
|
||||||
|
patch -p0 < ts-spec1-compile-gcc44.patch
|
||||||
|
|
||||||
|
## Step 5: Installing Development Environment
|
||||||
|
|
||||||
|
Now we are ready for our base installs via ts-specs.
|
||||||
|
|
||||||
|
Here are the commands that work to install gcc4.4:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# build dependencies for gcc4.4
|
||||||
|
pkgtool build devel/TSm4
|
||||||
|
pkgtool build libs/TSgmp
|
||||||
|
pkgtool build libs/TSmpfr
|
||||||
|
pkgtool build devel/TSbinutils
|
||||||
|
|
||||||
|
# finally we'll build gcc4.4
|
||||||
|
pkgtool build devel/TSgcc44
|
||||||
|
# remove sun gcc - this may fail, but should not be a big deal if it does
|
||||||
|
pfexec pkg uninstall SUNWgcc
|
||||||
|
# add new gcc on path
|
||||||
|
export PATH=/opt/ts/gcc/4.4/bin/:$PATH
|
||||||
|
|
||||||
|
# build gmake from ts-spec
|
||||||
|
pkgtool build devel/TSgmake
|
||||||
|
|
||||||
|
# now remove sun gmake
|
||||||
|
pfexec pkg uninstall SUNWgmake
|
||||||
|
|
||||||
|
# python26 is already available, but grab a few extra python tools
|
||||||
|
pfexec pkg install SUNWpython26-setuptools SUNWpython26-lxml
|
||||||
|
|
||||||
|
## Step 6: Installing Core Mapnik Dependencies
|
||||||
|
|
||||||
|
We're going to do this from source, rather than use ts-specs just to make any debugging much easier (things can go wrong with ts-specs on opensolaris because it has only really been tested on solaris). But in the future I may revise this to try to build more (or all) Mapnik core dependencies with ts-specs.
|
||||||
|
|
||||||
|
### 6a: 32 bit - Postgres 8.4 from source
|
||||||
|
|
||||||
|
Go to -> [32bit](/wiki:OpenSolarisInstallation/32bit/)
|
||||||
|
|
||||||
|
This was my first approach, and it worked great. But, I needed osm2pgsql to run 64 bit (to handle osm planet imports), and postgres to run 64 bit for better performance. So the step below is the current effort.
|
||||||
|
|
||||||
|
### 6b: 64 bit - Postgres 8.3 from sun
|
||||||
|
|
||||||
|
Go to -> [64bit](/wiki:OpenSolarisInstallation/64bit/)
|
||||||
|
|
||||||
|
This approach attempts to get the whole stack running 64 bit, and 64 bit postgres and python are used from sun. Integrating with sun's postgres and python is really hairy, but postgres8.3 was desirable because it is known by the osm community to be faster than 8.4 for applying diffs with osm2pgsql and python from sun was desirable because it is highly customized to be able to run both 32 bit and 64 bit. However the *catch* with this approach is that mapnik's exceptions are broken (http://mail.python.org/pipermail/cplusplus-sig/2010-December/015822.html).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Step 7: Installing Mapnik
|
||||||
|
|
||||||
|
Install Mapnik 0.7.2 or trunk (Mapnik2)
|
||||||
|
|
||||||
|
For 64 bit builds you may need to apply patches from #675 and #676
|
||||||
|
|
||||||
|
Mapnik 0.7.2:
|
||||||
|
|
||||||
|
32bit:
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
cd $SRC
|
||||||
|
svn co http://svn.mapnik.org/branches/0.7.2-dev/ mapnik-0.7.2
|
||||||
|
cd mapnik-0.7.2
|
||||||
|
export LANG="C"
|
||||||
|
export LC_ALL="C"
|
||||||
|
python scons/scons.py configure \
|
||||||
|
CXX="/opt/ts/gcc/4.4/bin/g++" \
|
||||||
|
OPTIMIZATION=3 \
|
||||||
|
INPUT_PLUGINS=shape,gdal,postgis \
|
||||||
|
PG_CONFIG=/usr/local/pgsql/bin/pg_config \
|
||||||
|
GDAL_CONFIG=/usr/local/bin/gdal-config \
|
||||||
|
PYTHON_PREFIX=/usr/local/
|
||||||
|
|
||||||
|
python scons/scons.py
|
||||||
|
pfexec python scons/scons.py install
|
||||||
|
|
||||||
|
64 bit:
|
||||||
|
|
||||||
|
python scons/scons.py configure \
|
||||||
|
CXX="/opt/ts/gcc/4.4/bin/g++ -m64 -R/opt/ts/gcc/4.4/lib/amd64/ -R/usr/local/lib -R/usr/postgres/8.3/lib/amd64" \
|
||||||
|
CC="/opt/ts/gcc/4.4/bin/gcc -m64 -R/opt/ts/gcc/4.4/lib/amd64/ -R/usr/local/lib -R/usr/postgres/8.3/lib/amd64" \
|
||||||
|
OPTIMIZATION=3 \
|
||||||
|
INPUT_PLUGINS=shape,gdal,postgis \
|
||||||
|
PG_CONFIG=/usr/postgres/8.3/bin/amd64/pg_config \
|
||||||
|
GDAL_CONFIG=/usr/local/bin/gdal-config \
|
||||||
|
PYTHON_PREFIX=/usr/local/ \
|
||||||
|
PYTHON=/usr/bin/amd64/python \
|
||||||
|
DEMO=True \
|
||||||
|
|
||||||
|
NOTE: in 64 bit mode python exceptions will be broken (you will get segfaults instead) due to incompatible libgcc versions linked to by mapnik (/opt/ts/gcc/4/4/lib/ammd64/libgcc_s.so) vs python (/usr/sfw/lib/amd64/libgcc_s.so). Only know solution at this point is to paste this command before running python process that imports mapnik:
|
||||||
|
|
||||||
|
|
||||||
|
LD_PRELOAD=/usr/sfw/lib/amd64/libgcc_s.so /usr/bin/amd64/python
|
||||||
|
|
||||||
|
Mapnik2:
|
||||||
|
|
||||||
|
32 bit:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# mapnik trunk
|
||||||
|
cd $SRC
|
||||||
|
svn co http://svn.mapnik.org/trunk/ mapnik-trunk
|
||||||
|
cd mapnik-trunk
|
||||||
|
export LANG="C"
|
||||||
|
export LC_ALL="C"
|
||||||
|
python scons/scons.py configure \
|
||||||
|
CXX=/opt/ts/gcc/4.4/bin/g++ \
|
||||||
|
OPTIMIZATION=3 \
|
||||||
|
INPUT_PLUGINS=shape,gdal,postgis \
|
||||||
|
PG_CONFIG=/usr/local/pgsql/bin/pg_config \
|
||||||
|
GDAL_CONFIG=/usr/local/bin/gdal-config \
|
||||||
|
PYTHON_PREFIX=/usr/local/
|
||||||
|
|
||||||
|
python scons/scons.py
|
||||||
|
pfexec python scons/scons.py install
|
||||||
|
|
||||||
|
64bit:
|
||||||
|
|
||||||
|
see command for 0.7.2 above - Mapnik2 should work just as well, but I've not tested 64 bit
|
||||||
|
|
||||||
|
## Step 8: Testing Mapnik
|
||||||
|
|
||||||
|
Run the nosetests:
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
cd $SRC
|
||||||
|
wget http://somethingaboutorange.com/mrl/projects/nose/nose-0.11.2.tar.gz
|
||||||
|
tar xvf nose-0.11.2.tar.gz
|
||||||
|
cd nose-0.11.2
|
||||||
|
pfexec python2.6 setup.py install
|
||||||
|
|
||||||
|
# now, within mapnik source directory
|
||||||
|
python tests/run_test.py
|
||||||
|
# with trunk you should get:
|
||||||
|
FAILED (TODO=9, errors=8, failures=4)
|
||||||
|
# with Mapnik 0.7.1 you should get no errors or failures
|
||||||
|
|
||||||
|
Test actual rendering (this assumes you've got an osm db setup up with data using osm2pgsql):
|
||||||
|
|
||||||
|
|
||||||
|
#!sh
|
||||||
|
# install nik2img
|
||||||
|
svn co http://mapnik-utils.googlecode.com/svn/trunk/nik2img/ nik2img-svn
|
||||||
|
cd nik2img-svn
|
||||||
|
pfexec python setup.py install
|
||||||
|
# grab osm stylesheets
|
||||||
|
svn co http://svn.openstreetmap.org/applications/rendering/mapnik/ osm-mapnik
|
||||||
|
cd osm-mapnik
|
||||||
|
./generate_xml.py --dbname osm --accept-none
|
||||||
|
|
||||||
|
If using Mapnik2:
|
||||||
|
|
||||||
|
# if using mapnik trunk upgrade xml into new copy:
|
||||||
|
upgrade_map_xml.py osm.xml osm2.xml
|
||||||
|
# test rendering
|
||||||
|
nik2img.py osm2.xml image.png --mapnik-version 2
|
||||||
|
|
||||||
|
Otherwise:
|
||||||
|
|
||||||
|
nik2img.py osm.xml image.png
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue