開放街圖標誌 OpenStreetMap 開放街圖

Updates of KPAOnline Scraper

於 2009年八月 8日 由 h4ck3rm1k3English發表。

I have created a new script that will scrape out the street names from the points in the KPA data.
It also updates the existing data from OSM, to avoid more merge.
Chilly asked me to please not make huge posts, so the rest of the details will be in the comments if you are interested.

電子郵件圖示 藍天圖示 Facebook 圖示 LinkedIn 圖示 乳齒象圖示 Telegram 圖示 X 圖示

討論

h4ck3rm1k32009年08月 8日 17時49分 發表的評論

Here is my changeset.
osm.org/browse/changeset/2077242
I removed one house from sharri. Hmm. Will have to do that another time.

h4ck3rm1k32009年08月 8日 17時50分 發表的評論

here is my new script :

scraper:

#street

#grep 'td width="189" bgcolor="#ECF5FF" class="fonteLatest"' $1;

########
# street
#td width="189" bgcolor="#ECF5FF" class="fonteLatest"
#grep -h -A1 -e 'strong\>Street' $1
# | cut -d\> -f2
grep -h -A1 -e 'Street' $1 | tail -1 | cut -d\> -f2 | cut -d\< -f1 > $1.street

## building (house number)
grep -h -A1 -e 'Building' $1 | tail -1 | cut -d\> -f2 | cut -d\< -f1 > $1.building

## GPS Grid UTM
#grep -h -A2 -e 'GPS' $1 | tail -1 | cut -d\> -f2 | cut -d\< -f1 > $1.gps
grep -h -A2 -e 'GPS' $1 | tail -1 | cut -d\< -f1 | sed -e's;/; ;g' | cs2cs -E +proj=utm +zone=34T +units=m +proj=tmerc -f "%.7f" > $1.gps

#perl ~/Desktop/maps/openstreetmapkosova/convert2osm.pl convert.txt > new.osm

converter:

use strict;

use warnings;

my $filename=shift @ARGV;

sub getval
{
my $self =shift;
my $name =shift;
open IN,$filename . ".$name" or die "no file";
my $value;
# warn "filename $filename";
while ()
{
# warn $_;
chomp;

$value = $_;
$value =~ s/\s+$//g;
}
close IN;
$self->{attrs}{$name}=$value;
}

my $obj = {};

getval $obj, "street";
getval $obj, "building";
getval $obj, "gps";

my ($umtx,$umty,$lat,$lon)=split " ",$obj->{attrs}{gps};

$obj->{lat} = $lat;
$obj->{lon} = $lon;
$obj->{umtx} = $umtx;
$obj->{umty} = $umty;
delete $obj->{attrs}{gps};
if ($filename =~ /=(.+)/)
{
$obj->{attrs}{kpaid}=$1;
}

#print q[

#my $id = -1;
my $oldnode = `grep $lat changeset.txt | grep lon`;

#warn $oldnode;

#print qq[
#
#];
#print ""

die "no old node" unless $oldnode =~ /node id/;

#$oldnode =~ s/node id/node chant/;
$oldnode =~ s/node id\=/node action="modify" id=/g;
$oldnode =~ s/\/\>/\>/g;
print $oldnode;

foreach my $k (sort keys %{$obj->{attrs}})
{
my $v= $obj->{attrs}{$k};
print "\n";
}

print "\n";

#print q[];

h4ck3rm1k32009年08月 8日 18時08分 發表的評論

here is the shell command :

for x in resultPAmun.asp\?IS\=*PZ; do  perl ~/Desktop/maps/openstreetmapkosova/convert2.pl $x;  done > newtest2.osm

登入 來留下評論