Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This what I use and it is working not too bad... you can improve the test if you have more cpu to waste by adding pixels.</p> <pre><code>function isItWatter($lat,$lng) { $GMAPStaticUrl = "https://maps.googleapis.com/maps/api/staticmap?center=".$lat.",".$lng."&amp;size=40x40&amp;maptype=roadmap&amp;sensor=false&amp;zoom=12&amp;key=YOURAPIKEY"; //echo $GMAPStaticUrl; $chuid = curl_init(); curl_setopt($chuid, CURLOPT_URL, $GMAPStaticUrl); curl_setopt($chuid, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($chuid, CURLOPT_SSL_VERIFYPEER, FALSE); $data = trim(curl_exec($chuid)); curl_close($chuid); $image = imagecreatefromstring($data); // this is for debug to print the image ob_start(); imagepng($image); $contents = ob_get_contents(); ob_end_clean(); echo "&lt;img src='data:image/png;base64,".base64_encode($contents)."' /&gt;"; // here is the test : I only test 3 pixels ( enough to avoid rivers ... ) $hexaColor = imagecolorat($image,0,0); $color_tran = imagecolorsforindex($image, $hexaColor); $hexaColor2 = imagecolorat($image,0,1); $color_tran2 = imagecolorsforindex($image, $hexaColor2); $hexaColor3 = imagecolorat($image,0,2); $color_tran3 = imagecolorsforindex($image, $hexaColor3); $red = $color_tran['red'] + $color_tran2['red'] + $color_tran3['red']; $green = $color_tran['green'] + $color_tran2['green'] + $color_tran3['green']; $blue = $color_tran['blue'] + $color_tran2['blue'] + $color_tran3['blue']; imagedestroy($image); var_dump($red,$green,$blue); //int(492) int(570) int(660) if($red == 492 &amp;&amp; $green == 570 &amp;&amp; $blue == 660) return 1; else return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload