Opened 10 years ago

Closed 10 years ago

#998 closed defect (fixed)

areacenter doesn't handle two-node "areas"

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

Description

A small OSM file illustrating the problem (with only one way) is attached to this message. It is taken from: http://api.openstreetmap.org/api/0.5/map?bbox=5.31123,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@… 10 years ago.
Cleaned up example of an OSM file that leads to corruption.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by berteun@…

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

comment:1 Changed 10 years ago by bob@…

  • Summary changed from landuse=residential on ways leads to 'NaN' coordinates in SVG output to areacenter 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 10 years ago by bobkare

  • Resolution set to fixed
  • Status changed from new to closed

(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.