OpenStreetMap 로고 OpenStreetMap

Updates of KPAOnline Scraper

h4ck3rm1k3님이 English로 2009년 8월 8일에 게시함.

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.

이메일 아이콘 Bluesky 아이콘 Facebook 아이콘 LinkedIn 아이콘 마스토돈 아이콘 텔레그램 아이콘 X 아이콘

토론

2009년 8월 8일 17:49h4ck3rm1k3님의 의견

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

2009년 8월 8일 17:50h4ck3rm1k3님의 의견

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[];

2009년 8월 8일 18:08h4ck3rm1k3님의 의견

here is the shell command :

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

댓글을 남기려면 로그인하세요