[OSM-dev] Map rendering code... API or database direct?

Richard Fairhurst richard at systemeD.net
Thu Mar 30 10:54:56 BST 2006


Quoting immanuel.scholz at gmx.de:

> On Thursday 30 March 2006 09:14, nick at hogweed.org wrote:
>> Would like to get some feedback on one point though. Should it interact
>> with the database via the API (as a remote client would do) or direct with
>> the database?
>
> Depends on how much work you will have in the future ;-). The database schema
> is likely to change as it grows and single-tables containing history and
> actual data cannot be handled anymore. Also it is likely that the tag's
> currently inlined into segment and node table move outside.
>
> Next is, that you cannot easily deploy freemap without the database, if you
> use it directly.
>
> I suggest you use the API. :)

FWIW, my suggestion would be:

If your display paradigm (i.e. how you're going to draw roads and other routes
on the screen) closely mirrors the API's structures, then use the API - 
there's
no reason not to.

If, however, you consider that the best-looking and most user-friendly maps
would be produced by "insulating" the user from OSM's data structures, 
then the
most efficient way to do this would be to access the data directly. You 
can then
write a set of SQL queries which closer reflect your end uses than the API's
all-purpose transport mechanism does.

If you do this, obviously, it'd still be better to have the data access 
stuff as
a discrete part of your code, so that you don't have to rewrite your entire
project every time the tables change. But this goes without saying, I'm sure.

cheers
Richard





More information about the dev mailing list