hello dear wjw - good morning ;<)
the script we discussed was written for windows - see the corresponding line with the paths...
#!/usr/bin/perl -w
use strict ;
use OSM::osm ;
my $file ;
my $nodeUser ;
my @nodeTags ;
my $nodeTags ;
my $ref1 ;
my $line ;
my $tag;
my $nodeName;
my $id ="1" ;
my $lat ;
my $lon ;
my $name ;
my $amenity ;
my $operator ;
my $vending;
$file = "c:/osm/planet/pois.osm" ;
openOsmFile ($file) ;
open(AUSGABE, ">c:/osm/planet/mysql.txt");
($id, $lon, $lat, $nodeUser, $ref1) = getNode2 () ;
while ($id != -1 ) {
$name ="" ;
$amenity ="" ;
$operator ="" ;
$vending ="" ;
@nodeTags = @$ref1;
foreach my $tag (@nodeTags) {
if ($tag->[0] eq "name") { $name = scalar ($tag->[1] )};
if ($tag->[0] eq "amenity") { $amenity = scalar ($tag->[1]
+ )};
if ($tag->[0] eq "operator") { $operator = scalar ($tag->[
+1] )};
if ($tag->[0] eq "vending") { $vending = scalar ($tag->[1]
+ )}
}
if ($name ne "" | $amenity ne "" | $operator ne"" | $vendi
+ng ne"")
{print AUSGABE "$id^$lat^$lon^$name^$amenity^$operator^$ve
+nding\n";}
($id, $lon, $lat, $nodeUser, $ref1) = getNode2 () ;
}
close(AUSGABE);
closeOsmFile () ;
how would you say - does this fit for linux - no. We have to do some corrections first.
note; i run linux opensuse 13.1
- mysql is up and running
- the modules i have all
use DBI;
use XML::Twig;
... and i guess that i need furthermore another "library"
this library which is used in this line use OSM::osm ; which is inspired by this page
note German language:
url=http://wiki.openstreetmap.org/wiki/User:Brogo/OpenLayers_DatenbankanbindungUser:Brogo/OpenLayers Datenbankanbindung - OpenStreetMap Wiki
/url
and this
url=http://svn.openstreetmap.org/applications/utils/gary68/OSM/osm.pm", $title, "
/url
This module contains a lot of useful functions for working with osm files and data. it also includes functions for calculation and output.
url=http://wiki.openstreetmap.org/wiki/User:Gary68User:Gary68 - OpenStreetMap Wiki
/url
bquestions:
/b
where to put this library:
url=http://svn.openstreetmap.org/applications/utils/gary68/OSM/osm.pm", $title, "
/url should i put it into the folder where i have the following perl scripts:
note: well what i have i have a folder
home/perl where i have the following perl code:
a. osm_to_db.pl
b. create_db.pl
bsecond question:
/b - i am sure that i have to do some corrections;
in the code create_db.pl
a. the first correction:
at the line
$file = "c:/osm/planet/pois.osm" ;
b the second correction:
at the line
"open(AUSGABE, ">c:/osm/planet/mysql.txt"); "
...since i have no windows but a linux-system....:
look forward to hear from you
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.