100){ $query2="select st_distance(way,(select way from osm_poi where osm_id=".$gipfel["osm_id"].")) as dominanz,coalesce(ele,srtmele),name,way from osm_poi where way && expand(cast('".$gipfel["way"]."' as geometry),30000) and osm_id!=".$gipfel["osm_id"]." and cast(coalesce(ele,srtmele) as float)>".$gipfel["ele"]." and nature='peak' order by dominanz limit 1;"; $result2=pg_query($db,$query2); $gipfel2=pg_fetch_array($result2); $p=preg_split('/ /',preg_replace('/[A-Z\(\)]+/','',$gipfel["p"])); if( $gipfel2["dominanz"]!="") {$dom=cos($p[1]/180*3.14)*$gipfel2["dominanz"];} else {$dom=30000;} $query2="-- Entfernung zum Gipfel: update osm_poi set population=".(int)$dom." where osm_id=".$gipfel["osm_id"]." and nature='peak';"; echo $query2."\n"; $d=(int)$dom; if($d<300) {$d=300;} if($d>100000){$d=300000;} $query2="update osm_poi set population=".(int)$d." where osm_id=".$gipfel["osm_id"]." and nature='peak';"; echo $query2."\n"; } } pg_close($db); echo "update osm_point set population=0 where \"natural\"='peak' and population is null;\n"; ?>