私の会社のウェブサイトで私はGoogleマップAPIを使用しています。私の問題は、テキスト検索を行うと、Googleマップと全く同じように表示されないということです。GoogleマップのようなGoogle Maps APIの結果を表示します。テキスト検索
What i have in my Google map api
だから、最初の画面に私のマーカーが正しいですが、アイコンと、同社は「キャップです: は、ここで私はAPIから何を得るのスクリーンショットと期待される結果の一つであります同じ建物内の会社、エンファント(Enfant)。 もう1つは、まさに私が達成したいことです...
Google place APIを使用しました。だから、Googleマップのテキスト検索で私に正しい結果が得られたので、私はTextsearch APIを使用しようとしましたが、私はGoogle place APIと同じ結果を持っています。 textsearchを使って私の会社を見つけました(私は私の会社だけを見つけるために小さな半径を設定しましたが、この大丈夫です)、アイコンは良くありません。
注:私は位置にズームすると、Googleマップ上で、キャップランファンは、私の会社(LTTDコンサルティング)が表示されず、...
だから私の質問は:私のAPIで表示するそこに方法は同じですGoogleマップのテキスト検索のように?あなたの助けのための
var map;
function initMap() {
var lttd = new google.maps.LatLng(48.9359628, 2.3051106);
map = new google.maps.Map(document.getElementById('siegeMap'), {
zoom: 17
});
var request = {
location: lttd,
radius: 500,
query: 'Consultant'
};
service = new google.maps.places.PlacesService(map);
var infowindow = new google.maps.InfoWindow();
service.textSearch(request, callback);
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
var max_iteration = (results.length < 2) ? results.length : 2;
var resultCount = 0;
for (var i = 0; i < results.length; i++) {
if (google.maps.geometry.spherical.computeDistanceBetween(results[i].geometry.location, lttd) < request.radius) {
console.log(results[i]);
var request2 = {
placeId: results[i].place_id
};
service = new google.maps.places.PlacesService(map);
service.getDetails(request2, detailCallback);
resultCount++;
}
}
map.panTo(results[0].geometry.location);
}
}
}
function detailCallback(place, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
var marker = new google.maps.Marker({
map: map,
title: 'LTTD Consulting',
types : ['Consultant'] | ['Consultant informatique'] |['informatique'],
position: place.geometry.location,
name:place.name
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(place.name);
infowindow.open(map, this);
});
}
}
ありがとう:
は、ここに私のコードです!