Find the answer to your Linux question:
Results 1 to 4 of 4
hello dear linux-experts, i do some openstreetmap-requests . with quite alot of files. note: i do them on a regular base: so the question is : how to store the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    May 2013
    Posts
    212

    how to store the results of csv-formatted values in a mysql database


    hello dear linux-experts,

    i do some openstreetmap-requests . with quite alot of files.

    note: i do them on a regular base: so the question is : how to store the results in a mysql database;



    wget http://download.geofabrik.de/europe/...latest.osm.pbf
    ./osmconvert belgium-latest.osm.pbf -o=belgium.o5m
    ./osmfilter belgium.o5m --keep="amenity=school" -o=belgium-schools.o5m
    ./osmconvert belgium-schools.o5m --all-to-nodes -o=belgium-schools_nodes.o5m
    ./osmfilter belgium-schools_nodes.o5m --keep="amenity=school" -o=belgium-schools-results.o5m
    ./osmconvert belgium-schools-results.o5m --csv="@id @lon @lat name addr:street addr:housenumber addr:city website email" --csv-headline -o=belgium-schools-results.csv

    see this is an excel-file; i tis formated in csv-file:

    question: how to store the results - and to update the database on a regular base ?

    note: i run mysql on opensuse - and i am a bit familiar with mysql, perl and php no problem here....
    Akoya P 6512 15" OpenSuse 13.1: AMD Athlon X2 P320
    Samsunng q 210, 12,1" OpenSuse 13.1: Intel® Core™ 2 Duo Proz. P8400 2,26 GHz 1066 MHz FSB 3 MB

  2. #2
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    941
    Quote Originally Posted by sayhello View Post

    note: i run mysql on opensuse - and i am a bit familiar with mysql, perl and php no problem here....
    If you have no problem with MySQL you should be familiar with....

    Inserting rows in a table:
    https://dev.mysql.com/doc/refman/5.0/en/insert.html

    Or the XML functions:
    https://dev.mysql.com/doc/refman/5.1...functions.html

    MySQL has really good online documentation it's a good starting place to look for MySQL related questions. Faster than waiting for replies online.
    A lion does not lose sleep, over the opinion of sheep.

  3. #3
    Linux Newbie
    Join Date
    May 2013
    Posts
    212
    hello - many thanks for the quick help - will take a clooser look at the docs.

    greetings
    Akoya P 6512 15" OpenSuse 13.1: AMD Athlon X2 P320
    Samsunng q 210, 12,1" OpenSuse 13.1: Intel® Core™ 2 Duo Proz. P8400 2,26 GHz 1066 MHz FSB 3 MB

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,578
    FWIW, the output you displayed is NOT in CSV format. What about the actual data files it downloaded? MySQL may be able to insert data into tables that is in CSV format as long as the elements are in the same order as the table columns and compatible, otherwise you will have to parse them and create SQL insert statements accordingly.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •