Perlbeginner1 has asked for the wisdom of the Perl Monks concerning the following question:
CREATE DATABASE `db123` DEFAULT CHARACTER SET latin1 COLLATE latin1_ge +rman2_ci; USE hans; CREATE TABLE `pois` ( `id` BIGINT(20) UNSIGNED NOT NULL, `lat` FLOAT(10,7) NOT NULL, `lon` FLOAT(10,7) NOT NULL, `name` VARCHAR(255) COLLATE utf8_bin NOT NULL, `amenity` VARCHAR(255) COLLATE utf8_bin NOT NULL, `operator` VARCHAh einR(255) COLLATE utf8_bin NOT NULL, `vending` VARCHAR(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
osm\planet\schleswig-holstein.osm -all-to-nodes >"c:\osm\planet\pois.o +sm"
how would you say - does this fit?#!/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 () ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: from osm to mysql
by wjw (Priest) on May 24, 2014 at 12:00 UTC | |
by Perlbeginner1 (Scribe) on May 24, 2014 at 13:12 UTC | |
by erix (Prior) on May 24, 2014 at 13:33 UTC | |
by poj (Abbot) on May 24, 2014 at 15:06 UTC | |
by Perlbeginner1 (Scribe) on May 24, 2014 at 15:37 UTC | |
by Perlbeginner1 (Scribe) on May 29, 2014 at 15:05 UTC | |
by poj (Abbot) on May 29, 2014 at 15:31 UTC | |
| |
by Perlbeginner1 (Scribe) on Jun 01, 2014 at 07:54 UTC | |
by poj (Abbot) on Jun 01, 2014 at 14:07 UTC | |
| |
by wjw (Priest) on May 24, 2014 at 14:39 UTC | |
by Perlbeginner1 (Scribe) on May 29, 2014 at 15:08 UTC | |
by marto (Cardinal) on May 29, 2014 at 15:30 UTC | |
by Perlbeginner1 (Scribe) on May 31, 2014 at 06:54 UTC | |
|
Re: from osm to mysql
by GrandFather (Saint) on May 24, 2014 at 13:39 UTC | |
by Perlbeginner1 (Scribe) on May 24, 2014 at 15:39 UTC |