Commit 31f82b4c6ef53a70b9a6b69c2558c86c7c8a4b18

Authored by Edmar Moretti
1 parent aa7ccce9

Correção na operação de localização de lugares

Showing 2 changed files with 10 additions and 5 deletions   Show diff stats
mobile/index.php
... ... @@ -75,6 +75,7 @@ $mapas = $m->pegaListaDeMapas($locmapas);
75 75 echo "<h1>Escolha um dos mapas:</h1>";
76 76 foreach($mapas["mapas"] as $obj)
77 77 {
  78 + if($obj["TEMAS"] != "")
78 79 echo "<input type=radio onclick='ligar(\"".$obj["TEMAS"]."\",\"".$obj["LIGADOS"]."\")' />".$obj["NOME"]."<br><br>";
79 80 }
80 81 echo "<h1>ou uma das op&ccedil;&otilde;es:</h1>";
... ...
mobile/localizar.php
... ... @@ -92,27 +92,31 @@ if ($tipo == &#39;executa&#39;)
92 92 $layer = $linha["layer"];
93 93 foreach ($lugares as $lugar)
94 94 {
  95 + $x = array();
  96 + $y = array();
95 97 $wkt = $lugar["limite"];
96   - $wkt = str_replace("POLYGON","",$wkt);
97   - $wkt = explode("(",$wkt);
98   - $wkt = explode(")",$wkt[2]);
99   - $wkt = explode(",",$wkt[0]);
  98 + $wkt = str_replace("POLYGON((","",$wkt);
  99 + $wkt = str_replace("))","",$wkt);
  100 + $wkt = explode(",",$wkt);
  101 + //echo "<br>".var_dump($wkt);
100 102 for($w=0;$w<count($wkt); $w++)
101 103 {
102 104 $temp = explode(" ",$wkt[$w]);
103 105 $x[] = $temp[0];
104 106 $y[] = $temp[1];
105 107 }
  108 +
106 109 $xMin = min($x);
107 110 $xMax = max($x);
108 111 $yMin = min($y);
109 112 $yMax = max($y);
  113 +
110 114 $wkt = $xMin.",".$yMin.",".$xMax.",".$yMax;
  115 + //echo "<br>Final ".$wkt."<br>";
111 116 $gid = $lugar["gid"];
112 117 $nome = mb_convert_encoding($lugar["nome"],"ISO-8859-1","UTF-8");
113 118 echo "<input type='radio' onclick=\"zoom('".$wkt."','".$layer."','".$gid."','".$nome."')\" />".$nome."<br>";
114 119 }
115   -
116 120 }
117 121 }
118 122 if($tipo == "zoom")
... ...