in reply to from osm to mysql

Without regard to the correctness or fitness of your code for your purpose, there is scope for a little tidying up. Consider:

#!/usr/bin/perl use strict; use warnings; use OSM::osm; my @fieldNames = qw(name amenity operator vending); openOsmFile($file); do { my ($id, $lon, $lat, $nodeUser, $ref1) = getNode2(); last if ! defined $id; my %fields; $fields{$_->[0]} = scalar $_->[1] for @$ref1; next if !grep {exists $fields{$_}} @fieldNames; print join ('^', $id, $lat, $lon, @fields{@fieldNames}), "\n"; } while (1); closeOsmFile();

As this is a test script the output is to the console rather than to a file. Needless to say the script is untested!

Perl is the programming world's equivalent of English

Replies are listed 'Best First'.
Re^2: from osm to mysql
by Perlbeginner1 (Scribe) on May 24, 2014 at 15:39 UTC

    many many thanks for all your ideas and help regarding the connection of the database!!! this is great!
    of course - i know that postgresql is THE mandantory standard i am willing to do all in postgresql.

    i have some experience in MySQL - and i am now willing to do all what is needed to do work with postgres

    note; i do not need the spatial - featuees (the options of creating maps.) i only want to export POI from the planet file.


    later the weekend i will have a closer look at the codesnippets and will come back and report all my experiecne

    Again - many many thanks

    greetings
    ps - i am very very happy about this great forums - it rocks and you do a superb work !!!! Community at its best"!!