简体   繁体   English

Google Fusion Table更改单个标记类型

[英]Google Fusion Table Change individual Marker Type

I have a simple question for someone who is familiar with Google Fusion Tables. 对于一个熟悉Google Fusion Tables的人,我有一个简单的问题。 Basically I want a user to be able to change a marker style on the map by indirectly altering the numerical column that corresponds to the markerstyle type. 基本上,我希望用户能够通过间接更改与markerstyle类型相对应的数字列来更改地图上的marker样式。

Specifically, I currently have a Fusion Table with approximately 7000 addresses and the corresponding map. 具体来说,我目前有一个Fusion Table,其中包含大约7000个地址和对应的地图。 I am wondering if there is anyway FROM THE MAP to change the marker type. 我想知道地图上是否还有要更改标记类型的信息。 Here is how I currently have it configured: I have a column in the fusion table that divides the marker types into 'buckets' that plot different marker types. 这是我当前的配置方式:融合表中有一列,将标记类型分为绘制不同标记类型的“存储桶”。 Right now they are all red circles, and as i visit each location I want to individually change the marker type (so in the table I would change the 1 (which corresponds to red) to a 3 (which corresponds to green)) so that I know which houses I visited. 现在它们都是红色圆圈,当我访问每个位置时,我想分别更改标记类型(因此在表格中,我会将1(对应于红色)更改为3(对应于绿色)),以便我知道我去过哪所房子。 But it isnt feasible for me to scroll down the fusion table of 7000 points and change the 1 to 3, so Im wondering if theres anyway I can change it on the map directly EITHER FROM A MAP ON A WEBPAGE OR ON THE FUSION TABLE MAP INSIDE GOOGLE. 但是对我来说,向下滚动7000点的融合表并将其更改为1到3是不可行的,所以我想知道是否无论如何我可以直接从网页上的地图或内部的融合表地图上将其更改为地图上的谷歌。

Thank you in advance, David 戴维,谢谢你

If you have a fusion table derived map on a page, you could add a button to an info window that updates a value in a the fusion table - so you could change the value from 1 to 3. Take it a bit further you could add a listener to the click on the map marker itself and change the value. 如果页面上有融合表派生的地图,则可以在信息窗口中添加一个按钮,以更新融合表中的值-因此您可以将值从1更改为3。再进一步,您可以添加监听者点击地图标记本身并更改其值。

Updating a value (especially if you are an owner of the table) is straightforward ( https://developers.google.com/fusiontables/docs/v1/using#updateRow or https://developers.google.com/fusiontables/docs/v1/sql-reference#updateRow ) and is basically a fairly standard form of sql manipulation using HTTP to invoke the request. 更新值(尤其是如果您是表的所有者)非常简单( https://developers.google.com/fusiontables/docs/v1/using#updateRowhttps://developers.google.com/fusiontables/docs / v1 / sql-reference#updateRow ),基本上是使用HTTP调用请求的SQL操作的一种相当标准的形式。

UPDATE <table_id>
SET <column_name> = <value> {, <column_name> = <value> }*
WHERE ROWID = <row_id>

Adding a listener to a marker to pup up an info window with an updating button is also straightforward: 向标记添加侦听器以使用更新按钮启动信息窗口也很简单:

https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple

// This example displays a marker at the center of Australia.
// When the user clicks the marker, an info window opens.

function initialize() {
  var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  var mapOptions = {
    zoom: 4,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };

  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

  var contentString = '<div id="content">'+
      '<div id="siteNotice">'+
      'button that call some ajax to fire off a column update' +
      '</div>';

  var infowindow = new google.maps.InfoWindow({
      content: contentString
  });

  var marker = new google.maps.Marker({
      position: myLatlng,
      map: map,
      title: 'Uluru (Ayers Rock)'
  });
  google.maps.event.addListener(marker, 'click', function() {
    infowindow.open(map,marker);
  });
}

google.maps.event.addDomListener(window, 'load', initialize);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM