I often work with large relations (like this). Currently, the preview maps at osm.org/browse/relation/[number] or at osm.org/?relation=[number] load painfully slowly. Can this be solved somehow? Is it possible to cache these so they would load instantly? asked 16 Nov '11, 07:45 Kozuch |
The preview maps use the editing API to download all objects referenced by the relation. There are several problems with that:
There are many ways how this could be fixed. A simple caching of the XML response would ease the strain on the database but not solve the issue of a ton of unnecessary data being transmitted to the browser. An ideal solution would probably store the relation as a pure string of coordinates, with simplified geometry, and hand that out to the browser in KML form or so. The challenge for any caching solution would be to find out when to invalidate the cache. All this could easily be implemented by a third party relying on diff updates loaded from the OSM server - a kind of "fast relation viewer" service. I'm sure people would appreciate if someone built such a system they could then use. As is often the case in OSM, there's no lack of good ideas, just a lack of good people to put them into practice. answered 16 Nov '11, 08:22 Frederik Ramm ♦ Thanx for a complex answer. Do you think XAPI would be faster than API?
(16 Nov '11, 09:52)
Kozuch
2
From reading Frederik's reply, XAPI may be a little quicker for retrieving the information, but for the best performance you wouldn't want any of the tags or version information returning - just the member nodes of any ways in the relation, and for those nodes only their longitude and latitude. Which in an optimised custom database structure is the "pure string of coordinates" Frederik also mentions above, though he goes the one step further and simplifies the geometry; eg you probably don't need full details of the Mississippi riverbank if you are zoomed out far enough to see the whole river.
(16 Nov '11, 10:40)
EdLoach ♦
Well, I think full details would still be nice - I mean to show all nodes of a relation in case you zoom in... It sounds like the biggest load does all the extra data fetched, so let us cut this only.
(16 Nov '11, 10:55)
Kozuch
|