Opened 12 years ago

Closed 12 years ago

#998 closed defect (fixed)

areacenter doesn't handle two-node "areas"

Reported by: berteun@… Owned by: Jochen Topf
Priority: minor Milestone:
Component: osmarender Version:
Keywords: Cc:


A small OSM file illustrating the problem (with only one way) is attached to this message. It is taken from:,52.3975,5.31779,52.40068

The road is tagges as 'highway=residential', but also as 'landuse=residential', obviously, this does not make much sense, but it leads to a corrupt SVG file if rendered with: osmarender -r osm-map-features-z17.xml

Because of the landuse=residential, it will add a label. It's too hard for me to understand the XSLT trickery. Ideally maps do not contain such errors, but since humans are prone to make them, I think it would be better to change the transformation rules such that the SVG outputted is at least valid (a strict renderer such as Batik will not accept it).

Attachments (1)

err_map2.osm (762 bytes) - added by berteun@… 12 years ago.
Cleaned up example of an OSM file that leads to corruption.

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by berteun@…

Attachment: err_map2.osm added

Cleaned up example of an OSM file that leads to corruption.

comment:1 Changed 12 years ago by Knut Arne Bjørndal

Summary: landuse=residential on ways leads to 'NaN' coordinates in SVG outputareacenter doesn't handle two-node "areas"

The problem here is that it will try to run the areacenter algorithm on a two-point polygon, which it won't handle (and it doesn't make sense).

The algorithm could probably be wrapped with logic to specially handle ways with 1 and 2 nodes, good luck to whoever finds the time to do it.

comment:2 Changed 12 years ago by bobkare

Resolution: fixed
Status: newclosed

(In [9575]) The areaBBOXCenter fallback made it easy to handle 2-node areas as well (not that they make any sense). Fixes #998

Note: See TracTickets for help on using tickets.