0

グーグルフュージョンマップのテキストからマーカーへのリンクを作成しようとしています。もっと正確に言うと、地図を更新して、選択した場所を拡大したいのです。

写真がわかりやすくなります。http: //projeteurope.free.fr/ たとえば、ページの右側にある[Akrame]をクリックすると、マップはそのポイント(すでにフュージョンに存在している)にズームする必要があります。テーブル、19 Rue Lauriston、75016 Paris)

私はさまざまなトピックやウェブサイトを見てきましたが、その方法がわかりません(私はjavascriptの完全な初心者です) Fusion Table+Googleマップ またはhttp://alamatku.com/cari?query=UPS&area=ジャカルタ またはマップ付きGoogleフュージョンテーブル-テーブルフィールドをマップ情報ウィンドウにリンク

マーカーだけで新しいレイヤーを作成するのではなく、マップを特定の市場にズームしたいだけです。

手がかりがあればどうもありがとう!ロビン

4

1 に答える 1

0

GViz (Google ビジュアライゼーション ライブラリ)を使用して、フュージョン テーブルをクエリし、マップをマーカーでズームできます。

コード:

function changeQuery(term) {
  layer.setOptions({query:{select:'Latitude', /* was 'Latitude,Longitude', used to work... */
                           from:FT_TableID,
                           where:"Nom contains "+term
                           }

 });

  // zoom and center map on query results
  //set the query using the parameter
  var queryText = encodeURIComponent("SELECT 'Latitude', 'Longitude' FROM "+FT_TableID+" WHERE 'Nom' contains '"+term+"'");
  var query = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq='  + queryText);

  //set the callback function
  query.send(zoomTo);
}

function zoomTo(response) {
if (!response) {
  alert('no response');
  return;
}
if (response.isError()) {
  alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
  return;
} 
  FTresponse = response;
  //for more information on the response object, see the documentation
  //http://code.google.com/apis/visualization/documentation/reference.html#QueryResponse
  numRows = response.getDataTable().getNumberOfRows();
  numCols = response.getDataTable().getNumberOfColumns();

  var bounds = new google.maps.LatLngBounds();
  for(i = 0; i < numRows; i++) {
      var point = new google.maps.LatLng(
          parseFloat(response.getDataTable().getValue(i, 0)),
          parseFloat(response.getDataTable().getValue(i, 1)));
      bounds.extend(point);
  }
  // zoom to the bounds, if you have only one result, 
  // you may want to do a map.setCenter; map.setZoom to specify the behavior
  map.fitBounds(bounds);
}

例/概念実証

于 2013-01-26T18:51:20.693 に答える