$hstoredec = Pg::hstore::decode($row->{'tags'});
}
my $levels = fetchlastofhr(1, $hstoredec, 'levels', 'building:levels');
- my $height = fetchlastofhr($height, $hstoredec, 'height', 'building:height');
- unless ($height =~ m/^[0-9.]+$/) { undef($height); }
+ my $height = fetchlastofhr(undef, $hstoredec, 'height', 'building:height');
+ unless ((defined($height)) && ($height =~ m/^[0-9.]+$/)) {
+ undef($height);
+ }
my $minlevel = fetchlastofhr(0, $hstoredec,
'min_levels', 'building:min_levels', 'min_level', 'building:min_level');
- my $minheight = fetchlastofhr($minheight, $hstoredec, 'min_height', 'building:min_height');
- unless ($minheight =~ m/^[0-9.]+$/) { undef($minheight); }
+ my $minheight = fetchlastofhr(undef, $hstoredec, 'min_height', 'building:min_height');
+ unless ((defined($minheight)) && ($minheight =~ m/^[0-9.]+$/)) {
+ undef($minheight);
+ }
my $shape = fetchlastofhr(undef, $hstoredec, 'building:shape');
my $material = fetchlastofhr(undef, $hstoredec,
'building:material', 'building:facade:material', 'building:cladding');
}
if (defined($wallcolor)) {
$wallcolor = JSON->new->allow_nonref->encode($wallcolor);
- printwows(" \"wallColor\": \"$wallcolor\",\n");
+ printwows(" \"wallColor\": $wallcolor,\n");
}
if (defined($roofcolor)) {
$roofcolor = JSON->new->allow_nonref->encode($roofcolor);
- printwows(" \"roofColor\": \"$roofcolor\",\n");
+ printwows(" \"roofColor\": $roofcolor,\n");
}
if (defined($roofshape)) {
if ($roofshape eq 'pyramidal') { $roofshape = 'pyramid'; }
$roofshape = JSON->new->allow_nonref->encode($roofshape);
- printwows(" \"roofShape\": \"$roofshape\",\n");
+ printwows(" \"roofShape\": $roofshape,\n");
}
if (defined($roofmaterial)) {
$roofmaterial = JSON->new->allow_nonref->encode($roofmaterial);
- printwows(" \"roofMaterial\": \"$roofmaterial\",\n");
+ printwows(" \"roofMaterial\": $roofmaterial,\n");
}
if (defined($roofheight)) {
$roofheight = sprintf("%.1f", $roofheight);