Commit e157b68852e3de407cf8f533f8286cd685a0bbda
1 parent
ef39184d
Exists in
master
--no commit message
Showing
2 changed files
with
480 additions
and
475 deletions
Show diff stats
ogc.htm
... | ... | @@ -201,6 +201,8 @@ A:hover { |
201 | 201 | ins += |
202 | 202 | "<p><a target=blank href='"+servico+"OUTPUTFORMAT=csv&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"' />download CSV via WFS</a>"; |
203 | 203 | ins += |
204 | + "<p><a target=blank href='"+servico+"OUTPUTFORMAT=csv&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"&ows_geomtype=none' />download CSV via WFS mas sem a geometria</a>"; | |
205 | + ins += | |
204 | 206 | "<p><a target=blank href='"+servico+"OUTPUTFORMAT=kmz&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"' />download KMZ</a>"; |
205 | 207 | ins += |
206 | 208 | "<p><a target=blank href='"+servico+"OUTPUTFORMAT=geojson&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"' />GeoJson</a>"; | ... | ... |
ogc.php
1 | -<?php | |
1 | +<?php | |
2 | 2 | /* |
3 | 3 | Title: Gerador de serviços OGC |
4 | 4 | |
... | ... | @@ -38,36 +38,37 @@ ajuda - (opcional) mostra uma ajuda ao usu&aacute;rio |
38 | 38 | |
39 | 39 | tema - (opcional) nome do tema que será mostrado no serviço. Se for definido, o web service conterá apenas esse tema. O tema é o nome do mapfile existente em i3geo/temas, mas pode ser especificado um mapfile existente em outra pasta. Nesse caso, deve-se especificar o caminho completo para o arquivo. Se não for definido, serão considerados todos os temas |
40 | 40 | |
41 | -intervalo - (opcional) valor inicial e final com o número de temas que serão mostrados no serviço | |
42 | - | |
43 | 41 | legenda - (opcional) mostra a legenda no corpo do mapa sim|nao |
44 | 42 | |
45 | 43 | perfil - (opcional) perfil utilizado para restringir os temas que serão mostrados |
46 | 44 | |
47 | -format - (opcional) pode ser utilizado a opção &format=application/openlayers para | |
48 | -abrir o mashup do OpenLayers com as camadas definida em temas. | |
49 | -Na geração da legenda pode ser utilizado text/html para gerar no formato html. | |
50 | - | |
45 | +format - (opcional) pode ser utilizado a opção &format=application/openlayers para | |
46 | +abrir o mashup do OpenLayers com as camadas definida em temas. | |
47 | +Na geração da legenda pode ser utilizado text/html para gerar no formato html. | |
48 | + | |
51 | 49 | OUTPUTFORMAT - em getfeature, aceita também shape-zip para download de shapefile e csv para download de csv compactado |
52 | - | |
50 | + | |
51 | +ows_geomtype - permite definir o tipo de geometria conforme utilizado pelo parametro GEOMETRY do OGR (veja http://gdal.org/drv_csv.html) | |
52 | +afeta o OUTPUTFORMAT csv. Utilize &ows_geomtype=none para obter um csv sem a coluna geometry | |
53 | + | |
53 | 54 | id_medida_variavel - id da medida de variavel - utilizado apenas quando a fonte para definicao do layer for o sistema de metadados estatisticos |
54 | -nao deve ser utilizado junto com tema | |
55 | - | |
55 | +nao deve ser utilizado junto com tema | |
56 | + | |
56 | 57 | restauramapa - ID de um mapa salvo no sistema de administracao. O mapa e restaurado e tratado como WMS |
57 | - | |
58 | -DESLIGACACHE (opcional) {sim|nao} - forca a nao usar o cache de imagens qd definido como "sim", do contrário, o uso ou não do cache será definido automaticamente | |
59 | - | |
60 | -filtros - filtros podem ser adicionados incluindo o parametro da seguinte forma: &map_layer_<nomedotema>_filter= | |
61 | - | |
62 | -Exemplo de filtro | |
63 | - | |
64 | -http://localhost/i3geo/ogc.php?map_layer__lbiomashp_filter=(('[CD_LEGENDA]'='CAATINGA'))&tema=_lbiomashp&SRS=EPSG:4618&WIDTH=500&HEIGHT=500&BBOX=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&FORMAT=image/png&service=wms&version=1.1.0&request=getmap&layers=_lbiomashp | |
65 | - | |
66 | -no caso de camadas Postgis basta usar map_layer__lbiomashp_filter=cd_legenda='CAATINGA' | |
58 | + | |
59 | +DESLIGACACHE (opcional) {sim|nao} - forca a nao usar o cache de imagens qd definido como "sim", do contrário, o uso ou não do cache será definido automaticamente | |
60 | + | |
61 | +filtros - filtros podem ser adicionados incluindo o parametro da seguinte forma: &map_layer_<nomedotema>_filter= | |
62 | + | |
63 | +Exemplo de filtro | |
64 | + | |
65 | +http://localhost/i3geo/ogc.php?map_layer__lbiomashp_filter=(('[CD_LEGENDA]'='CAATINGA'))&tema=_lbiomashp&SRS=EPSG:4618&WIDTH=500&HEIGHT=500&BBOX=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&FORMAT=image/png&service=wms&version=1.1.0&request=getmap&layers=_lbiomashp | |
66 | + | |
67 | +no caso de camadas Postgis basta usar map_layer__lbiomashp_filter=cd_legenda='CAATINGA' | |
67 | 68 | |
68 | 69 | Exemplos: |
69 | - | |
70 | -ogc.php?temas=biomashp&format=application/openlayers&bbox=-54,-14,-50,-10 | |
70 | + | |
71 | +ogc.php?temas=biomashp&format=application/openlayers&bbox=-54,-14,-50,-10 | |
71 | 72 | |
72 | 73 | ogc.php?lista=temas |
73 | 74 | |
... | ... | @@ -75,39 +76,38 @@ ogc.php?tema=bioma |
75 | 76 | |
76 | 77 | ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo |
77 | 78 | |
78 | -ogc.php?intervalo=0,50 | |
79 | 79 | */ |
80 | -$_GET = array_merge($_GET,$_POST); | |
80 | +$_GET = array_merge($_GET,$_POST); | |
81 | 81 | // |
82 | 82 | //caso nenhum parametros tenha sido enviado |
83 | 83 | // |
84 | 84 | if(count($_GET) == 0){ |
85 | 85 | $tipo="metadados"; |
86 | - $_GET["REQUEST"] = "getCapabilities"; | |
86 | + $_GET["REQUEST"] = "getCapabilities"; | |
87 | 87 | $_GET["request"] = "getCapabilities"; |
88 | 88 | $_GET["SERVICE"] = "WMS"; |
89 | -} | |
89 | +} | |
90 | 90 | // |
91 | 91 | //compatibiliza chamadas fora do padrao |
92 | 92 | // |
93 | 93 | if(isset($_GET["outputFormat"]) && $_GET["outputFormat"] != ""){ |
94 | 94 | $_GET["OUTPUTFORMAT"] = $_GET["outputFormat"]; |
95 | -} | |
95 | +} | |
96 | 96 | if(isset($_GET["outputformat"]) && $_GET["outputformat"] != ""){ |
97 | 97 | $_GET["OUTPUTFORMAT"] = $_GET["outputformat"]; |
98 | 98 | } |
99 | 99 | $cache = true; |
100 | 100 | //require_once(dirname(__FILE__)."/classesphp/carrega_ext.php"); |
101 | 101 | include(dirname(__FILE__)."/ms_configura.php"); |
102 | -include(dirname(__FILE__)."/classesphp/pega_variaveis.php"); | |
103 | -include(dirname(__FILE__)."/classesphp/funcoes_gerais.php"); | |
102 | +include(dirname(__FILE__)."/classesphp/pega_variaveis.php"); | |
103 | +include(dirname(__FILE__)."/classesphp/funcoes_gerais.php"); | |
104 | 104 | // |
105 | 105 | //imprime na tela a ajuda |
106 | 106 | // |
107 | 107 | if(isset($ajuda)){ |
108 | 108 | ogc_imprimeAjuda(); |
109 | 109 | exit; |
110 | -} | |
110 | +} | |
111 | 111 | // |
112 | 112 | //pega os enderecos para compor a url de chamada do gerador de web services |
113 | 113 | // |
... | ... | @@ -115,35 +115,35 @@ $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); |
115 | 115 | $protocolo = $protocolo[0]; |
116 | 116 | $protocolo1 = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME']; |
117 | 117 | $protocolo = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME'] .":". $_SERVER['SERVER_PORT']; |
118 | -$urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]); | |
118 | +$urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]); | |
119 | 119 | // |
120 | 120 | //imprime na tela a lista de temas disponiveis |
121 | 121 | // |
122 | 122 | if(isset($lista) && $lista != ""){ |
123 | 123 | include_once(dirname(__FILE__)."/classesphp/classe_menutemas.php"); |
124 | - if($lista == "temas"){ | |
125 | - ogc_imprimeListaDeTemas(); | |
126 | - } | |
124 | + if($lista == "temas"){ | |
125 | + ogc_imprimeListaDeTemas(); | |
126 | + } | |
127 | 127 | if($lista == "temaswfs"){ |
128 | 128 | ogc_imprimeListaDeTemasWfs(); |
129 | 129 | } |
130 | 130 | exit; |
131 | -} | |
131 | +} | |
132 | 132 | // |
133 | 133 | //define um nome para o mapfile caso a origem seja o sistema de metadados estatisticos |
134 | 134 | // |
135 | 135 | if(isset($id_medida_variavel) && $id_medida_variavel != ""){ |
136 | 136 | $tema = "ogcmetaestat".$id_medida_variavel; |
137 | -} | |
138 | -// | |
139 | -//compatibiliza variaveis | |
140 | -// | |
137 | +} | |
138 | +// | |
139 | +//compatibiliza variaveis | |
140 | +// | |
141 | 141 | if(!isset($tema) && isset($layers)){ |
142 | 142 | $tema = $layers; |
143 | -} | |
143 | +} | |
144 | 144 | if(!isset($tema) && isset($LAYERS)){ |
145 | 145 | $tema = $LAYERS; |
146 | -} | |
146 | +} | |
147 | 147 | if(!isset($tema) && isset($temas)){ |
148 | 148 | $tema = $temas; |
149 | 149 | } |
... | ... | @@ -152,27 +152,27 @@ if(isset($typeName)){ |
152 | 152 | } |
153 | 153 | if(!isset($tema) && isset($typename)){ |
154 | 154 | $tema = $typename; |
155 | -} | |
156 | -// | |
157 | -//garante que layers possam ser especificados de diferentes maneiras | |
158 | -// | |
155 | +} | |
156 | +// | |
157 | +//garante que layers possam ser especificados de diferentes maneiras | |
158 | +// | |
159 | 159 | $_GET["layers"] = $tema; |
160 | -$_GET["LAYERS"] = $tema; | |
161 | -$layers = $tema; | |
162 | -// | |
163 | -//verifica o OUTPUTFORMAT e o cache de arquivo | |
164 | -// | |
165 | -if(!empty($OUTPUTFORMAT)){ | |
166 | - carregaCacheArquivo(); | |
167 | -} | |
168 | -// | |
169 | -//para o caso da requisicao kml | |
160 | +$_GET["LAYERS"] = $tema; | |
161 | +$layers = $tema; | |
162 | +// | |
163 | +//verifica o OUTPUTFORMAT e o cache de arquivo | |
164 | +// | |
165 | +if(!empty($OUTPUTFORMAT)){ | |
166 | + carregaCacheArquivo(); | |
167 | +} | |
168 | +// | |
169 | +//para o caso da requisicao kml | |
170 | 170 | // |
171 | 171 | if(strtolower($OUTPUTFORMAT) == "kml" || strtolower($OUTPUTFORMAT) == "kmz"){ |
172 | 172 | $urln = "pacotes/kmlmapserver/kmlservice.php?request=kmz&map=".$tema."&typename=".$tema; |
173 | 173 | header("Location:".$urln); |
174 | 174 | exit; |
175 | -} | |
175 | +} | |
176 | 176 | // |
177 | 177 | //usa o epsg correto ao inves do apelido inventado pelo Google |
178 | 178 | // |
... | ... | @@ -183,31 +183,31 @@ if($_GET["SRS"] == "EPSG:900913" || $_GET["srs"] == "EPSG:900913"){ |
183 | 183 | if(!isset($_GET["srs"]) && !isset($_GET["SRS"])){ |
184 | 184 | $_GET["srs"] = "EPSG:4326"; |
185 | 185 | $_GET["SRS"] = "EPSG:4326"; |
186 | -} | |
187 | -// | |
188 | -//trata geojson da mesma forma que json | |
189 | -// | |
186 | +} | |
187 | +// | |
188 | +//trata geojson da mesma forma que json | |
189 | +// | |
190 | 190 | if(strtolower($OUTPUTFORMAT) == "geojson"){ |
191 | 191 | $OUTPUTFORMAT = "json"; |
192 | -} | |
192 | +} | |
193 | 193 | // |
194 | 194 | //recupera um mapa salvo no banco de administracao |
195 | 195 | // |
196 | 196 | if(!empty($restauramapa)){ |
197 | - restauraMapaSalvo(); | |
198 | -} | |
197 | + restauraMapaSalvo(); | |
198 | +} | |
199 | 199 | // |
200 | 200 | //para operar como o Geoserver, abre o openlayers |
201 | 201 | // |
202 | 202 | if(isset($format) && strtolower($format) == "application/openlayers"){ |
203 | 203 | $urln = dirname($_SERVER["PHP_SELF"])."/mashups/openlayers.php?layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica"; |
204 | - //echo $urln;exit; | |
205 | - if(!headers_sent()){ | |
206 | - header("Location:".$urln); | |
204 | + //echo $urln;exit; | |
205 | + if(!headers_sent()){ | |
206 | + header("Location:".$urln); | |
207 | + } | |
208 | + else{ | |
209 | + echo "<meta http-equiv='refresh' content='0;url=$urln'>"; | |
207 | 210 | } |
208 | - else{ | |
209 | - echo "<meta http-equiv='refresh' content='0;url=$urln'>"; | |
210 | - } | |
211 | 211 | //exit.... |
212 | 212 | } |
213 | 213 | // |
... | ... | @@ -215,16 +215,16 @@ if(isset($format) && strtolower($format) == "application/openlayers"){ |
215 | 215 | // |
216 | 216 | error_reporting(0); |
217 | 217 | $versao = versao(); |
218 | -$versao = $versao["principal"]; | |
218 | +$versao = $versao["principal"]; | |
219 | 219 | |
220 | -$req = ms_newowsrequestobj(); | |
220 | +$req = ms_newowsrequestobj(); | |
221 | 221 | $tipo = ""; |
222 | 222 | |
223 | 223 | if(isset($_GET["sld"]) || isset($_GET["filter"])){ |
224 | 224 | $cache = false; |
225 | -} | |
226 | -// | |
227 | -//inclui todos os parametros na requisicao e aproveita para verificar getcapabilities | |
225 | +} | |
226 | +// | |
227 | +//inclui todos os parametros na requisicao e aproveita para verificar getcapabilities | |
228 | 228 | // |
229 | 229 | foreach ($_GET as $k=>$v){ |
230 | 230 | $req->setParameter(strtoupper($k), $v); |
... | ... | @@ -232,54 +232,54 @@ foreach ($_GET as $k=>$v){ |
232 | 232 | $tipo = "metadados"; |
233 | 233 | $cache = false; |
234 | 234 | } |
235 | -} | |
236 | -// | |
237 | -//cria uma lista de epsgs para o getcapabilities | |
238 | -// | |
239 | -$req->setParameter("srsName",$req->getValueByName("SRS")); | |
235 | +} | |
236 | +// | |
237 | +//cria uma lista de epsgs para o getcapabilities | |
238 | +// | |
239 | +$req->setParameter("srsName",$req->getValueByName("SRS")); | |
240 | 240 | $listaepsg = $req->getValueByName("SRS")." EPSG:4618 EPSG:4291 EPSG:4326 EPSG:22521 EPSG:22522 EPSG:22523 EPSG:22524 EPSG:22525 EPSG:29101 EPSG:29119 EPSG:29120 EPSG:29121 EPSG:29122 EPSG:29177 EPSG:29178 EPSG:29179 EPSG:29180 EPSG:29181 EPSG:29182 EPSG:29183 EPSG:29184 EPSG:29185"; |
241 | 241 | |
242 | -if(isset($version) && !isset($VERSION)){ | |
243 | - $VERSION = $version; | |
242 | +if(isset($version) && !isset($VERSION)){ | |
243 | + $VERSION = $version; | |
244 | 244 | } |
245 | 245 | if(!isset($VERSION)){ |
246 | - $req->setParameter("VeRsIoN","1.1.1"); | |
247 | -} | |
248 | -// | |
249 | -//nome do mapfile que ficara em cache | |
250 | -// | |
251 | -$agora = intval(time() / 1000); | |
252 | -//acrescenta ao nome a indicacao do tipo de TMS | |
246 | + $req->setParameter("VeRsIoN","1.1.1"); | |
247 | +} | |
248 | +// | |
249 | +//nome do mapfile que ficara em cache | |
250 | +// | |
251 | +$agora = intval(time() / 1000); | |
252 | +//acrescenta ao nome a indicacao do tipo de TMS | |
253 | 253 | if(isset($_GET["tms"])){ |
254 | 254 | $agora .= "tms"; |
255 | -} | |
256 | -if(isset($_GET["Z"]) && isset($_GET["X"])){ | |
257 | - $agora .= "google"; | |
258 | -} | |
259 | -// | |
260 | -//se o outputformat for definido, evita o cahce de arquivo | |
261 | -//o mesmo se existir filtro para o layer | |
262 | -// | |
263 | -if(isset($_GET["OUTPUTFORMAT"]) || !empty($_GET["map_layer_".$tema."_filter"])){ | |
264 | - $_GET["DESLIGACACHE"] = "sim"; | |
265 | -} | |
266 | -if(isset($_GET["DESLIGACACHE"]) && $_GET["DESLIGACACHE"] == "sim"){ | |
267 | - $agora = time(); | |
268 | - $cache = false; | |
269 | -} | |
270 | -$nomeMapfileTmp = $dir_tmp."/ogc_".md5(implode("",$_GET))."_".$agora.".map"; | |
271 | -//essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao | |
272 | -$cortePixels = 0; | |
273 | -if(file_exists($nomeMapfileTmp) && $tipo == ""){ | |
274 | - $oMap = ms_newMapobj($nomeMapfileTmp); | |
275 | -} | |
276 | -else{ | |
255 | +} | |
256 | +if(isset($_GET["Z"]) && isset($_GET["X"])){ | |
257 | + $agora .= "google"; | |
258 | +} | |
259 | +// | |
260 | +//se o outputformat for definido, evita o cahce de arquivo | |
261 | +//o mesmo se existir filtro para o layer | |
262 | +// | |
263 | +if(isset($_GET["OUTPUTFORMAT"]) || !empty($_GET["map_layer_".$tema."_filter"])){ | |
264 | + $_GET["DESLIGACACHE"] = "sim"; | |
265 | +} | |
266 | +if(isset($_GET["DESLIGACACHE"]) && $_GET["DESLIGACACHE"] == "sim"){ | |
267 | + $agora = time(); | |
268 | + $cache = false; | |
269 | +} | |
270 | +$nomeMapfileTmp = $dir_tmp."/ogc_".md5(implode("",$_GET))."_".$agora.".map"; | |
271 | +//essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao | |
272 | +$cortePixels = 0; | |
273 | +if(file_exists($nomeMapfileTmp) && $tipo == ""){ | |
274 | + $oMap = ms_newMapobj($nomeMapfileTmp); | |
275 | +} | |
276 | +else{ | |
277 | 277 | if(empty($ogcwsmap)){ |
278 | 278 | $oMap = ms_newMapobj($locaplic."/aplicmap/ogcwsv".$versao.".map"); |
279 | 279 | } |
280 | 280 | else{ |
281 | 281 | $oMap = ms_newMapobj($ogcwsmap); |
282 | - } | |
282 | + } | |
283 | 283 | $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://"; |
284 | 284 | $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; |
285 | 285 | $or = $urli3geo."/ogc.php"; |
... | ... | @@ -299,15 +299,15 @@ else{ |
299 | 299 | $oMap->setmetadata("wms_attribution_logourl_href",$urli3geo."/imagens/i3geo.png"); |
300 | 300 | $oMap->setmetadata("wms_attribution_onlineresource",$urli3geo); |
301 | 301 | $oMap->setmetadata("wms_attribution_title",$tituloInstituicao); |
302 | - $oMap->setmetadata("ows_enable_request","*"); | |
303 | - //parametro mandatario | |
304 | - if($oMap->getmetadata("wms_srs") == ""){ | |
305 | - $oMap->setmetadata("wms_srs","EPSG:4326"); | |
302 | + $oMap->setmetadata("ows_enable_request","*"); | |
303 | + //parametro mandatario | |
304 | + if($oMap->getmetadata("wms_srs") == ""){ | |
305 | + $oMap->setmetadata("wms_srs","EPSG:4326"); | |
306 | 306 | } |
307 | 307 | $e = $oMap->extent; |
308 | - $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); | |
308 | + $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); | |
309 | 309 | //gera o mapa |
310 | - if ($tema != ""){ | |
310 | + if ($tema != ""){ | |
311 | 311 | $listatema = explode(" ",$tema); |
312 | 312 | //para o caso do tema ser um arquivo mapfile existente em uma pasta qualquer |
313 | 313 | //$temai3geo = true indica que o layer será buscado na pasta i3geo/temas |
... | ... | @@ -319,7 +319,7 @@ else{ |
319 | 319 | $nmap->setmetadata("ows_enable_request","*"); |
320 | 320 | } |
321 | 321 | foreach ($listatema as $tx){ |
322 | - $extensao = ".map"; | |
322 | + $extensao = ".map"; | |
323 | 323 | if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".php")){ |
324 | 324 | $extensao = ".php"; |
325 | 325 | } |
... | ... | @@ -328,15 +328,15 @@ else{ |
328 | 328 | } |
329 | 329 | if($extensao == ".map"){ |
330 | 330 | //cria o mapfile com base no sistema de metadados estatisticos |
331 | - //verifica se o id_medida_variavel existe no mapfile e nao foi passado como um parametro | |
332 | - if(!isset($id_medida_variavel) && $temai3geo == true){ | |
333 | - $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); | |
334 | - $l = $nmap->getlayer(0); | |
335 | - $teste = $l->getmetadata("METAESTAT_ID_MEDIDA_VARIAVEL"); | |
336 | - if($teste != "" && $l->data == ""){ | |
337 | - $id_medida_variavel = $teste; | |
338 | - } | |
339 | - } | |
331 | + //verifica se o id_medida_variavel existe no mapfile e nao foi passado como um parametro | |
332 | + if(!isset($id_medida_variavel) && $temai3geo == true){ | |
333 | + $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); | |
334 | + $l = $nmap->getlayer(0); | |
335 | + $teste = $l->getmetadata("METAESTAT_ID_MEDIDA_VARIAVEL"); | |
336 | + if($teste != "" && $l->data == ""){ | |
337 | + $id_medida_variavel = $teste; | |
338 | + } | |
339 | + } | |
340 | 340 | if(isset($id_medida_variavel)){ |
341 | 341 | $temai3geo = false; |
342 | 342 | include("admin/php/classe_metaestat.php"); |
... | ... | @@ -346,32 +346,32 @@ else{ |
346 | 346 | $nmap = ms_newMapobj($mapfileMetaestat["mapfile"]); |
347 | 347 | $nmap->setmetadata("ows_enable_request","*"); |
348 | 348 | $req->setParameter("LAYERS", "ogcmetaestat".$id_medida_variavel); |
349 | - } | |
349 | + } | |
350 | 350 | if($temai3geo == true){ |
351 | 351 | $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); |
352 | 352 | $nmap->setmetadata("ows_enable_request","*"); |
353 | 353 | } |
354 | - if($temai3geo == false || empty($layers)){ | |
355 | - $ts = $nmap->getalllayernames(); | |
356 | - $nmap->setmetadata("ows_enable_request","*"); | |
354 | + if($temai3geo == false || empty($layers)){ | |
355 | + $ts = $nmap->getalllayernames(); | |
356 | + $nmap->setmetadata("ows_enable_request","*"); | |
357 | 357 | } |
358 | 358 | else{ |
359 | 359 | $ts = explode(",",str_replace(" ",",",$layers)); |
360 | 360 | } |
361 | - foreach ($ts as $t){ | |
361 | + foreach ($ts as $t){ | |
362 | 362 | $l = $nmap->getlayerbyname($t); |
363 | - $permite = $l->getmetadata("permiteogc"); | |
363 | + $permite = $l->getmetadata("permiteogc"); | |
364 | 364 | if(strtolower($permite) != "nao"){ |
365 | 365 | //necessário pq o mapfile pode ter todos os layers como default |
366 | 366 | if($temai3geo == false){ |
367 | 367 | $l->set("status",MS_OFF); |
368 | - } | |
368 | + } | |
369 | 369 | /* |
370 | 370 | if($cache == true && strtolower($l->getmetadata('cache')) == 'sim' && $tipo == '' && count($tema) == 1){ |
371 | 371 | carregaCacheImagem($_GET['BBOX'],$tx,$_GET['WIDTH'],$_GET['HEIGHT'],$cachedir); |
372 | - } | |
372 | + } | |
373 | 373 | */ |
374 | - $l->setmetadata("ows_title",pegaNome($l)); | |
374 | + $l->setmetadata("ows_title",pegaNome($l)); | |
375 | 375 | $l->setmetadata("ows_srs",$listaepsg); |
376 | 376 | $l->set("group",""); |
377 | 377 | //essa linha é necessária pq as vezes no mapfile não tem nenhum layer com o nome igual ao nome do mapfile |
... | ... | @@ -382,7 +382,7 @@ else{ |
382 | 382 | $l->set("template","none.htm"); |
383 | 383 | $l->set("dump",MS_TRUE); |
384 | 384 | $l->setmetadata("WMS_INCLUDE_ITEMS","all"); |
385 | - $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | |
385 | + $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | |
386 | 386 | |
387 | 387 | if(file_exists($locaplic."/temas/miniaturas/".$t.".map.mini.png")){ |
388 | 388 | $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$t.".map.mini.png"; |
... | ... | @@ -393,8 +393,8 @@ else{ |
393 | 393 | } |
394 | 394 | if($l->type == MS_LAYER_RASTER && $l->numclasses > 0){ |
395 | 395 | $c = $l->getclass(0); |
396 | - if($c->name == ""){ | |
397 | - $c->name = " "; | |
396 | + if($c->name == ""){ | |
397 | + $c->name = " "; | |
398 | 398 | } |
399 | 399 | } |
400 | 400 | //inclui extensao geografica |
... | ... | @@ -423,26 +423,26 @@ else{ |
423 | 423 | } |
424 | 424 | autoClasses($l,$oMap); |
425 | 425 | if($versao > 5){ |
426 | - $pr = $l->getProcessing(); | |
427 | - if(!in_array("LABEL_NO_CLIP=True",$pr)){ | |
428 | - $l->setprocessing("LABEL_NO_CLIP=True"); | |
429 | - } | |
430 | - if(!in_array("POLYLINE_NO_CLIP=True",$pr)){ | |
431 | - $l->setprocessing("POLYLINE_NO_CLIP=True"); | |
432 | - } | |
433 | - } | |
434 | - // | |
435 | - //verifica se existem parametros de substituicao passados via url | |
436 | - // | |
437 | - $parametro = $_GET["map_layer_".$l->name."_filter"]; | |
438 | - //echo $parametro;exit; | |
439 | - if(!empty($parametro)){ | |
440 | - $l->setfilter($parametro); | |
441 | - $cache = false; | |
442 | - } | |
426 | + $pr = $l->getProcessing(); | |
427 | + if(!in_array("LABEL_NO_CLIP=True",$pr)){ | |
428 | + $l->setprocessing("LABEL_NO_CLIP=True"); | |
429 | + } | |
430 | + if(!in_array("POLYLINE_NO_CLIP=True",$pr)){ | |
431 | + $l->setprocessing("POLYLINE_NO_CLIP=True"); | |
432 | + } | |
433 | + } | |
434 | + // | |
435 | + //verifica se existem parametros de substituicao passados via url | |
436 | + // | |
437 | + $parametro = $_GET["map_layer_".$l->name."_filter"]; | |
438 | + //echo $parametro;exit; | |
439 | + if(!empty($parametro)){ | |
440 | + $l->setfilter($parametro); | |
441 | + $cache = false; | |
442 | + } | |
443 | 443 | |
444 | - ms_newLayerObj($oMap, $l); | |
445 | - //$req->setParameter("LAYERS", "mundo"); | |
444 | + ms_newLayerObj($oMap, $l); | |
445 | + //$req->setParameter("LAYERS", "mundo"); | |
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
... | ... | @@ -454,10 +454,10 @@ else{ |
454 | 454 | include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php"); |
455 | 455 | $gm = new gvsig2mapfile($locaplic."/temas/".$tx.".gvp"); |
456 | 456 | $gvsigview = $gm->getViewsNames(); |
457 | - foreach($gvsigview as $gv){ | |
457 | + foreach($gvsigview as $gv){ | |
458 | 458 | $dataView = $gm->getViewData($gv); |
459 | 459 | $oMap = $gm->addLayers($oMap,$gv,$dataView["layerNames"]); |
460 | - } | |
460 | + } | |
461 | 461 | $numlayers = $oMap->numlayers; |
462 | 462 | $lys = array(); |
463 | 463 | //$layers[] = "default"; |
... | ... | @@ -480,8 +480,8 @@ else{ |
480 | 480 | } |
481 | 481 | if($l->type == MS_LAYER_RASTER && $l->numclasses > 0){ |
482 | 482 | $c = $l->getclass(0); |
483 | - if($c->name == ""){ | |
484 | - $c->name = " "; | |
483 | + if($c->name == ""){ | |
484 | + $c->name = " "; | |
485 | 485 | } |
486 | 486 | } |
487 | 487 | //inclui extensao geografica |
... | ... | @@ -489,12 +489,12 @@ else{ |
489 | 489 | if($extensao == ""){ |
490 | 490 | $extensao = $extensaoMap; |
491 | 491 | } |
492 | - $l->setmetadata("wms_extent",$extensao); | |
493 | - // | |
494 | - //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
495 | - // | |
496 | - if ($l->getmetadata("cortepixels") != ""){ | |
497 | - $cortePixels = $l->getmetadata("cortepixels"); | |
492 | + $l->setmetadata("wms_extent",$extensao); | |
493 | + // | |
494 | + //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
495 | + // | |
496 | + if ($l->getmetadata("cortepixels") != ""){ | |
497 | + $cortePixels = $l->getmetadata("cortepixels"); | |
498 | 498 | } |
499 | 499 | } |
500 | 500 | $req->setParameter("LAYERS", implode(",",$lys)); |
... | ... | @@ -502,13 +502,13 @@ else{ |
502 | 502 | } |
503 | 503 | } |
504 | 504 | } |
505 | - else{ | |
506 | - $intervalo = "0,5000"; | |
505 | + else{ | |
506 | + $intervalo = "0,5000"; | |
507 | 507 | $conta = 0; |
508 | 508 | $int = explode(",",$intervalo); |
509 | 509 | $codigosTema = array(); |
510 | - if(empty($perfil)){ | |
511 | - $perfil = ""; | |
510 | + if(empty($perfil)){ | |
511 | + $perfil = ""; | |
512 | 512 | } |
513 | 513 | include("classesphp/classe_menutemas.php"); |
514 | 514 | $m = new Menutemas("",$perfil,$locaplic,$urli3geo); |
... | ... | @@ -541,8 +541,8 @@ else{ |
541 | 541 | if ($oMap->getlayerbyname($t) == ""){ |
542 | 542 | $l = $nmap->getlayerbyname($t); |
543 | 543 | $extensao = $l->getmetadata("EXTENSAO"); |
544 | - if($extensao == ""){ | |
545 | - $extensao = $extensaoMap; | |
544 | + if($extensao == ""){ | |
545 | + $extensao = $extensaoMap; | |
546 | 546 | } |
547 | 547 | $l->setmetadata("wms_extent",$extensao); |
548 | 548 | $l->setmetadata("ows_title",pegaNome($l)); |
... | ... | @@ -551,25 +551,25 @@ else{ |
551 | 551 | $l->setmetadata("gml_include_items","all"); |
552 | 552 | $l->set("dump",MS_TRUE); |
553 | 553 | $l->setmetadata("WMS_INCLUDE_ITEMS","all"); |
554 | - $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | |
555 | - if($l->getmetadata("ows_metadataurl_href") == ""){ | |
554 | + $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | |
555 | + if($l->getmetadata("ows_metadataurl_href") == ""){ | |
556 | 556 | $l->setmetadata("ows_metadataurl_href",$c["fonte"]); |
557 | 557 | $l->setmetadata("ows_metadataurl_type","TC211"); |
558 | 558 | $l->setmetadata("ows_metadataurl_format","text/html"); |
559 | - } | |
559 | + } | |
560 | 560 | if(file_exists($locaplic."/temas/miniaturas/".$t.".map.mini.png")){ |
561 | 561 | $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$t.".map.mini.png"; |
562 | 562 | $l->setmetadata("wms_attribution_logourl_format","image/png"); |
563 | 563 | $l->setmetadata("wms_attribution_logourl_height","50"); |
564 | 564 | $l->setmetadata("wms_attribution_logourl_width","50"); |
565 | 565 | $l->setmetadata("wms_attribution_logourl_href",$mini); |
566 | - } | |
567 | - // | |
568 | - //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
569 | - // | |
570 | - if ($l->getmetadata("cortepixels") != ""){ | |
571 | - $cortePixels = $l->getmetadata("cortepixels"); | |
572 | - } | |
566 | + } | |
567 | + // | |
568 | + //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
569 | + // | |
570 | + if ($l->getmetadata("cortepixels") != ""){ | |
571 | + $cortePixels = $l->getmetadata("cortepixels"); | |
572 | + } | |
573 | 573 | cloneInlineSymbol($l,$nmap,$oMap); |
574 | 574 | ms_newLayerObj($oMap, $l); |
575 | 575 | } |
... | ... | @@ -584,104 +584,104 @@ else{ |
584 | 584 | } |
585 | 585 | } |
586 | 586 | } |
587 | - } | |
588 | - } | |
587 | + } | |
588 | + } | |
589 | 589 | // |
590 | 590 | //a imagem do mapa recebera a legenda |
591 | 591 | // |
592 | 592 | if((isset($legenda)) && (strtolower($legenda) == "sim")){ |
593 | 593 | $leg = $oMap->legend; |
594 | 594 | $leg->set("status",MS_EMBED); |
595 | - } | |
596 | - $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); | |
597 | - $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); | |
598 | - // | |
599 | - //caso seja download ou json ou csv | |
600 | - // | |
601 | - processaOutputformatMapfile(); | |
602 | - | |
603 | - $oMap->save($nomeMapfileTmp); | |
604 | - $oMap = ms_newMapobj($nomeMapfileTmp); | |
605 | -} | |
595 | + } | |
596 | + $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); | |
597 | + $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); | |
598 | + // | |
599 | + //caso seja download ou json ou csv | |
600 | + // | |
601 | + processaOutputformatMapfile(); | |
602 | + | |
603 | + $oMap->save($nomeMapfileTmp); | |
604 | + $oMap = ms_newMapobj($nomeMapfileTmp); | |
605 | +} | |
606 | 606 | if(ob_get_contents ()){ |
607 | 607 | ob_end_clean(); |
608 | -} | |
609 | -// | |
610 | -//verifica se a requisicao e do tipo TMS. | |
611 | -// | |
612 | -// | |
613 | -//calcula a extensao geografica com base no x,y,z em requisisoes TMS | |
614 | -//quando for do tipo tms $_GET["tms"] contem os parametros do tile | |
615 | -//essa rotina faz um exit ao final | |
616 | -//o cache tms so fucniona se houver apenas uma camada no mapa | |
617 | -//tms e usado basicamente por mashup ou openlayers | |
618 | -// | |
619 | -if(isset($_GET["tms"])){ | |
620 | - $temp = explode("/",$_GET["tms"]); | |
621 | - $z = $temp[2]; | |
622 | - $x = $temp[3]; | |
623 | - $y = str_replace(".png","",$temp[4]); | |
624 | - $n = pow(2,$z+1); | |
625 | - $lon1 = $x / $n * 360.0 - 180.0; | |
626 | - $lon2 = ($x+1) / $n * 360.0 - 180.0; | |
627 | - $n = pow(2,$z); | |
628 | - $lat1 = $y / $n * 180.0 - 90.0; | |
629 | - $lat2 = ($y+1) / $n * 180.0 - 90.0; | |
630 | - //essa funcao termina o processo se a imagem existir | |
631 | - if($cache == true){ | |
632 | - carregaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]); | |
633 | - } | |
634 | - $layer0 = $oMap->getlayer(0); | |
635 | - // | |
636 | - //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
637 | - // | |
638 | - if ($layer0->getmetadata("cortepixels") != ""){ | |
639 | - $cortePixels = $layer0->getmetadata("cortepixels"); | |
640 | - } | |
641 | - //se nao existir, salva a imagem | |
642 | - //echo $lon1." ".$lat1." ".$lon2." ".$lat2;exit; | |
643 | - $oMap->setsize(256,256); | |
644 | - | |
645 | - $oMap->setExtent($lon1,$lat1,$lon2,$lat2); | |
646 | - | |
647 | - $layer0->set("status",MS_DEFAULT); | |
648 | - // | |
649 | - //se o layer foi marcado para corte altera os parametros para ampliar o mapa | |
650 | - //antes de gerar a imagem | |
651 | - // | |
652 | - if($cortePixels > 0){ | |
653 | - //$oMap->prepareImage(); | |
654 | - $escalaInicial = $oMap->scaledenom; | |
655 | - $extensaoInicial = $oMap->extent; | |
656 | - $wh = 256+($cortePixels*2); | |
657 | - $oMap->setsize($wh,$wh); | |
658 | - $ponto = new pointObj(); | |
659 | - $ponto->setxy(($wh/2),($wh/2)); | |
660 | - $oMap->zoomScale($escalaInicial, $ponto, $wh, $wh, $extensaoInicial); | |
661 | - } | |
662 | - $img = $oMap->draw(); | |
663 | - if($img->imagepath == ""){ | |
664 | - exit; | |
665 | - } | |
666 | - if($cache == true){ | |
667 | - salvaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]); | |
668 | - } | |
669 | - renderNocacheTms(); | |
670 | -} | |
608 | +} | |
609 | +// | |
610 | +//verifica se a requisicao e do tipo TMS. | |
611 | +// | |
612 | +// | |
613 | +//calcula a extensao geografica com base no x,y,z em requisisoes TMS | |
614 | +//quando for do tipo tms $_GET["tms"] contem os parametros do tile | |
615 | +//essa rotina faz um exit ao final | |
616 | +//o cache tms so fucniona se houver apenas uma camada no mapa | |
617 | +//tms e usado basicamente por mashup ou openlayers | |
618 | +// | |
619 | +if(isset($_GET["tms"])){ | |
620 | + $temp = explode("/",$_GET["tms"]); | |
621 | + $z = $temp[2]; | |
622 | + $x = $temp[3]; | |
623 | + $y = str_replace(".png","",$temp[4]); | |
624 | + $n = pow(2,$z+1); | |
625 | + $lon1 = $x / $n * 360.0 - 180.0; | |
626 | + $lon2 = ($x+1) / $n * 360.0 - 180.0; | |
627 | + $n = pow(2,$z); | |
628 | + $lat1 = $y / $n * 180.0 - 90.0; | |
629 | + $lat2 = ($y+1) / $n * 180.0 - 90.0; | |
630 | + //essa funcao termina o processo se a imagem existir | |
631 | + if($cache == true){ | |
632 | + carregaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]); | |
633 | + } | |
634 | + $layer0 = $oMap->getlayer(0); | |
635 | + // | |
636 | + //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
637 | + // | |
638 | + if ($layer0->getmetadata("cortepixels") != ""){ | |
639 | + $cortePixels = $layer0->getmetadata("cortepixels"); | |
640 | + } | |
641 | + //se nao existir, salva a imagem | |
642 | + //echo $lon1." ".$lat1." ".$lon2." ".$lat2;exit; | |
643 | + $oMap->setsize(256,256); | |
644 | + | |
645 | + $oMap->setExtent($lon1,$lat1,$lon2,$lat2); | |
646 | + | |
647 | + $layer0->set("status",MS_DEFAULT); | |
648 | + // | |
649 | + //se o layer foi marcado para corte altera os parametros para ampliar o mapa | |
650 | + //antes de gerar a imagem | |
651 | + // | |
652 | + if($cortePixels > 0){ | |
653 | + //$oMap->prepareImage(); | |
654 | + $escalaInicial = $oMap->scaledenom; | |
655 | + $extensaoInicial = $oMap->extent; | |
656 | + $wh = 256+($cortePixels*2); | |
657 | + $oMap->setsize($wh,$wh); | |
658 | + $ponto = new pointObj(); | |
659 | + $ponto->setxy(($wh/2),($wh/2)); | |
660 | + $oMap->zoomScale($escalaInicial, $ponto, $wh, $wh, $extensaoInicial); | |
661 | + } | |
662 | + $img = $oMap->draw(); | |
663 | + if($img->imagepath == ""){ | |
664 | + exit; | |
665 | + } | |
666 | + if($cache == true){ | |
667 | + salvaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]); | |
668 | + } | |
669 | + renderNocacheTms(); | |
670 | +} | |
671 | 671 | // |
672 | 672 | //verifica se a chamada do servico e do tipo TILE no padrao do Google |
673 | 673 | // |
674 | -if(isset($_GET["Z"]) && isset($_GET["X"])){ | |
674 | +if(isset($_GET["Z"]) && isset($_GET["X"])){ | |
675 | 675 | $x = $_GET["X"]; |
676 | 676 | $y = $_GET["Y"]; |
677 | 677 | $z = $_GET["Z"]; |
678 | - $layer0 = $oMap->getlayer(0); | |
679 | - // | |
680 | - //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
681 | - // | |
682 | - if ($layer0->getmetadata("cortepixels") != ""){ | |
683 | - $cortePixels = $layer0->getmetadata("cortepixels"); | |
684 | - } | |
678 | + $layer0 = $oMap->getlayer(0); | |
679 | + // | |
680 | + //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
681 | + // | |
682 | + if ($layer0->getmetadata("cortepixels") != ""){ | |
683 | + $cortePixels = $layer0->getmetadata("cortepixels"); | |
684 | + } | |
685 | 685 | if($cache == true){ |
686 | 686 | carregaCacheImagem($cachedir,$nomeMapfileTmp,"/googlemaps/$layer0->name/$z/$x/$y"); |
687 | 687 | } |
... | ... | @@ -703,40 +703,40 @@ if(isset($_GET["Z"]) && isset($_GET["X"])){ |
703 | 703 | $poPoint1->project($projInObj, $projOutObj); |
704 | 704 | $poPoint2 = ms_newpointobj(); |
705 | 705 | $poPoint2->setXY($lon2, $lat2); |
706 | - $poPoint2->project($projInObj, $projOutObj); | |
707 | - $oMap->setsize(256,256); | |
706 | + $poPoint2->project($projInObj, $projOutObj); | |
707 | + $oMap->setsize(256,256); | |
708 | 708 | $oMap->setExtent($poPoint1->x,$poPoint1->y,$poPoint2->x,$poPoint2->y); |
709 | 709 | |
710 | - $oMap->getlayer(0)->set("status",MS_DEFAULT); | |
711 | - $oMap->setProjection("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m"); | |
712 | - $layer0->setProjection("proj=latlong,a=6378137,b=6378137"); | |
713 | - // | |
714 | - //se o layer foi marcado para corte altera os parametros para ampliar o mapa | |
715 | - //antes de gerar a imagem | |
716 | - // | |
717 | - if($cortePixels > 0){ | |
718 | - //$oMap->prepareImage(); | |
719 | - $escalaInicial = $oMap->scaledenom; | |
720 | - $extensaoInicial = $oMap->extent; | |
721 | - $wh = 256+($cortePixels*2); | |
722 | - $oMap->setsize($wh,$wh); | |
723 | - $ponto = new pointObj(); | |
724 | - $ponto->setxy(($wh/2),($wh/2)); | |
725 | - $oMap->zoomScale($escalaInicial, $ponto, $wh, $wh, $extensaoInicial); | |
726 | - } | |
710 | + $oMap->getlayer(0)->set("status",MS_DEFAULT); | |
711 | + $oMap->setProjection("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m"); | |
712 | + $layer0->setProjection("proj=latlong,a=6378137,b=6378137"); | |
713 | + // | |
714 | + //se o layer foi marcado para corte altera os parametros para ampliar o mapa | |
715 | + //antes de gerar a imagem | |
716 | + // | |
717 | + if($cortePixels > 0){ | |
718 | + //$oMap->prepareImage(); | |
719 | + $escalaInicial = $oMap->scaledenom; | |
720 | + $extensaoInicial = $oMap->extent; | |
721 | + $wh = 256+($cortePixels*2); | |
722 | + $oMap->setsize($wh,$wh); | |
723 | + $ponto = new pointObj(); | |
724 | + $ponto->setxy(($wh/2),($wh/2)); | |
725 | + $oMap->zoomScale($escalaInicial, $ponto, $wh, $wh, $extensaoInicial); | |
726 | + } | |
727 | 727 | $img = $oMap->draw(); |
728 | 728 | if($img->imagepath == ""){ |
729 | 729 | exit; |
730 | - } | |
730 | + } | |
731 | 731 | if($cache == true){ |
732 | - salvaCacheImagem($cachedir,$nomeMapfileTmp,"/googlemaps/$layer0->name/$z/$x/$y"); | |
733 | - } | |
734 | - renderNocacheTms(); | |
735 | -} | |
736 | -if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ | |
737 | - $l = $oMap->getlayer(0); | |
738 | - if($req->getValueByName("LAYER") == ""){ | |
739 | - $req->setParameter("LAYER",$l->name); | |
732 | + salvaCacheImagem($cachedir,$nomeMapfileTmp,"/googlemaps/$layer0->name/$z/$x/$y"); | |
733 | + } | |
734 | + renderNocacheTms(); | |
735 | +} | |
736 | +if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ | |
737 | + $l = $oMap->getlayer(0); | |
738 | + if($req->getValueByName("LAYER") == ""){ | |
739 | + $req->setParameter("LAYER",$l->name); | |
740 | 740 | } |
741 | 741 | //muda o title se for vazio |
742 | 742 | $nclass = $l->numclasses; |
... | ... | @@ -745,29 +745,29 @@ if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ |
745 | 745 | if($classe->title === ""){ |
746 | 746 | $classe->title = $classe->name; |
747 | 747 | } |
748 | - } | |
748 | + } | |
749 | 749 | if($req->getValueByName("FORMAT") == ""){ |
750 | 750 | $req->setParameter("FORMAT","image/png"); |
751 | 751 | } |
752 | - $legenda = $oMap->legend; | |
753 | - $legenda->set("status",MS_ON); | |
754 | - $l->set("minscaledenom",0); | |
752 | + $legenda = $oMap->legend; | |
753 | + $legenda->set("status",MS_ON); | |
754 | + $l->set("minscaledenom",0); | |
755 | 755 | $l->set("maxscaledenom",0); |
756 | 756 | if($req->getValueByName("FORMAT") == "text/html"){ |
757 | 757 | //$req->setParameter("FORMAT","image/png"); |
758 | 758 | $l = $oMap->getlayerbyname($req->getValueByName("LAYER")); |
759 | - $l->set("status",MS_DEFAULT); | |
760 | - //remove offset de simbolos pontuais | |
761 | - $nclass = $l->numclasses; | |
762 | - for($cc = 0; $cc < $nclass; $cc++){ | |
763 | - $classe = $l->getclass($cc); | |
764 | - if($classe->numstyles > 0){ | |
765 | - $estilo = $classe->getstyle(0); | |
766 | - if($estilo->symbolname != "" && file_exists($estilo->symbolname)){ | |
767 | - $estilo->set("offsetx",0); | |
768 | - $estilo->set("offsety",0); | |
769 | - } | |
770 | - } | |
759 | + $l->set("status",MS_DEFAULT); | |
760 | + //remove offset de simbolos pontuais | |
761 | + $nclass = $l->numclasses; | |
762 | + for($cc = 0; $cc < $nclass; $cc++){ | |
763 | + $classe = $l->getclass($cc); | |
764 | + if($classe->numstyles > 0){ | |
765 | + $estilo = $classe->getstyle(0); | |
766 | + if($estilo->symbolname != "" && file_exists($estilo->symbolname)){ | |
767 | + $estilo->set("offsetx",0); | |
768 | + $estilo->set("offsety",0); | |
769 | + } | |
770 | + } | |
771 | 771 | } |
772 | 772 | $legenda->set("template",$locaplic."/aplicmap/legendaOgc.html"); |
773 | 773 | $tmparray["my_tag"] = "value_of_my_tag"; |
... | ... | @@ -775,62 +775,62 @@ if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ |
775 | 775 | if (function_exists("mb_convert_encoding")){ |
776 | 776 | $leg = mb_convert_encoding($leg,"UTF-8","ISO-8859-1"); |
777 | 777 | } |
778 | - echo $leg; | |
778 | + echo $leg; | |
779 | 779 | exit; |
780 | 780 | } |
781 | - } | |
782 | -} | |
781 | + } | |
782 | +} | |
783 | 783 | if(strtolower($req->getValueByName("REQUEST")) == "getfeature"){ |
784 | 784 | $l = $oMap->getlayer(0); |
785 | 785 | if($req->getValueByName("TYPENAME") == "" || $req->getValueByName("TYPENAME") == "undefined"){ |
786 | 786 | $req->setParameter("TYPENAME",$l->name); |
787 | - } | |
788 | - if($l->getProjection() == "" ){ | |
789 | - $l->setProjection("proj=latlong,a=6378137,b=6378137"); | |
790 | - } | |
791 | - if(strtolower($req->getValueByName("SRS")) == "epsg:900913"){ | |
792 | - $req->setParameter("SRS","EPSG:3857"); | |
793 | 787 | } |
794 | -} | |
795 | -if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo"){ | |
796 | - $l = $oMap->getlayer(0); | |
797 | - $req->setParameter("LAYERS",$l->name); | |
798 | - $req->setParameter("QUERY_LAYERS",$l->name); | |
799 | - if(strtolower($req->getValueByName("SRS")) == "epsg:900913"){ | |
800 | - $req->setParameter("SRS","EPSG:3857"); | |
801 | - $_GET["SRS"] = "EPSG:3857"; | |
802 | - } | |
803 | -} | |
804 | - | |
805 | -ms_ioinstallstdouttobuffer(); | |
806 | -// | |
807 | -//verifica parametro outputformat e ajusta a requisicao | |
808 | -// | |
809 | -if(strtolower($req->getValueByName("REQUEST")) == "getmap" && $req->getValueByName("format") == ""){ | |
810 | - $req->setParameter("format","image/png"); | |
811 | -} | |
788 | + if($l->getProjection() == "" ){ | |
789 | + $l->setProjection("proj=latlong,a=6378137,b=6378137"); | |
790 | + } | |
791 | + if(strtolower($req->getValueByName("SRS")) == "epsg:900913"){ | |
792 | + $req->setParameter("SRS","EPSG:3857"); | |
793 | + } | |
794 | +} | |
795 | +if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo"){ | |
796 | + $l = $oMap->getlayer(0); | |
797 | + $req->setParameter("LAYERS",$l->name); | |
798 | + $req->setParameter("QUERY_LAYERS",$l->name); | |
799 | + if(strtolower($req->getValueByName("SRS")) == "epsg:900913"){ | |
800 | + $req->setParameter("SRS","EPSG:3857"); | |
801 | + $_GET["SRS"] = "EPSG:3857"; | |
802 | + } | |
803 | +} | |
804 | + | |
805 | +ms_ioinstallstdouttobuffer(); | |
806 | +// | |
807 | +//verifica parametro outputformat e ajusta a requisicao | |
808 | +// | |
809 | +if(strtolower($req->getValueByName("REQUEST")) == "getmap" && $req->getValueByName("format") == ""){ | |
810 | + $req->setParameter("format","image/png"); | |
811 | +} | |
812 | 812 | if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo" && $_GET["info_format"] == "text/xml"){ |
813 | - $req->setParameter("info_format","application/vnd.ogc.gml"); | |
814 | -} | |
815 | -//json conforme cesium | |
813 | + $req->setParameter("info_format","application/vnd.ogc.gml"); | |
814 | +} | |
815 | +//json conforme cesium | |
816 | 816 | if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo" && $_GET["info_format"] == "application/json"){ |
817 | - getfeatureinfoJson(); | |
817 | + getfeatureinfoJson(); | |
818 | 818 | exit; |
819 | -} | |
820 | -$oMap->owsdispatch($req); | |
819 | +} | |
820 | +$oMap->owsdispatch($req); | |
821 | 821 | |
822 | -$contenttype = ms_iostripstdoutbuffercontenttype(); | |
823 | - | |
824 | -if(strtolower($request) == "getcapabilities"){ | |
825 | - header('Content-Disposition: attachment; filename=getcapabilities.xml'); | |
822 | +$contenttype = ms_iostripstdoutbuffercontenttype(); | |
823 | + | |
824 | +if(strtolower($request) == "getcapabilities"){ | |
825 | + header('Content-Disposition: attachment; filename=getcapabilities.xml'); | |
826 | 826 | } |
827 | - | |
827 | + | |
828 | 828 | if(!isset($OUTPUTFORMAT)){ |
829 | 829 | header("Content-type: $contenttype"); |
830 | -} | |
831 | - | |
832 | -//precisa limpar o cabecalho | |
833 | -if(strtolower($OUTPUTFORMAT) == "geojson" || strtolower($OUTPUTFORMAT) == "json"){ | |
830 | +} | |
831 | + | |
832 | +//precisa limpar o cabecalho | |
833 | +if(strtolower($OUTPUTFORMAT) == "geojson" || strtolower($OUTPUTFORMAT) == "json"){ | |
834 | 834 | ms_iostripstdoutbuffercontentheaders(); |
835 | 835 | //grava em disco |
836 | 836 | $arq = $dir_tmp."/".$tema.".json"; |
... | ... | @@ -841,31 +841,32 @@ if(strtolower($OUTPUTFORMAT) == "geojson" || strtolower($OUTPUTFORMAT) == "json" |
841 | 841 | ms_iogetStdoutBufferBytes(); |
842 | 842 | ms_ioresethandlers(); |
843 | 843 | exit; |
844 | -} | |
845 | -if(strtolower($OUTPUTFORMAT) == "shape-zip"){ | |
846 | - //grava em disco | |
844 | +} | |
845 | +if(strtolower($OUTPUTFORMAT) == "shape-zip"){ | |
846 | + //grava em disco | |
847 | 847 | $arq = $dir_tmp."/".$tema."_shapefile.zip"; |
848 | - $contents = ms_iogetstdoutbufferstring(); | |
849 | - file_put_contents($arq,$contents); | |
850 | - //envia para download | |
851 | - header('Content-Disposition: attachment; filename='.$tema.'_shapefile.zip'); | |
852 | - ms_iogetStdoutBufferBytes(); | |
853 | - ms_ioresethandlers(); | |
848 | + $contents = ms_iogetstdoutbufferstring(); | |
849 | + file_put_contents($arq,$contents); | |
850 | + //envia para download | |
851 | + header('Content-Disposition: attachment; filename='.$tema.'_shapefile.zip'); | |
852 | + ms_iogetStdoutBufferBytes(); | |
853 | + ms_ioresethandlers(); | |
854 | 854 | exit; |
855 | 855 | } |
856 | -if(strtolower($OUTPUTFORMAT) == "csv"){ | |
856 | +if(strtolower($OUTPUTFORMAT) == "csv"){ | |
857 | + ms_iostripstdoutbuffercontentheaders(); | |
857 | 858 | //grava em disco |
858 | - $arq = $dir_tmp."/".$tema.".csv"; | |
859 | + $arq = $dir_tmp."/".$tema.$ows_geomtype.".csv"; | |
859 | 860 | $contents = ms_iogetstdoutbufferstring(); |
860 | 861 | file_put_contents($arq,$contents); |
861 | 862 | //envia para download |
862 | - header('Content-Disposition: attachment; filename='.$tema.'.csv'); | |
863 | + header('Content-Disposition: attachment; filename='.$tema.$ows_geomtype.'.csv'); | |
863 | 864 | header("Content-type: text/csv"); |
864 | 865 | ms_iogetStdoutBufferBytes(); |
865 | 866 | ms_ioresethandlers(); |
866 | 867 | exit; |
867 | 868 | } |
868 | -$buffer = ms_iogetStdoutBufferBytes(); | |
869 | +$buffer = ms_iogetStdoutBufferBytes(); | |
869 | 870 | |
870 | 871 | ms_ioresethandlers(); |
871 | 872 | // |
... | ... | @@ -873,13 +874,13 @@ ms_ioresethandlers(); |
873 | 874 | // |
874 | 875 | function ogc_pegaListaDeMenus(){ |
875 | 876 | global $perfil,$locaplic,$urli3geo; |
876 | - if(!isset($perfil)){ | |
877 | - $perfil = ""; | |
877 | + if(!isset($perfil)){ | |
878 | + $perfil = ""; | |
878 | 879 | } |
879 | 880 | $m = new Menutemas("",$perfil,$locsistemas,$locaplic,"",$urli3geo); |
880 | 881 | foreach($m->pegaListaDeMenus() as $menu) |
881 | - { | |
882 | - $menus[] = $urli3geo."/admin/xmlmenutemas.php?id_menu=".$menu["idmenu"]; | |
882 | + { | |
883 | + $menus[] = $urli3geo."/admin/xmlmenutemas.php?id_menu=".$menu["idmenu"]; | |
883 | 884 | } |
884 | 885 | return $menus; |
885 | 886 | } |
... | ... | @@ -891,11 +892,11 @@ function ogc_imprimeAjuda(){ |
891 | 892 | echo "ogc.php?lista=temas - para listar os temas disponíveis<br>"; |
892 | 893 | echo "Para usar esse web service voce pode usar o parametro &tema=,<br>"; |
893 | 894 | echo "ou seja,http://[host]/i3geo/ogc.php?tema=[codigo do tema]<br>"; |
894 | - echo "no lugar do codigo pode ser especificado um arquivo mapfile qualquer. "; | |
895 | + echo "no lugar do codigo pode ser especificado um arquivo mapfile qualquer. "; | |
895 | 896 | echo "Nesse caso, deve ser digitado o caminho completo no servidor<br><br>"; |
896 | 897 | echo "Utilize o sistema de administracao do i3Geo para configurar quais os temas da pasta i3geo/temas podem ser utilizados.<br><br>"; |
897 | - echo "Utilize o parametro restauramapa para indicar o ID de um mapa salvo no banco <br>"; | |
898 | - echo "de dados de administracao para utiliza-lo como um WMS"; | |
898 | + echo "Utilize o parametro restauramapa para indicar o ID de um mapa salvo no banco <br>"; | |
899 | + echo "de dados de administracao para utiliza-lo como um WMS"; | |
899 | 900 | } |
900 | 901 | function ogc_imprimeListaDeTemas(){ |
901 | 902 | global $urli3geo,$perfil,$locaplic; |
... | ... | @@ -969,52 +970,52 @@ function ogc_imprimeListaDeTemasWfs(){ |
969 | 970 | } |
970 | 971 | echo $imprimir."</body></html>"; |
971 | 972 | } |
972 | -function carregaCacheImagem($cachedir,$map,$tms){ | |
973 | - global $dir_tmp; | |
974 | - if($cachedir == ""){ | |
975 | - $nome = $dir_tmp."/cache".$tms; | |
976 | - } | |
977 | - else{ | |
978 | - $nome = $cachedir.$tms; | |
979 | - } | |
980 | - if(file_exists($nome)){ | |
981 | - header('Content-Length: '.filesize($nome)); | |
982 | - header('Content-Type: image/png'); | |
983 | - header('Cache-Control: max-age=3600, must-revalidate'); | |
984 | - header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); | |
985 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nome)).' GMT', true, 200); | |
986 | - $etag = md5_file($nome); | |
987 | - header('Etag: '.$etag); | |
988 | - readfile($nome); | |
989 | - exit; | |
990 | - } | |
991 | -} | |
973 | +function carregaCacheImagem($cachedir,$map,$tms){ | |
974 | + global $dir_tmp; | |
975 | + if($cachedir == ""){ | |
976 | + $nome = $dir_tmp."/cache".$tms; | |
977 | + } | |
978 | + else{ | |
979 | + $nome = $cachedir.$tms; | |
980 | + } | |
981 | + if(file_exists($nome)){ | |
982 | + header('Content-Length: '.filesize($nome)); | |
983 | + header('Content-Type: image/png'); | |
984 | + header('Cache-Control: max-age=3600, must-revalidate'); | |
985 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); | |
986 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nome)).' GMT', true, 200); | |
987 | + $etag = md5_file($nome); | |
988 | + header('Etag: '.$etag); | |
989 | + readfile($nome); | |
990 | + exit; | |
991 | + } | |
992 | +} | |
992 | 993 | function salvaCacheImagem($cachedir,$map,$tms){ |
993 | - global $img,$dir_tmp,$cortePixels; | |
994 | + global $img,$dir_tmp,$cortePixels; | |
994 | 995 | if($cachedir == ""){ |
995 | 996 | $nome = $dir_tmp."/cache".$tms; |
996 | 997 | } |
997 | 998 | else{ |
998 | 999 | $nome = $cachedir.$tms; |
999 | - } | |
1000 | + } | |
1000 | 1001 | @mkdir(dirname($nome),0777,true); |
1001 | - chmod(dirname($nome),0777); | |
1002 | + chmod(dirname($nome),0777); | |
1002 | 1003 | $img->saveImage($nome); |
1003 | - // | |
1004 | - //corta a imagem gerada para voltar ao tamanho normal | |
1005 | - // | |
1006 | - if($cortePixels > 0){ | |
1007 | - $img = imagecreatefrompng($nome); | |
1008 | - $imgc = imagecreate(256,256); | |
1009 | - | |
1010 | - imagesavealpha($imgc, true); | |
1011 | - // Fill the image with transparent color | |
1012 | - $color = imagecolorallocatealpha($imgc,0x00,0x00,0x00,127); | |
1013 | - imagefill($imgc, 0, 0, $color); | |
1014 | - | |
1015 | - imagecopy($imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256); | |
1016 | - imagepng($imgc,$nome); | |
1017 | - } | |
1004 | + // | |
1005 | + //corta a imagem gerada para voltar ao tamanho normal | |
1006 | + // | |
1007 | + if($cortePixels > 0){ | |
1008 | + $img = imagecreatefrompng($nome); | |
1009 | + $imgc = imagecreate(256,256); | |
1010 | + | |
1011 | + imagesavealpha($imgc, true); | |
1012 | + // Fill the image with transparent color | |
1013 | + $color = imagecolorallocatealpha($imgc,0x00,0x00,0x00,127); | |
1014 | + imagefill($imgc, 0, 0, $color); | |
1015 | + | |
1016 | + imagecopy($imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256); | |
1017 | + imagepng($imgc,$nome); | |
1018 | + } | |
1018 | 1019 | chmod($nome,0777); |
1019 | 1020 | header('Content-Length: '.filesize($nome)); |
1020 | 1021 | header('Content-Type: image/png'); |
... | ... | @@ -1023,55 +1024,54 @@ function salvaCacheImagem($cachedir,$map,$tms){ |
1023 | 1024 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nome)).' GMT', true, 200); |
1024 | 1025 | readfile($nome); |
1025 | 1026 | exit; |
1026 | -} | |
1027 | -function texto2iso($texto){ | |
1028 | - if (function_exists("mb_convert_encoding")){ | |
1029 | - if (mb_detect_encoding($texto,"UTF-8",true)){ | |
1030 | - $texto = mb_convert_encoding($texto,"ISO-8859-1","UTF-8"); | |
1031 | - } | |
1032 | - } | |
1033 | - return $texto; | |
1034 | -} | |
1027 | +} | |
1028 | +function texto2iso($texto){ | |
1029 | + if (function_exists("mb_convert_encoding")){ | |
1030 | + if (mb_detect_encoding($texto,"UTF-8",true)){ | |
1031 | + $texto = mb_convert_encoding($texto,"ISO-8859-1","UTF-8"); | |
1032 | + } | |
1033 | + } | |
1034 | + return $texto; | |
1035 | +} | |
1035 | 1036 | function nomeRand($n=10) |
1036 | 1037 | { |
1037 | 1038 | $nomes = ""; |
1038 | 1039 | $a = 'azertyuiopqsdfghjklmwxcvbnABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
1039 | 1040 | $max = 51; |
1040 | 1041 | for($i=0; $i < $n; ++$i) |
1041 | - { | |
1042 | - $nomes .= $a{mt_rand(0, $max)}; | |
1042 | + { | |
1043 | + $nomes .= $a{mt_rand(0, $max)}; | |
1043 | 1044 | } |
1044 | 1045 | return $nomes; |
1045 | -} | |
1046 | -function renderNocacheTms(){ | |
1047 | - global $img,$i3georendermode,$dir_tmp,$cortePixels; | |
1048 | - if($i3georendermode == 1 && $cortePixels == 0){ | |
1049 | - ob_clean(); | |
1050 | - header('Content-Type: image/png'); | |
1051 | - $img->saveImage(); | |
1052 | - exit; | |
1053 | - } | |
1054 | - if($i3georendermode == 1 && $cortePixels > 0){ | |
1055 | - $i3georendermode = 0; | |
1056 | - } | |
1057 | - $nomer = $dir_tmp."/temp".nomeRand().".png"; | |
1058 | - $img->saveImage($nomer); | |
1059 | - // | |
1060 | - //corta a imagem gerada para voltar ao tamanho normal | |
1061 | - // | |
1062 | - if($cortePixels > 0){ | |
1063 | - $img = imagecreatefrompng($nomer); | |
1064 | - $imgc = imagecreate(256,256); | |
1065 | - imagecopy( $imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256 ); | |
1066 | - imagepng($imgc,$nomer); | |
1067 | - } | |
1068 | - if($i3georendermode == 0 || !isset($i3georendermode)){ | |
1069 | - | |
1070 | - header('Content-Length: '.filesize($nomer)); | |
1071 | - header('Content-Type: image/png'); | |
1072 | - header('Cache-Control: max-age=3600, must-revalidate'); | |
1073 | - header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); | |
1074 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nomer)).' GMT', true, 200); | |
1046 | +} | |
1047 | +function renderNocacheTms(){ | |
1048 | + global $img,$i3georendermode,$dir_tmp,$cortePixels; | |
1049 | + if($i3georendermode == 1 && $cortePixels == 0){ | |
1050 | + ob_clean(); | |
1051 | + header('Content-Type: image/png'); | |
1052 | + $img->saveImage(); | |
1053 | + exit; | |
1054 | + } | |
1055 | + if($i3georendermode == 1 && $cortePixels > 0){ | |
1056 | + $i3georendermode = 0; | |
1057 | + } | |
1058 | + $nomer = $dir_tmp."/temp".nomeRand().".png"; | |
1059 | + $img->saveImage($nomer); | |
1060 | + // | |
1061 | + //corta a imagem gerada para voltar ao tamanho normal | |
1062 | + // | |
1063 | + if($cortePixels > 0){ | |
1064 | + $img = imagecreatefrompng($nomer); | |
1065 | + $imgc = imagecreate(256,256); | |
1066 | + imagecopy( $imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256 ); | |
1067 | + imagepng($imgc,$nomer); | |
1068 | + } | |
1069 | + if($i3georendermode == 0 || !isset($i3georendermode)){ | |
1070 | + header('Content-Length: '.filesize($nomer)); | |
1071 | + header('Content-Type: image/png'); | |
1072 | + header('Cache-Control: max-age=3600, must-revalidate'); | |
1073 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); | |
1074 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nomer)).' GMT', true, 200); | |
1075 | 1075 | readfile($nomer); |
1076 | 1076 | } |
1077 | 1077 | if($i3georendermode == 2){ |
... | ... | @@ -1080,10 +1080,10 @@ function renderNocacheTms(){ |
1080 | 1080 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+48*60*60) . ' GMT'); |
1081 | 1081 | header("X-Sendfile: $nomer"); |
1082 | 1082 | header("Content-type: image/png"); |
1083 | - } | |
1084 | -} | |
1085 | -function getfeatureinfoJson(){ | |
1086 | - global $req, $oMap; | |
1083 | + } | |
1084 | +} | |
1085 | +function getfeatureinfoJson(){ | |
1086 | + global $req, $oMap; | |
1087 | 1087 | $req->setParameter("info_format","application/vnd.ogc.gml"); |
1088 | 1088 | $oMap->owsdispatch($req); |
1089 | 1089 | ms_iostripstdoutbuffercontentheaders(); |
... | ... | @@ -1125,10 +1125,10 @@ function getfeatureinfoJson(){ |
1125 | 1125 | for($i = 0; $i < $n; $i++){ |
1126 | 1126 | $json = str_ireplace($itens[$i],$itensdesc[$i],$json); |
1127 | 1127 | } |
1128 | - echo $json; | |
1129 | -} | |
1130 | -function processaOutputformatMapfile(){ | |
1131 | - global $OUTPUTFORMAT, $oMap, $tema; | |
1128 | + echo $json; | |
1129 | +} | |
1130 | +function processaOutputformatMapfile(){ | |
1131 | + global $OUTPUTFORMAT, $oMap, $tema, $ows_geomtype; | |
1132 | 1132 | if(strtolower($OUTPUTFORMAT) == "shape-zip"){ |
1133 | 1133 | $l = $oMap->getlayer(0); |
1134 | 1134 | $n = $l->name; |
... | ... | @@ -1143,18 +1143,21 @@ function processaOutputformatMapfile(){ |
1143 | 1143 | $n = $l->name."-csv"; |
1144 | 1144 | $oMap->selectOutputFormat("csv"); |
1145 | 1145 | $oMap->outputformat->setOption("STORAGE", "filesystem"); |
1146 | - $oMap->outputformat->setOption("FILENAME", $tema.".csv"); | |
1146 | + $oMap->outputformat->setOption("FILENAME", $tema.$ows_geomtype.".csv"); | |
1147 | 1147 | $oMap->outputformat->setOption("FORM", "simple"); |
1148 | + if(isset($ows_geomtype) && $ows_geomtype != ""){ | |
1149 | + $oMap->outputformat->setOption("LCO:GEOMETRY", $ows_geomtype); | |
1150 | + } | |
1148 | 1151 | $l->setmetadata("wfs_getfeature_formatlist","csv"); |
1149 | 1152 | } |
1150 | 1153 | if(strtolower($OUTPUTFORMAT) == "geojson" || strtolower($OUTPUTFORMAT) == "json"){ |
1151 | 1154 | $l = $oMap->getlayer(0); |
1152 | 1155 | $oMap->selectOutputFormat("geojson"); |
1153 | 1156 | $l->setmetadata("wfs_getfeature_formatlist","geojson"); |
1154 | - } | |
1155 | -} | |
1157 | + } | |
1158 | +} | |
1156 | 1159 | function carregaCacheArquivo(){ |
1157 | - global $dir_tmp, $tema, $OUTPUTFORMAT; | |
1160 | + global $dir_tmp, $tema, $OUTPUTFORMAT, $ows_geomtype; | |
1158 | 1161 | if(strtolower($OUTPUTFORMAT) == "shape-zip"){ |
1159 | 1162 | $arq = $dir_tmp."/".$tema."_shapefile.zip"; |
1160 | 1163 | if(file_exists($arq)){ |
... | ... | @@ -1164,9 +1167,9 @@ function carregaCacheArquivo(){ |
1164 | 1167 | } |
1165 | 1168 | } |
1166 | 1169 | if(strtolower($OUTPUTFORMAT) == "csv"){ |
1167 | - $arq = $dir_tmp."/".$tema.".csv"; | |
1170 | + $arq = $dir_tmp."/".$tema.$ows_geomtype.".csv"; | |
1168 | 1171 | if(file_exists($arq)){ |
1169 | - header('Content-Disposition: attachment; filename='.$tema.'.csv'); | |
1172 | + header('Content-Disposition: attachment; filename='.$tema.$ows_geomtype.'.csv'); | |
1170 | 1173 | header("Content-type: text/csv"); |
1171 | 1174 | readfile($arq); |
1172 | 1175 | exit; |
... | ... | @@ -1180,9 +1183,9 @@ function carregaCacheArquivo(){ |
1180 | 1183 | exit; |
1181 | 1184 | } |
1182 | 1185 | } |
1183 | -} | |
1184 | -function restauraMapaSalvo(){ | |
1185 | - global $restauramapa, $dir_tmp, $tema; | |
1186 | +} | |
1187 | +function restauraMapaSalvo(){ | |
1188 | + global $restauramapa, $dir_tmp, $tema; | |
1186 | 1189 | $xbase = restauraMapaAdmin($restauramapa,$dir_tmp); |
1187 | 1190 | $m = ms_newMapObj($xbase); |
1188 | 1191 | $w = $m->web; |
... | ... | @@ -1203,12 +1206,12 @@ function restauraMapaSalvo(){ |
1203 | 1206 | $_GET["tema"] = $xbase; |
1204 | 1207 | $_GET["layers"] = ""; |
1205 | 1208 | $l = $m->getlayer(0); |
1206 | - $_GET["LAYERS"] = $l->name; | |
1207 | -} | |
1209 | + $_GET["LAYERS"] = $l->name; | |
1210 | +} | |
1208 | 1211 | function converteenc($texto){ |
1209 | - if (!mb_detect_encoding($texto,"UTF-8",true)){ | |
1212 | + if (!mb_detect_encoding($texto,"UTF-8",true)){ | |
1210 | 1213 | $texto = mb_convert_encoding($texto,"UTF-8","ISO-8859-1"); |
1211 | 1214 | } |
1212 | 1215 | return $texto; |
1213 | -} | |
1214 | -?> | |
1216 | +} | |
1217 | +?> | ... | ... |