mapnik/plugins/input/templates/helloworld
2011-11-11 17:03:21 -08:00
..
build.py update hello world build script 2011-11-11 17:03:21 -08:00
hello_datasource.cpp use boost::make_shared across plugins to avoid explicit new and ensure fast and exception safe allocation 2011-05-16 23:41:34 +00:00
hello_datasource.hpp helloworld.input - comment fix 2011-04-13 18:13:07 +00:00
hello_featureset.cpp use boost::make_shared across plugins to avoid explicit new and ensure fast and exception safe allocation 2011-05-16 23:41:34 +00:00
hello_featureset.hpp make sure datasource feature ids start at 1, like shapefile and sqlite plugins 2011-04-29 20:00:45 +00:00
README fix example code 2011-08-12 19:55:15 +00:00
test.xml upgrade syntax to mapnik2 2011-04-09 05:35:25 +00:00

hello world plugin
------------------

This is a very simple sample plugin. It is designed to help developers
see the skeletal basics needed to achieve a functional datasource plugin.

Code comments attempt to highlight which code is mandatory, which is
simply recommended, and which is purely fluff used to get the plugin to
actually show some data.

When added to a map it provides a single point geometry representing
the center of any query. This means that it should place a point in
the middle of any map tile and display a "hello world!" label if used like:

<?xml version="1.0" encoding="utf-8"?>
<Map srs="+init=epsg:4326" background-color="white">
    <Style name="style">
        <Rule>
            <PointSymbolizer />
            <TextSymbolizer name="[key]" face_name="DejaVu Sans Book" size="10" dx="5" dy="5"/>
        </Rule>
    </Style>
    <Layer name="test" srs="+init=epsg:4326">
        <StyleName>style</StyleName>
        <Datasource>
            <Parameter name="type">hello</Parameter>
        </Datasource>
    </Layer>
</Map>


Or used in python like:

from mapnik2 import *
m = Map(600,400)
m.background = Color('white')
s = Style()
r = Rule()
r.symbols.append(PointSymbolizer())
t = TextSymbolizer(Expression("[key]"),"DejaVu Sans Book",10,Color('black'))
t.displacement = (15,15)
r.symbols.append(t)
s.rules.append(r)
m.append_style('style',s)
ds = Datasource(type="hello")
l = Layer('test')
l.styles.append('style')
l.datasource = ds
m.layers.append(l)
m.zoom_all()
render_to_file(m,'test.png')