[osmosis-dev] Writing an Osmosis plugin

Brett Henderson brett at bretth.com
Thu Oct 25 00:15:31 BST 2012


Hi Paweł,

On 23 October 2012 22:09, Paweł Paprota <ppawel at fastmail.fm> wrote:

>
> However, due to the fact that every module in Osmosis is built as a
>> separate plugin and source code is maintained in Git, things have
>> changed somewhat.  My suggestion would be to work in the main tree
>> but on your own branch in your own repo.  Create your new tasks in a
>> new project/plugin following the existing pattern.  It's up to you
>> where you store your repository, but github is probably the easiest
>> choice.
>>
>
>
> I'm happy that it's your recommendation as this is exactly what I did at
> the time I sent my message to osmosis-dev@ :-)
>
> I simply forked your repo on Github, see:
>
> https://github.com/ppawel/**osmosis/tree/changedb-plugin<https://github.com/ppawel/osmosis/tree/changedb-plugin>
>
> I added a new module/project, named "changedb". I also maintain database
> schema scripts in this tree:
>
> https://github.com/ppawel/**osmosis/blob/changedb-plugin/**
> package/script/changedb_**schema.sql<https://github.com/ppawel/osmosis/blob/changedb-plugin/package/script/changedb_schema.sql>
>
> This module is an extension of the pgsnapshot so the schema only
> contains additional tables.
>

All sounds good.


>
> I'm trying to keep changes to the changedb module but in some places I
> need to extend the core model, for example I need to get a way linestring.
> The easiest way to do that would be to modify Way and Way(Row)Mapper
> classes. I'm not sure what is the practice for extending core classes. Let
> me know if you have any tips.


In general I try not to add anything plugin specific to core classes.
Given the broad range of functionality supported by Osmosis I need to keep
things generic where possible or the core codebase will become a tangle of
special case code.

There is a way of attaching additional information to Entity classes which
might help you.  Check out the getMetaTags() method on the Entity class
(the parent class of Way).  It allows you to attach any objects to an
Entity via a Map<String, Object>.  These meta tags aren't used much at the
moment, but were intended for this type of purpose.  In your case you could
attach a Linestring object to a Way.  Something like:
way.getMetaTags().put("linestring", myLineString);


>
>
>> PS. The wiki is out of date with respect to plugins and could do with
>> an update.  Plugins used to be second class citizens in the Osmosis
>> world, but now everything is created as plugins.  The only difference
>> is whether plugins are included in the main distribution or not.
>>
>>
> I won't promise anything but I may update a little content here and there
> if I find the time. Also useful would be a short info on how to develop
> with Eclipse - setting up launch configurations (classpath) for debugging
> etc.
>

Anything you can add would be useful.  Most development-related
documentation is currently here:
http://wiki.openstreetmap.org/wiki/Osmosis/Development

Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osmosis-dev/attachments/20121025/ed399d2c/attachment.html>


More information about the osmosis-dev mailing list