[OSM-dev] Limitation on downloading ways via /map API Call

Christopher Schmidt crschmidt at crschmidt.net
Sun Jul 9 16:20:33 BST 2006

Steve just closed http://trac.openstreetmap.org/ticket/214 by changing a
MySQL variable, but there is still a (currently undocumented) limitation
to very-long ways. group_concat can only be a maximum, by defualt, of
1000 characters: 

      ress = call_sql { "select
d.id,d.segs,d.tags,current_ways.timestamp,current_ways.visible from
(select c.id, segs, group_concat(k , concat('===', v) SEPARATOR '|||')
as tags from (select id, group_concat(segment_id order by sequence_id)
as segs from (select a.id, segment_id, sequence_id from (select id from
current_way_segments where segment_id in (#{id_list}) group by id) as a,
current_way_segments where a.id = current_way_segments.id) as b group by
id) as c, current_way_tags where c.id = current_way_tags.id group by id)
as d, current_ways where current_ways.id = d.id;" }

Steve has raised this default to 4000 characters:

11:03:47 < SteveCCCCCCC> crschmidt, the number of digits plus two chars
per seg id cannot exceed 4k bytes. Mysql default was 1k.
11:06:37 < Etienne> So thats about 450 segments at the moment.  400 when
the segment ID goes over 9,999,999.

11:14:07 < SteveCCCCCCC> oh dear
11:14:16 < SteveCCCCCCC> there are ways with 3,500 segments

In the meantime, all developers should be aware that downloading data
via the /map API call will only show a maximum of about 450 segments. If
a way has this many segments, it may be beneficial to your users to
either mark it as 'incomplete' in your local dataset (so you don't
upload the bad data back to OSM) or fetch the complete way using the
/way API call, which doesn't have the same limitation.

This is the reason for the issues that pere reported here: 
http://lists.openstreetmap.org/pipermail/talk/2006-July/005089.html --
Presumably, someone downloaded the data in JOSM, which helpfully
uploaded the data it got from the API, replacing the existing way with
the new one downloaded from the API (or something like that).

Christopher Schmidt
Web Developer

More information about the dev mailing list