openlayers.php
2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
include (dirname(__FILE__)."/../../classesphp/sani_request.php");
include("../../ms_configura.php");
include("../blacklist.php");
verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false);
$g_sid = $_GET["g_sid"];
session_name("i3GeoPHP");
session_id($g_sid);
session_start();
$fingerprint = $_SESSION["fingerprint"];
$f = explode(",",$fingerprint);
if($f[0] != md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id())){
echo "erro";
return;
}
include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php");
$map_file = $_SESSION["map_file"];
if(empty($map_file)){
exit;
}
$map_file = str_replace(".map","",$map_file).".map";
restauraCon($map_file,$_SESSION["postgis_mapa"]);
$base = basename($map_file);
$dir = dirname($map_file);
$novo_mapfile = $dir."/".nomeRandomico(5).$base;
copy($map_file,$novo_mapfile);
chmod($novo_mapfile,0744);
$mapa = ms_newMapObj($novo_mapfile);
$mapa->setProjection(pegaProjecaoDefault("proj4"));
$numlayers = $mapa->numlayers;
$layers = array();
for($i = 0;$i < $numlayers;++$i){
$l = $mapa->getLayer($i);
$l->setmetadata("permiteogc","sim");
if($l->status != MS_DEFAULT){
$l->set("status",MS_DELETE);
}
else{
$layers[] = $l->name;
}
}
//$legenda = $mapa->legend;
//$legenda->set("status",MS_EMBED);
$mapa->save($novo_mapfile);
$layers = implode(",",$layers);
$mapext = str_replace(" ",",",$_GET["ext"]);
$urllayer = "../../ogc.php?tema=".$novo_mapfile;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="../../pacotes/openlayers/OpenLayers2131.js.php"></script>
<style>
.yui-skin-sam .container-minimiza {
background:transparent url(../../pacotes/yui290/build/assets/skins/sam/sprite.png) no-repeat scroll 0 -450px;
cursor:pointer;
height:15px;
position:absolute;
right:30px;
top:1px;
width:25px;
z-index:2001;
opacity:.8;
filter:alpha(opacity=80);
}
</style>
</head>
<body style="background-color:white">
<div id=mapa style="width:470px;height: 330px"></div>
<script>
mapext = new OpenLayers.Bounds(<?php echo $mapext; ?>);
opcoes = {
gutter:0,
isBaseLayer:true,
displayInLayerSwitcher:false,
opacity: 1,
visibility:true,
singleTile:true,
numZoomLevels: 12,
maxExtent: new OpenLayers.Bounds(-180,-90,180,90),
displayOutsideMaxExtent:true
};
controles = [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.MousePosition({'separator':' '}),
new OpenLayers.Control.ScaleLine()
];
OpenLayers.ImgPath = "../../pacotes/openlayers/img/";
mapa = new OpenLayers.Map('mapa',{controls:[]});
layer = new OpenLayers.Layer.WMS(
"",
"<?php echo $urllayer; ?>",{
LAYERS:"<?php echo $layers;?>"
},
opcoes
);
mapa.addLayer(layer);
mapa.zoomToExtent(mapext);
ncontroles = controles.length;
for(i=0;i<ncontroles;i++){
mapa.addControl(controles[i]);
}
</script>
</body>