This is interesting, thanks for the background. I have only looked as OSM from the point of view of end user apps at this point(android), so the links and info you provide are appreciated.

In answer to your first question: My preference is to use a database if at all possible. For smaller projects I like SQLite, as it is very portable, with the whole data base stored in one file. That limits it in size, but not terribly. I have no porblem sticking 500k records in an SQLite database. If it is likely that your going to have a much larger database, the MySQL is my preference. As erix pointed out, it looks like osm is leaning toward Postres. Postgres is fine, but I worked with it only once years ago, so I am somewhat abivilant towards it. I am sure it would work fine.

As far as methodology goes: You already have your parser pretty much worked out as close as I can tell. I would take the script that you already have, add the DBI/DBD for your chosen database(does not matter from the Perl/DBI standpoint), and then write the rather short code to take your parsed data and insert it to the database. You are really already half done.

You can use SuperSearch and the POD for your chosen database driver, to come up with examples. In simplistic psudo-code it looks a bit like the following:

use DBD::mysql; set up connection (database, user, password) establish connection establish routine to accept parsed values and insert to db run the routine for all your records disconnect from the db;

Again, I hope you find this somewhat helpful...

...the majority is always wrong, and always the last to know about it...

Insanity: Doing the same thing over and over again and expecting different results...


In reply to Re^3: from osm to mysql by wjw
in thread from osm to mysql by Perlbeginner1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.