2012-07-10 23:54:05 +02:00
|
|
|
## hello world plugin
|
2010-10-24 10:04:16 +02:00
|
|
|
|
|
|
|
This is a very simple sample plugin. It is designed to help developers
|
|
|
|
see the skeletal basics needed to achieve a functional datasource plugin.
|
|
|
|
|
2012-07-10 23:54:05 +02:00
|
|
|
It is not a model plugin of best practices as much as a model of the bare
|
|
|
|
minimum you need to have a working plugin that returns a single feature.
|
|
|
|
|
2010-10-24 10:04:16 +02:00
|
|
|
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:
|
|
|
|
|
2015-01-21 23:28:12 +01:00
|
|
|
```xml
|
2010-10-24 10:04:16 +02:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2013-01-25 09:49:55 +01:00
|
|
|
<Map srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" background-color="white">
|
2010-10-24 10:04:16 +02:00
|
|
|
<Style name="style">
|
|
|
|
<Rule>
|
|
|
|
<PointSymbolizer />
|
|
|
|
<TextSymbolizer name="[key]" face_name="DejaVu Sans Book" size="10" dx="5" dy="5"/>
|
|
|
|
</Rule>
|
|
|
|
</Style>
|
2013-01-25 09:49:55 +01:00
|
|
|
<Layer name="test" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
|
2010-10-24 10:04:16 +02:00
|
|
|
<StyleName>style</StyleName>
|
|
|
|
<Datasource>
|
|
|
|
<Parameter name="type">hello</Parameter>
|
|
|
|
</Datasource>
|
|
|
|
</Layer>
|
|
|
|
</Map>
|
2015-01-21 23:28:12 +01:00
|
|
|
```
|
2010-10-24 10:04:16 +02:00
|
|
|
|
|
|
|
Or used in python like:
|
|
|
|
|
2015-01-21 23:28:12 +01:00
|
|
|
```
|
|
|
|
import mapnik
|
|
|
|
ds = mapnik.Datasource(type="hello")
|
|
|
|
```
|