📜 ⬆️ ⬇️

Yandex.maps and robots

As you know, Yandex recently launched the beta version of its new maps with good satellite images of many Russian cities. But what is most interesting is that no protection against bots and other robotic visitors is provided, so it’s enough to write a simple script that can download the specified map piece, the initial coordinates can be obtained via Firefox (Tools -> information about the page -> Multimedia).



Settings for Nizhny Novgorod.
')
 <? set_time_limit(0); $start_x = 81464; $end_x = 81620; $start_y = 40680; $end_y = 40812; for ($y=$start_y;$y<=$end_y;$y++) { for ($x=$start_x;$x<=$end_x;$ {B) { $url = "http://sat02.maps.yandex.net/tiles?l=sat&v=1.2.0&x=".$x."&y=".$y."&z=17"; if (!file_exists("./maps/".$x."_".$y.".jpg")) { $map = @file_get_contents($url); if ($map) { file_put_contents("./maps/".$x."_".$y.".jpg",$map); } } echo $x." ".$y."\r\n"; flush(); } } ?> 


And you can assemble a map into a large HTML table like this:

 <? echo "<table cellpadding=0 cellspacing=0 border=0>"; $start_x = 81464; $end_x = 81620; $start_y = 40680; $end_y = 40812; for ($y=$start_y;$y<=$end_y;$y++) { echo "<tr>"; for ($x=$start_x;$x<=$end_x;$x++) { echo "<td><img src='./maps/".$x."_".$y.".jpg' width=256 height=256/></td>"; } echo "</tr>"; } echo "</table>"; ?> 
<? echo "<table cellpadding=0 cellspacing=0 border=0>"; $start_x = 81464; $end_x = 81620; $start_y = 40680; $end_y = 40812; for ($y=$start_y;$y<=$end_y;$y++) { echo "<tr>"; for ($x=$start_x;$x<=$end_x;$x++) { echo "<td><img src='./maps/".$x."_".$y.".jpg' width=256 height=256/></td>"; } echo "</tr>"; } echo "</table>"; ?>


UPD: Map for Nizhny Novgorod can be downloaded here

Source: https://habr.com/ru/post/37738/


All Articles