Bonjour,
J'ai récupéré sur le site de référence de Google sur les API Javascript, ce petit exemple ci-dessous que j'ai modifié :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
 
<html>
 
 
  <head>
    <title>Place searches</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
 
    <!-- <link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet"> -->
    <link href="http://code.google.com//apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css">
 
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true&libraries=places,geometry"></script>
 
    <script>
 
		var map;
		var infowindow;
		var infowindow2;
 
		// Create an object containing LatLng, population.
		var citymap;	
		var cityCircle;
		var populationOptions;
 
		var linePath;
		var lineCoordinates;
 
		function initialize() {
		  // var pyrmont = new google.maps.LatLng(-33.8665433, 151.1956316);
		  var paris = new google.maps.LatLng(48.8566140, 2.3522219);
 
		  map = new google.maps.Map(document.getElementById('map-canvas'), {
		    mapTypeId: google.maps.MapTypeId.ROADMAP,
		    center: paris,
		    zoom: 15
		  });
 
		  // Drawing circle on map
		  citymap = {center: new google.maps.LatLng(48.8566140, 2.3522219)};
 
		  // fillOpacity   : 0.35,
		  populationOptions = {
			  					strokeColor   : '#FF0000',
			  					strokeOpacity : 0.8,
			  					strokeWeight  : 2,
			  					fillColor     : '#FF0000',
			  					fillOpacity   : 0,
			  					map           : map,
			  					center        : citymap.center,
			  					radius        : 500
							  };
          cityCircle = new google.maps.Circle(populationOptions);
 
		  var request = {
		    location: paris,
		    radius: 500,
		    types: ['train_station']
		  };
 
		  var placeLoc2 = new google.maps.LatLng(48.8566140, 2.3522219);
		  var marker2 = new google.maps.Marker({
		    map      : map,
		    position : placeLoc2,
		    icon     : 'http://maps.google.com/mapfiles/ms/icons/blue-dot.png'
		  });
		  // var infowindow2;
		  infowindow2 = new google.maps.InfoWindow();	  
		  // infowindow2.setContent("Paris");
		  // infowindow2.open(map, marker2);
 
		  google.maps.event.addListener(marker2, 'click', function() {
			    infowindow.close();
			    infowindow2.setContent("Paris - Centre");
			    infowindow2.open(map, marker2);
			  });
 
		  infowindow = new google.maps.InfoWindow();
		  var service = new google.maps.places.PlacesService(map);
		  service.nearbySearch(request, callback);
		}
 
		function callback(results, status) {
		  if (status == google.maps.places.PlacesServiceStatus.OK) {
			// alert("results length : " + results.length);
			// var startlocation = new google.maps.LatLng(48.8566140, 2.3522219);
		    for (var i = 0; i < results.length; i++) {
		      createMarker(results[i]);
		      // var endlocation   = results[i].geometry.location;
		      // var distance = google.maps.geometry.spherical.computeDistanceBetween (startlocation, endlocation);
		      // alert("results " + i + " name : " + results[i].name + " - distance : " + distance);
 
		      // Drawing lines on map
		      var startline = new google.maps.LatLng(48.8566140, 2.3522219);
		      var endline   = results[i].geometry.location;
		      lineCoordinates = [startline, endline];
		      linePath = new google.maps.Polyline({
											    	    path          : lineCoordinates,
											    	    strokeColor   : '#FF0000',
											    	    strokeOpacity : 1.0,
											    	    strokeWeight  : 2,
											    	    map           : map
		    	  									});
		    }
		  }
		}
 
		function createMarker(place) {
		  var placeLoc = place.geometry.location;
		  var marker = new google.maps.Marker({
		    map: map,
		    position: place.geometry.location
		  });
 
		  var startlocation = new google.maps.LatLng(48.8566140, 2.3522219);
		  var endlocation   = place.geometry.location;
		  var distance = google.maps.geometry.spherical.computeDistanceBetween (startlocation, endlocation);
 
		  google.maps.event.addListener(marker, 'click', function() {
			infowindow2.close();
		    infowindow.setContent(place.name + '<BR>' + 'Distance to Paris - Centre : ' + Math.round(distance));
		    infowindow.open(map, this);
		  });
		}
 
		google.maps.event.addDomListener(window, 'load', initialize);
 
    </script>
 
  </head>
 
  <body>
 
    <div id="map-canvas" style="width: 50%; float:left"></div>
 
    <div style="width:46%; float:left">
 
      <pre>
		var request = {
		  location: new google.maps.LatLng(48.8566140, 2.3522219),
		  radius: 500,
		  types: ['train_station']
		};
      </pre>
    </div>
 
  </body>
 
</html>
Cet exemple fonctionne très bien, et je sollicite votre aide pour transformer cet exemple mais en utilisant les API JAVA de Google Maps.

Est-ce possible ? Si oui, comment faire ?

Je vous remercie par avance pour vos réponses.

ejazz75