[Tilesathome] New preprocessor - area center
Jiri Klement
jiri.klement at gmail.com
Thu Sep 11 14:47:00 BST 2008
I've added the area center preprocessor to svn. For now it's used only
by XSLT. XSLT use different algorithm for area center calculation than
orp, so problems with neighbouring tiles described by spaeth already
exists for XSLT users. So not big deal if Java is not available and
area-center preprocessor can't be used.
On Mon, Sep 8, 2008 at 3:33 PM, Jiri Klement <jiri.klement at gmail.com> wrote:
>> What is it you actually do different from the XSLT version, and how is
>> it that it is better?
>>
>> Just so you know, I think there are some differences between the
>> writeup on my website and the XSLT implementation, mainly in the last
>> step.
>
> It behaves better for regular shapes. If the polygon is convex or
> almost convex, then simple centroid calculation is used instead of
> your algorithm. Almost convex polygon is polygon which convex envelope
> (convex hull) is no more than 20% bigger than the polygon itself. For
> irregular polygons is used your algorithm. Center point is selected so
> that the line it lies on is long enough and point is close to the
> average center point.
>
> The center point selection could be improved by making sure the
> selected point is not close to any edge. It won't be hard to
> implement, but I though I will rather try to get it into production
> first because it's imho already better than current algorithm.
>
> I also had some other ideas including dividing concave polygons into
> few big convex polygons and doing things like looking for big areas or
> detecting polygons shaped like ie river and placing icon in the middle
> of imaginary line going through center of polygon.
>
>> There is an unfinished version of my area-center algorithm in or/p, I
>> haven't had time to fix it, but wouldn't it be easier to just fix it
>> than to create something new in yet another language that not all the
>> developers understand?
>
> I don't understand perl :-). Actually I do but I have big trouble debugging it.
>
>>> The area center preprocessor can be rewritten in perl. It will make it
>>> harder to manage, but it's possible. Anyway I think Java dependency is
>>> worth including because you can do nice tricks with osmosis and batik.
>>
>> How is that harder to manage? To me a java app is much harder to
>> manage given that I know exactly nothing about java, and plan to keep
>> it that way
>
> I think Java is generally easier to manage because it doesn't allow
> you to do stupid things. Perl has no type control, it doesn't check
> you pass correct arguments to method, it won't tell you that some
> branch of code can never be executed, etc. Generally small mistakes
> can result in program behaving bad instead of compiler error. All this
> stuff makes things easier when you're writing a program, but much
> harder when you have to change program later.
>
> Anyway this is really mostly about personal preferences and I
> shouldn't have used that sentence about Java being easier to use at
> all.
>
> --
> Jiri
>
More information about the Tilesathome
mailing list