On 06/27/2011 07:07 AM, Dane Springmeyer wrote:
> 
> On Jun 26, 2011, at 10:48 PM, Magnus Bäck wrote:
> 
>> So, I converted that GPX file into a shapefile with gpx2shp
>> before feeding it to Mapnik. As I didn't see any crossing lines
>> when viewing either the GPX file nor the shapefile I've assumed
>> it was somehow related to Mapnik. Also, the lines are (in most
>> cases) a little bit too perpendicular and of equal length to
>> indicate a problem with the data itself.
> 
> Yep, rendering artifact, that I can replicate. Your hunch was right. Not 
> looked closely yet as to the cause, but likely the high density of nodes 
> triggers those sharp spikes in some part of AGG.

Just as additional info: this is not a bug, although it can lead to
extreme looking cases like the above. It's the way line drawing works
with noisy data, which will always contain small but sharp spikes. The
data points will "jump" left and right of the actual route, producing
very sharp angles perpendicular to the track. Depending on the line join
setting, these are exaggerated to sharp triangles sticking out of the track.

See http://www.carto.net/papers/svg/samples/stroking.shtml#lineJoin fpr
an illustration. Under the heading of stroke-miterlimit you find an
example of such a sharp edge case, producing a long, sharp triangular
spike. (This is page is for SVG, but the same will be true of pretty
much any graphics package)

The solution is, as Dane said, to set an appropriate line join mode
other than "miter", or to set an appropriate miter limit if the renderer
supports it. (This doesn't seem to be supported/exposed by mapnik)

Best,

Flo


> 
> The fix, however, is easy, and likely something want you want anyway for 
> smoother a looking line given the high density of node.
> 
> Add these two extra options to the LineSymbolizer:
> 
> stroke-linejoin="round" stroke-linecap="round"
> 
> That should fix things up nicely. Though your pre-processing solution is 
> great too of course because things will draw faster that way.
> 
> Dane
_______________________________________________
Mapnik-users mailing list
Mapnik-users@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to