[OSM-dev] 'tile' - what it is used for in some tables in the schema?

Matt Amos zerebubuth at gmail.com
Sun Oct 2 00:29:26 BST 2011

On Fri, Sep 30, 2011 at 10:00 AM, Zsombor Szabó <zsombor at gmail.com> wrote:
> Hi,
> studying the OSM database schema over at
> http://wiki.openstreetmap.org/wiki/Database_schema I was wondering for
> what the 'tile' attribute is used for in the current_nodes, nodes,
> gps_points tables.
> If you know then please share.

it's a geometric index using a B-tree of the (truncated) morton code
of the lat/lon of those elements. for the gory details, see the
sql_for_area function in the source code [1]. there's also some
general discussion on the wiki [2], info about the general method on
wikipedia [3] and in the mailing list archives [4].



[1] http://git.openstreetmap.org/rails.git/blob/HEAD:/lib/quad_tile.rb#l63
[2] http://wiki.openstreetmap.org/wiki/Quadtile#Indexing_single-point_geo-locations
[3] http://en.wikipedia.org/wiki/Z-order_curve
[4] http://lists.openstreetmap.org/pipermail/dev/2008-September/011694.html

More information about the dev mailing list