-
Notifications
You must be signed in to change notification settings - Fork 0
/
geocoding.html
80 lines (73 loc) · 3.09 KB
/
geocoding.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
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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GeoAPI Exemple</title>
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/mfbase/ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/mfbase/ext/resources/css/xtheme-gray.css" />
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/geoadminApi/css/api.css" />
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/MapFishApi/css/api.css" />
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/css/geoadmin.css" />
<link rel="stylesheet" type="text/css" href="http://api.geoportail.lu/css/main.css" />
<script type="text/javascript" src="http://api.geoportail.lu/mfbase/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://api.geoportail.lu/mfbase/ext/ext-all.js"></script>
<script type="text/javascript" src="http://api.geoportail.lu/build/geoadmin.js?v=3"></script>
<script type="text/javascript" src="http://api.geoportail.lu/main.js"></script>
<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'/>
<script type="text/javascript">
Ext.onReady( function init() {
lux = new OpenLayers.Projection("EPSG:2169"); // the luxembourg coordinate reference system
wgs = new OpenLayers.Projection("EPSG:4326"); // the WGS84 coordinate reference system
lonLat = new OpenLayers.LonLat(6.12459923192738, 49.6188206257115 ).transform( wgs, lux );
geo = new geoadmin.API({lang: 'fr'});
var mapPanel = geo.createMapPanel({
mapInfo: {
zoom: 4,
easting: lonLat.lon,
northing: lonLat.lat,
bgLayer: 'webbasemap',
bgOpacity: 100
}
});
geo.searchUrl="http://api.geoportail.lu/locationsearch";
var toolbar = geo.createToolbar(["MapOpacity"]);
var mapWindow = Ext.apply(mapPanel, {tbar: toolbar});
var layerTree = geo.createLayerTree();
//--------------------------------------------------------------------------------------
// Method example
//--------------------------------------------------------------------------------------
geo.geocode({
num: "54",
street: "Avenue Gaston Diderich",
zip: "",
locality:"Luxembourg"
}, function(success,json) {
if (success){
geo.showMarker({
iconPath: 'http://apps.geoportail.lu/exemple_api/exemplesWikiGeoAPI/lion.png', //absolute url to image file
graphicHeight: 35,
graphicWidth: 35,
easting: json[0].easting,
northing: json[0].northing,
html: json[0].name,
title: "Quality of the geocoding: " + json[0].accuracy,
hover: true //display marker popup on mouseover
});
}
});
var panel = new Ext.Panel({
id: "geoAPIPanel",
layout: "border",
renderTo: "map",
height: 400,
width: 600,
items: [ Ext.apply(mapWindow,{region:
"center"})]
})
});
</script>
</body>
</html>