1 |
<?php |
2 |
// $Id: cadastre.php,v 1.1 2010-08-22 21:50:44 fraynaud Exp $ |
3 |
if (file_exists ("../dyn/session.inc")) |
4 |
include ("../dyn/session.inc"); |
5 |
if (file_exists ("../dyn/var.inc")) |
6 |
include ("../dyn/var.inc"); |
7 |
if (file_exists ("var.inc")) |
8 |
include ("var.inc"); |
9 |
if (file_exists ("../obj/utils.class.php")) |
10 |
include ("../obj/utils.class.php"); |
11 |
echo "<html xmlns='http://www.w3.org/1999/xhtml'>"; |
12 |
$f = new utils (); |
13 |
$DEBUG=1; |
14 |
$fichier_map="cadastre.map"; |
15 |
$titre= "Cadastre"; |
16 |
$texte=" affichage des sections"; |
17 |
$class_map="bigmap";// smallmap |
18 |
// extent |
19 |
$projection = $f-> db -> getOne("select srid from geometry_columns where f_table_name='section'"); |
20 |
$sql ="select xmin(extent(geom))as xmin,ymin(extent(geom)) as ymin,xmax(extent(geom)) as xmax,ymax(extent(geom)) as ymax from section"; |
21 |
$res = $f -> db -> query($sql); |
22 |
if (DB :: isError($res)){ |
23 |
die($res->getMessage()."erreur ".$sql); |
24 |
}else{ |
25 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
26 |
$x1= $row['xmin']." "; |
27 |
$y1= $row['ymin']." "; |
28 |
$x2= $row['xmax']." "; |
29 |
$y2= $row['ymax']." "; |
30 |
}// while |
31 |
}// pas d erreur |
32 |
if ($DEBUG ==1) |
33 |
echo "extent : ".$x1." ".$y1." ".$x2." ".$y2." proj : ".$projection; |
34 |
?> |
35 |
<script type="text/javascript"> |
36 |
var map = null; |
37 |
function init(){ |
38 |
var mapOptions = { |
39 |
maxExtent: new OpenLayers.Bounds(<?php echo $x1;?>, <?php echo $y1;?>,<?php echo $x2;?>, <?php echo $y2;?>), |
40 |
projection: new OpenLayers.Projection("EPSG:<?php echo $projection;?>"), |
41 |
displayProjection: new OpenLayers.Projection("EPSG:<?php echo $projection;?>"), |
42 |
tileSize: new OpenLayers.Size(1024,512), |
43 |
units: "m" |
44 |
}; |
45 |
map = new OpenLayers.Map('map',mapOptions); |
46 |
// attention ne pas nommer un layer comme une map (exemple cimetiere) |
47 |
var wms0 = new OpenLayers.Layer.WMS( "section", |
48 |
"<?php echo $path_map.$fichier_map;?>", |
49 |
{layers: 'section', format: 'image/png'}, {isBaseLayer: true} ); |
50 |
var wms1 = new OpenLayers.Layer.WMS( "parcelle", |
51 |
"<?php echo $path_map.$fichier_map;?>", |
52 |
{layers: 'parcelle', format: 'image/png'}, {isBaseLayer: false} ); |
53 |
var wms2 = new OpenLayers.Layer.WMS( "batiment", |
54 |
"<?php echo $path_map.$fichier_map;?>", |
55 |
{layers: 'batiment', format: 'image/png'}, {isBaseLayer: false} ); |
56 |
|
57 |
map.addLayers([wms0,wms1,wms2]); |
58 |
map.addControl(new OpenLayers.Control.LayerSwitcher()); // affichage de couches |
59 |
map.zoomToMaxExtent(); |
60 |
} |
61 |
</script> |
62 |
<?php |
63 |
echo "\n<head>"; |
64 |
echo "\n\t<title>".$titre."</title>"; |
65 |
echo "\n\t<link rel='stylesheet' href='../php/openlayers/theme/default/style.css' type='text/css' />"; |
66 |
echo "\n\t<link rel='stylesheet' href='style.css' type='text/css' />"; |
67 |
echo "\n\t<script src='../php/openlayers/lib/OpenLayers.js'></script>"; |
68 |
echo "\n</head>"; |
69 |
echo "\n<body onload='init()'>"; |
70 |
|
71 |
echo "\n\t<h1 id='title'>".$titre."</h1>"; |
72 |
echo "\n\t<div id='tags'></div>"; |
73 |
echo "\n\t<p id='shortdesc'>"; |
74 |
echo $texte; |
75 |
echo "\n\t</p>"; |
76 |
echo "\n\t<div id='map' class='".$class_map."'></div>"; |
77 |
echo "\n\t<div id='docs'></div>"; |
78 |
echo "\n</body>"; |
79 |
echo "\n</html>"; |
80 |
?> |