Commit 9afefac0664274f28619f447e8f6b1b8148452d1
1 parent
8ae9b14a
Exists in
master
and in
1 other branch
Alteração nos parâmetros de geração de arquivos KML na ferramenta OGC
Showing
7 changed files
with
48 additions
and
24 deletions
Show diff stats
aplicmap/ogcwsv7.map
ms_configura.php
@@ -314,7 +314,7 @@ Variable: $ogrOutput | @@ -314,7 +314,7 @@ Variable: $ogrOutput | ||
314 | 314 | ||
315 | Indica se o OGR esta corretamente instalado, permitindo o seu uso nos servicos OGC de exportacao de dados | 315 | Indica se o OGR esta corretamente instalado, permitindo o seu uso nos servicos OGC de exportacao de dados |
316 | */ | 316 | */ |
317 | -$ogrOutput = true; | 317 | +$ogrOutput = false; |
318 | /* | 318 | /* |
319 | Variable: saikuUrl | 319 | Variable: saikuUrl |
320 | 320 |
ogc.php
@@ -262,11 +262,11 @@ ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo | @@ -262,11 +262,11 @@ ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo | ||
262 | 262 | ||
263 | "; | 263 | "; |
264 | exit; | 264 | exit; |
265 | -} | ||
266 | - | 265 | +} |
267 | include(dirname(__FILE__)."/classesphp/sani_request.php"); | 266 | include(dirname(__FILE__)."/classesphp/sani_request.php"); |
268 | include_once (dirname(__FILE__)."/classesphp/carrega_ext.php"); | 267 | include_once (dirname(__FILE__)."/classesphp/carrega_ext.php"); |
269 | include(dirname(__FILE__)."/ms_configura.php"); | 268 | include(dirname(__FILE__)."/ms_configura.php"); |
269 | +error_reporting(0); | ||
270 | $_GET = array_merge($_GET,$_POST); | 270 | $_GET = array_merge($_GET,$_POST); |
271 | //error_log($_SERVER['QUERY_STRING']); | 271 | //error_log($_SERVER['QUERY_STRING']); |
272 | if(isset($_GET["BBOX"])){ | 272 | if(isset($_GET["BBOX"])){ |
@@ -417,6 +417,9 @@ if(strpos(strtolower($OUTPUTFORMAT),"kml") !== false){ | @@ -417,6 +417,9 @@ if(strpos(strtolower($OUTPUTFORMAT),"kml") !== false){ | ||
417 | if(strpos(strtolower($OUTPUTFORMAT),"kmz") !== false){ | 417 | if(strpos(strtolower($OUTPUTFORMAT),"kmz") !== false){ |
418 | $OUTPUTFORMAT = "kmz"; | 418 | $OUTPUTFORMAT = "kmz"; |
419 | } | 419 | } |
420 | +if(strpos(strtolower($OUTPUTFORMAT),"kmlwms") !== false){ | ||
421 | + $OUTPUTFORMAT = "kmlwms"; | ||
422 | +} | ||
420 | // | 423 | // |
421 | //verifica o OUTPUTFORMAT e o cache de arquivo | 424 | //verifica o OUTPUTFORMAT e o cache de arquivo |
422 | // | 425 | // |
@@ -428,16 +431,21 @@ if(!empty($OUTPUTFORMAT)){ | @@ -428,16 +431,21 @@ if(!empty($OUTPUTFORMAT)){ | ||
428 | //para o caso da requisicao kmz | 431 | //para o caso da requisicao kmz |
429 | //kmz nao funciona diretamente com mapserver | 432 | //kmz nao funciona diretamente com mapserver |
430 | // | 433 | // |
431 | -if(strtolower($OUTPUTFORMAT) == "kmz"){ | 434 | +if(strtolower($OUTPUTFORMAT) == "kmz" && $ogrOutput == false){ |
432 | $urln = "pacotes/kmlmapserver/kmlservice.php?request=kmz&map=".$tema."&typename=".$tema; | 435 | $urln = "pacotes/kmlmapserver/kmlservice.php?request=kmz&map=".$tema."&typename=".$tema; |
433 | header("Location:".$urln); | 436 | header("Location:".$urln); |
434 | exit; | 437 | exit; |
435 | } | 438 | } |
436 | if(strtolower($OUTPUTFORMAT) == "kml" && $ogrOutput == false){ | 439 | if(strtolower($OUTPUTFORMAT) == "kml" && $ogrOutput == false){ |
437 | - $urln = "pacotes/kmlmapserver/kmlservice.php?request=kmz&map=".$tema."&typename=".$tema; | 440 | + $urln = "pacotes/kmlmapserver/kmlservice.php?request=kml&map=".$tema."&typename=".$tema; |
438 | header("Location:".$urln); | 441 | header("Location:".$urln); |
439 | exit; | 442 | exit; |
440 | } | 443 | } |
444 | +if(strtolower($OUTPUTFORMAT) == "kmlwms"){ | ||
445 | + $urln = "pacotes/kmlmapserver/kmlservice.php?request=kmlwms&map=".$tema."&typename=".$tema; | ||
446 | + header("Location:".$urln); | ||
447 | + exit; | ||
448 | +} | ||
441 | if(strtolower($OUTPUTFORMAT) == "shape-zip" && $ogrOutput == false){ | 449 | if(strtolower($OUTPUTFORMAT) == "shape-zip" && $ogrOutput == false){ |
442 | $retorno = downloadTema2("",$tema,$locaplic,$dir_tmp,$postgis_mapa); | 450 | $retorno = downloadTema2("",$tema,$locaplic,$dir_tmp,$postgis_mapa); |
443 | $zip = $retorno["shape-zip"]; | 451 | $zip = $retorno["shape-zip"]; |
@@ -1543,6 +1551,14 @@ function processaOutputformatMapfile(){ | @@ -1543,6 +1551,14 @@ function processaOutputformatMapfile(){ | ||
1543 | $oMap->outputformat->setOption("FILENAME", $tema.".kml"); | 1551 | $oMap->outputformat->setOption("FILENAME", $tema.".kml"); |
1544 | $l->setmetadata("wfs_getfeature_formatlist","kml"); | 1552 | $l->setmetadata("wfs_getfeature_formatlist","kml"); |
1545 | } | 1553 | } |
1554 | + if(strtolower($OUTPUTFORMAT) == "kmz"){ | ||
1555 | + $l = $oMap->getlayer(0); | ||
1556 | + $n = $l->name; | ||
1557 | + $oMap->selectOutputFormat("kmz"); | ||
1558 | + $oMap->outputformat->setOption("STORAGE", "filesystem"); | ||
1559 | + $oMap->outputformat->setOption("FILENAME", $tema.".kmz"); | ||
1560 | + $l->setmetadata("wfs_getfeature_formatlist","kmz"); | ||
1561 | + } | ||
1546 | if(strtolower($OUTPUTFORMAT) == "shape-zip"){ | 1562 | if(strtolower($OUTPUTFORMAT) == "shape-zip"){ |
1547 | $l = $oMap->getlayer(0); | 1563 | $l = $oMap->getlayer(0); |
1548 | $n = $l->name; | 1564 | $n = $l->name; |
ogc/dicionario.js
@@ -52,14 +52,19 @@ ogc.dicionario = | @@ -52,14 +52,19 @@ ogc.dicionario = | ||
52 | es : "Descargar CSV a través de WFS pero sin geometría" | 52 | es : "Descargar CSV a través de WFS pero sin geometría" |
53 | }], | 53 | }], |
54 | "kmz" : [{ | 54 | "kmz" : [{ |
55 | - pt : "Download KMZ", | 55 | + pt : "Download KMZ (KML vetorial compactado)", |
56 | en : "Download KMZ", | 56 | en : "Download KMZ", |
57 | es : "Descargar KMZ" | 57 | es : "Descargar KMZ" |
58 | }], | 58 | }], |
59 | + "kmlwms" : [{ | ||
60 | + pt : "Download KML (com WMS embutido)", | ||
61 | + en : "", | ||
62 | + es : "" | ||
63 | + }], | ||
59 | "kml" : [{ | 64 | "kml" : [{ |
60 | - pt : "Download KML", | ||
61 | - en : "Download KML", | ||
62 | - es : "Descargar KML" | 65 | + pt : "Download KML (vetorial)", |
66 | + en : "", | ||
67 | + es : "" | ||
63 | }], | 68 | }], |
64 | "explore" : [{ | 69 | "explore" : [{ |
65 | pt : "Explore a tabela de atributos", | 70 | pt : "Explore a tabela de atributos", |
ogc/templates/templatelinksdownload.php
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=csv&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}&ows_geomtype=AS_WKT" >{{{downCgeo}}}</a> | 7 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=csv&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}&ows_geomtype=AS_WKT" >{{{downCgeo}}}</a> |
8 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=csv&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}&ows_geomtype=none" >{{{downSgeo}}}</a> | 8 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=csv&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}&ows_geomtype=none" >{{{downSgeo}}}</a> |
9 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=kmz&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{kmz}}}</a> | 9 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=kmz&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{kmz}}}</a> |
10 | +<p><a target=blank href="{{{servico}}}OUTPUTFORMAT=kmlwms&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{kmlwms}}}</a> | ||
10 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=kml&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{kml}}}</a> | 11 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=kml&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{kml}}}</a> |
11 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=geojson&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >GeoJson</a> | 12 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=geojson&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >GeoJson</a> |
12 | <p><a target=blank href="{{{urli3geo}}}/ferramentas/recline/default.php?tema={{{tema}}}" >{{{explore}}}</a> | 13 | <p><a target=blank href="{{{urli3geo}}}/ferramentas/recline/default.php?tema={{{tema}}}" >{{{explore}}}</a> |
pacotes/kmlmapserver/classes/kmlserver.class.php
@@ -70,6 +70,7 @@ class KmlServer { | @@ -70,6 +70,7 @@ class KmlServer { | ||
70 | $this->service->run(); | 70 | $this->service->run(); |
71 | } else { | 71 | } else { |
72 | include 'layerserver.class.php'; | 72 | include 'layerserver.class.php'; |
73 | + error_reporting(0); | ||
73 | $this->service = new LayerServer(); | 74 | $this->service = new LayerServer(); |
74 | $this->service->run(); | 75 | $this->service->run(); |
75 | } | 76 | } |
@@ -81,7 +82,10 @@ class KmlServer { | @@ -81,7 +82,10 @@ class KmlServer { | ||
81 | function get_request(){ | 82 | function get_request(){ |
82 | $this->service = $this->load_parm('service'); | 83 | $this->service = $this->load_parm('service'); |
83 | if(!$this->service){ | 84 | if(!$this->service){ |
84 | - $this->service= 'kml'; | 85 | + $this->service= $this->load_parm('request'); |
86 | + } | ||
87 | + if(!$this->service){ | ||
88 | + $this->service= "kml"; | ||
85 | } | 89 | } |
86 | } | 90 | } |
87 | 91 |
pacotes/kmlmapserver/classes/layerserver.class.php
@@ -153,7 +153,7 @@ class LayerServer | @@ -153,7 +153,7 @@ class LayerServer | ||
153 | * wether folder should contain networklinks instead of real geometries | 153 | * wether folder should contain networklinks instead of real geometries |
154 | * it is automatically set when all layers are requested | 154 | * it is automatically set when all layers are requested |
155 | */ | 155 | */ |
156 | - var $_networklink; | 156 | + var $_networklink = false; |
157 | var $postgis_mapa; | 157 | var $postgis_mapa; |
158 | 158 | ||
159 | /** | 159 | /** |
@@ -191,8 +191,6 @@ class LayerServer | @@ -191,8 +191,6 @@ class LayerServer | ||
191 | if (! $this->typename) { | 191 | if (! $this->typename) { |
192 | $this->_networklink = true; | 192 | $this->_networklink = true; |
193 | $this->typename = $this->get_layer_list(); | 193 | $this->typename = $this->get_layer_list(); |
194 | - } else { | ||
195 | - $this->_networklink = false; | ||
196 | } | 194 | } |
197 | if ($this->_networklink == false) { | 195 | if ($this->_networklink == false) { |
198 | // desliga todos os layers | 196 | // desliga todos os layers |
@@ -276,6 +274,11 @@ class LayerServer | @@ -276,6 +274,11 @@ class LayerServer | ||
276 | $this->request = $this->load_parm('request', 'kml'); | 274 | $this->request = $this->load_parm('request', 'kml'); |
277 | if ($this->request == 'kmz') { | 275 | if ($this->request == 'kmz') { |
278 | $this->_zipped = true; | 276 | $this->_zipped = true; |
277 | + } else { | ||
278 | + $this->_zipped = false; | ||
279 | + } | ||
280 | + if($this->request == "kmlwms"){ | ||
281 | + $this->_networklink = true; | ||
279 | } | 282 | } |
280 | if (! $this->map) { | 283 | if (! $this->map) { |
281 | $this->set_error('No mapfile specified'); | 284 | $this->set_error('No mapfile specified'); |
@@ -325,7 +328,6 @@ class LayerServer | @@ -325,7 +328,6 @@ class LayerServer | ||
325 | } | 328 | } |
326 | } else { | 329 | } else { |
327 | foreach ($layers as $layer) { | 330 | foreach ($layers as $layer) { |
328 | - // echo "Oi";exit; | ||
329 | $this->process_layer_request($layer); | 331 | $this->process_layer_request($layer); |
330 | } | 332 | } |
331 | } | 333 | } |
@@ -684,6 +686,9 @@ class LayerServer | @@ -684,6 +686,9 @@ class LayerServer | ||
684 | { | 686 | { |
685 | $ml = $element->addChild('MultiGeometry'); | 687 | $ml = $element->addChild('MultiGeometry'); |
686 | foreach (split('\), \(', $wkt) as $line) { | 688 | foreach (split('\), \(', $wkt) as $line) { |
689 | + //$line = str_replace("MULTIPOLYGON (","POLYGON ",$line).")"; | ||
690 | + $line = str_replace(array("MULTIPOLYGON",")","("),"",$line); | ||
691 | + //$line = "POLYGON ((".$line."))"; | ||
687 | $this->add_polygon($line, $ml, $featurename); | 692 | $this->add_polygon($line, $ml, $featurename); |
688 | } | 693 | } |
689 | } | 694 | } |
@@ -1107,7 +1112,7 @@ class LayerServer | @@ -1107,7 +1112,7 @@ class LayerServer | ||
1107 | for ($i = 0; $i < ($maptemp->numlayers); $i ++) { | 1112 | for ($i = 0; $i < ($maptemp->numlayers); $i ++) { |
1108 | $l = $maptemp->getlayer($i); | 1113 | $l = $maptemp->getlayer($i); |
1109 | $l->set("status", MS_DEFAULT); | 1114 | $l->set("status", MS_DEFAULT); |
1110 | - if (! $this->_zipped) { | 1115 | + if ($this->_networklink == true || $l->type == MS_LAYER_RASTER ) { |
1111 | $l->set("type", MS_LAYER_RASTER); | 1116 | $l->set("type", MS_LAYER_RASTER); |
1112 | $l->setmetadata('wms_onlineresource', "../../ogc.php?tema=" . $temp . "&width=1500&height=1500&TRANSPARENT=true&FORMAT=image/png&"); | 1117 | $l->setmetadata('wms_onlineresource', "../../ogc.php?tema=" . $temp . "&width=1500&height=1500&TRANSPARENT=true&FORMAT=image/png&"); |
1113 | $l->setmetadata("ows_enable_request", "*"); | 1118 | $l->setmetadata("ows_enable_request", "*"); |
@@ -1116,11 +1121,7 @@ class LayerServer | @@ -1116,11 +1121,7 @@ class LayerServer | ||
1116 | } | 1121 | } |
1117 | } else { | 1122 | } else { |
1118 | $this->map_object = ms_newMapObj($this->map); | 1123 | $this->map_object = ms_newMapObj($this->map); |
1119 | - // $w = $this->map_object->web; | ||
1120 | - // $w->set("template","none.htm"); | ||
1121 | - | ||
1122 | if (! $this->_zipped) { | 1124 | if (! $this->_zipped) { |
1123 | - // $this->map_object->setmetadata('wms_onlineresource',$servidor.":80".$locmapserv."?map=".$temp."&width=1500&height=1500&"); | ||
1124 | $this->map_object->setmetadata('wms_onlineresource', "../../ogc.php?tema=" . $temp . "&width=1500&height=1500&TRANSPARENT=true&FORMAT=image/png&"); | 1125 | $this->map_object->setmetadata('wms_onlineresource', "../../ogc.php?tema=" . $temp . "&width=1500&height=1500&TRANSPARENT=true&FORMAT=image/png&"); |
1125 | $this->map_object->setmetadata("ows_enable_request", "*"); | 1126 | $this->map_object->setmetadata("ows_enable_request", "*"); |
1126 | } | 1127 | } |
@@ -1128,10 +1129,6 @@ class LayerServer | @@ -1128,10 +1129,6 @@ class LayerServer | ||
1128 | for ($i = 0; $i < $n; $i ++) { | 1129 | for ($i = 0; $i < $n; $i ++) { |
1129 | $l = $this->map_object->getlayer($i); | 1130 | $l = $this->map_object->getlayer($i); |
1130 | $l->set("status", MS_DEFAULT); | 1131 | $l->set("status", MS_DEFAULT); |
1131 | - if (! $this->_zipped) | ||
1132 | - $l->set("type", MS_LAYER_RASTER); | ||
1133 | - // $l->setmetadata('wms_onlineresource',"../../ogc.php?tema=".$temp."&width=500&height=500&"); | ||
1134 | - // ms_newLayerObj($this->map_object, $l); | ||
1135 | } | 1132 | } |
1136 | } | 1133 | } |
1137 | if (! $this->map_object) { | 1134 | if (! $this->map_object) { |
@@ -1181,7 +1178,7 @@ class LayerServer | @@ -1181,7 +1178,7 @@ class LayerServer | ||
1181 | */ | 1178 | */ |
1182 | function send_header() | 1179 | function send_header() |
1183 | { | 1180 | { |
1184 | - header('Content-Disposition: attachment; filename=kml.km' . ($this->_zipped ? 'z' : 'l')); | 1181 | + header('Content-Disposition: attachment; filename='.$this->typename."_".$this->request .'.km' . ($this->_zipped ? 'z' : 'l')); |
1185 | header('Content-type: application/vnd.google-earth.km' . ($this->_zipped ? 'z' : 'l') . '+XML'); | 1182 | header('Content-type: application/vnd.google-earth.km' . ($this->_zipped ? 'z' : 'l') . '+XML'); |
1186 | } | 1183 | } |
1187 | 1184 |