[josm-dev] Creating custom validation

Josh Doe josh at joshdoe.com
Fri Feb 24 12:37:17 GMT 2012


On Fri, Feb 24, 2012 at 6:20 AM, Morten Olsen lysgaard
<morten at lysgaard.no> wrote:
> Running a child project using the OSM stack
> I'd like to create custom validation rules for JOSM.
> Can this be written as a plugin?

I'd suggest you create a ticket on Trac. I recently made the changes
required so plugins can register search operators [0], and you'd
follow a similar process. I've never worked with validation before,
but a quick look indicates you'd need to create something like
"addTest(Class<Test> test)" to
org.openstreetmap.josm.data.validation.OsmValidator.

> How is this done currently? Is there some sort of abstraction. So that you
> write a function that tells if an object is valid, and then JOSM takes care
> of mapping this function over all the objects that are to be uploaded?
> Enlighten me, thanks in advance =)

Yes, you would subclass Test [1].

-Josh
[0]: http://josm.openstreetmap.de/ticket/7178
[1]: http://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/data/validation/Test.java



More information about the josm-dev mailing list