-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple_kml.html
53 lines (51 loc) · 3.1 KB
/
simple_kml.html
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
<html>
<head>
<title>Exemple d'utilisation</title>
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/build/latest/ext-all.css" />
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/build/latest/xtheme-gray.css" />
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/build/latest/api.css" />
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/build/latest/MapFishApi_api.css" />
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/build/latest/geoadmin.css" />
<script type="text/javascript" src="http://api.geoportail.lu/build/latest/ext-base.js"></script>
<script type="text/javascript" src="http://api.geoportail.lu/build/latest/ext-all.js"></script>
<script type="text/javascript" src="http://api.geoportail.lu/build/latest/geoadmin.js"></script>
<script type="text/javascript" src="http://api.geoportail.lu/api.js"></script>o
<script type="text/javascript" src="http://api.geoportail.lu/mfbase/openlayers/lib/OpenLayers/Strategy.js"></script>
<script type="text/javascript" src="http://api.geoportail.lu/mfbase/openlayers/lib/OpenLayers/Strategy/Fixed.js"></script>
</head>
<body>
<div id='map' style="width:600px;height:400px"/>
<script type="text/javascript">
lux = new OpenLayers.Projection("EPSG:2169"); // the luxembourg coordinate reference system
wgs = new OpenLayers.Projection("EPSG:4326"); // the WGS84 coordinate reference system, as used widely
lonLat = new OpenLayers.LonLat(6.12459923192738, 49.6188206257115 ).transform( wgs, lux );
geo = new geoadmin.API({lang: 'fr'});
geo.createMap({
div: 'map',
easting: lonLat.lon,
northing: lonLat.lat,
zoom: 8,
bgLayer: 'pixelmaps'
});
var kmlTroncons = new OpenLayers.Layer.Vector("PC 15", {
projection: wgs,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "pc15.kml",
format: new OpenLayers.Format.KML({
extractStyles: false,
extractAttributes: false,
})
}),
styleMap: new OpenLayers.StyleMap({strokeWidth: 5, strokeColor: '#ee9900' })
});
kmlTroncons.bodid = kmlTroncons.id;
geo.map.addLayer(kmlTroncons);
kmlTroncons.events.on({
loadend: function(event) {
geo.map.zoomToExtent(this.getDataExtent())
}
})
</script>
</body>
<html>