hello dear wolfi
many many thanks for your quick reply. great to hear from you.
great to hear that the perl modules are allready inlcuded in the repo. And that i can make usage of the allready installed database.
That sounds very very good.
well - some final questions are the followings - that reflect the perl-code that you see above.
see the perl-code - note: i am pretty new to Perl.
btw - what bout the fields of the db
[FONT=Arial]# update database
my @f = map{ $data{$_} }('id','lat','lon','name','amenity','operator')[/FONT]
[FONT=Arial]
[/FONT]
[FONT=Arial,Helvetica, sans-serif]
so - in other words. if i need more fields in the database - for the POI (that is the dataset that i get from the planet-file) then i extend the above mentioned code-line!? is this correct!? Can i do so!? i guess
[/FONT]
btw - all the ideas of getting the data out of the planet file are derived from two sites that inspired me.
what i aim is to have a perl sciript that helps me to the data stored that i gatherd out of the request of www.overpass-turbo.eu
(a method to request the openstreetpap). Therefore i have a Perl program that reads XML data and posts it into a MySQL database.
some thougts that are important:
**what IS AIMED: **aimed is to transform data out of German osm-pbf-files - in order to get the data (not to creat maps again)
see the source (s)= http://download.geofabrik.de/europe/germany.html ranging form 10 MB (Bremen) to 390 MB (Nordrhein Westfalen) the osm.pbf-files are not too big; Question: which method is the best - the most appropiate? - to store the results in a mysql-db or just have big calc-sheets (with csv-data)
- only straightforward from files that
- no backimport of data to OSM from a .csv file
i am inspired by the pages:
first page:
http://oegeo.wordpress.com/2012/03/06/a-self-updating-openstreetmap-database-of-us-bridges-a-step-by-step-guide/
I had what I thought was a pretty straightforward use case for OpenStreetMap data:
I want all bridges in the US that are mapped in OpenStreetMap in a PostGIS database.
There are about 125,000 of them – for now loosely defined as ‘ways that have the ‘bridge’ tag‘. So on the scale of OpenStreetMap data it’s a really small subset. In terms of the tools and processes needed, the task seems easy enough, and as long as you are satisfied with a one-off solution, it really is. You would need only four things:
A planet file
A boundary polygon for the United States
A PostGIS database loaded with the osmosis snapshot schema and the linestring extension
osmosis, the OpenStreetMap ETL swiss army tool.
note this guy makes usage of postgis. - perhaps i start with mysql - or postgresql - since i do not need maps in the end- i only need
the text-data - for the pois - no mapping data for rebuilding maps again…
the second inspiration: http://wiki.openstreetmap.org/wiki/User:Brogo/OpenLayers_Datenbankanbindung
see the ideas of database connecting to osm - with perl
CREATE DATABASE `db123` DEFAULT CHARACTER SET latin1 COLLATE latin1_german2_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` VARCHAR(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;
see the code
#!/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"" | $vending ne"")
{print AUSGABE "$id^$lat^$lon^$name^$amenity^$operator^$vending
";}
($id, $lon, $lat, $nodeUser, $ref1) = getNode2 () ;
}
close(AUSGABE);
closeOsmFile () ;
- wolfi, Robin Listas and Nrickert - how do you find these ideas.
i want to** follow only one goal: what IS AIMED: **aimed is to transform data out of German osm-pbf-files - in order to get the data (not to creat maps again)
see the source (s)= http://download.geofabrik.de/europe/germany.html ranging form 10 MB (Bremen) to 390 MB (Nordrhein Westfalen) the osm.pbf-files are not too big; Question: which method is the best - the most appropiate? - to store the results in a mysql-db or just have big calc-sheets (with csv-data)
- only straightforward from files that
- no backimport of data to OSM from a .csv file
love to hear from you
greetings