On Fri, May 21, 2010 at 3:04 PM, Bob Jolliffe <[email protected]> wrote: > On 21 May 2010 13:58, Knut Staring <[email protected]> wrote: >> On Fri, May 21, 2010 at 2:35 PM, Bob Jolliffe <[email protected]> wrote: >>> On 21 May 2010 13:30, Knut Staring <[email protected]> wrote: >>>> On Fri, May 21, 2010 at 2:25 PM, Bob Jolliffe <[email protected]> >>>> wrote: >>>>> Generating an orgunit hierarchy in dxf is relatively straightforward. >>>>> As long as you have some kind of parent id reference to work with. >>>>> >>>>> I am not sure of the algorithm to use for the simplification part but >>>>> I guess it must be pretty standard? You are just reducing the number >>>>> of points on a polygon right? My rusty maths could probably figure >>>>> out an algorithm but this has got to already exist. Does anyone have >>>>> any pointers? >>>> >>>> Yes - there is Douglas-Peucker, Visvalingam and Special Visvalingam, >>>> you can test them at the following link. But some of these create >>>> cracks between polygons. >>>> http://mapshaper.com/test/demo.html >>> >>> Ok. This an online shaper. Can't see any code to download :-) I >>> guess the three names above are the algorithms? Any idea what the >>> cracks are about? Faulty algorithm, faulty implementation of >>> algorithm or faulty shapefiles to start with. Might be the shapefiles >>> need to be pre-processed (cleaned) before transforming. >> >> Not quite sure, maybe it is linked to polygons not really sharing >> borders, just overlapping, and then Switzerland's border with Germany >> gets simplified differently from Germany's border with Switzerland. >> Though I could be completely wrong - and it may also depend a lot on >> the parameters one chooses. But it seems that the commercial tools >> like FME and ArcToolbox may handle it better, or maybe the data was >> just clearner, or that the tools do some automatic precleaning, as >> opposed to the default versions of the algorithms as implemented in >> the online Mapshaper and also in PostGIS (see below link) don't quite >> preserve common borders between polygons. >> >> http://bostongis.org/PrinterFriendly.aspx?content_name=postgis_simplify >> >>>> >>>>> If there is some reasonable java code to do this, then >>>>> I would create a java class to do it somewhere in dhis and make that >>>>> class available as a an extension to the xalan xslt processor. That >>>>> sounds complicated but its not really. I did something similar with >>>>> calculating dates off excel's (dodgy) date representation. >> >> I think this is interesting, as it would potentially allow people to >> upload their own shapefiles without worrying about simplification and >> conversion to GeoJSON. What will also be needed is a matching >> algorithm - though Jan Henrik has already implemented identical >> matching and manual visual matching in the client. >> >> By the way, in addition to simplification, there is "smoothing". Most >> of this is available as part of the Java Topology Suite: >> http://www.vividsolutions.com/jts/jtshome.htm >> http://lists.refractions.net/pipermail/jump-users/2005-July/002564.html >> > > Yes well if someone else can provide the simplification/smoothing or > what have you I can make sure its available to the input transform. > Other than that I'm a bit out of my depth with these processes at the > moment.
Fair enough ;-) Just to complete the picture, I think what is needed is what FME provides with its option "Preserve Shared Boundaries": http://docs.safe.com/fme/2009/html/Transformers/content/transformers/generalizer.htm This seems to be an additional feature beyond the standard algorithms - would be nice to know how its achieved, and especially if there are open source implementations of this feature. k _______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp

