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