【问题标题】:import a fusiontable using importTable() in google-api-php-client在 google-api-php-client 中使用 importTable() 导入 fusiontable
【发布时间】:2015-11-11 09:42:17
【问题描述】:

我想使用可在 GitHub https://github.com/google/google-api-php-client 上找到的 Google API PHP 客户端库以编程方式导入 Google Fusion Table。它包含一个服务类 Fusiontables.php,它有一个函数 importTable() 显然可以做我喜欢的事情。

/**
* Imports a new table. (table.importTable)
*
* @param string $name The name to be assigned to the new table.
* @param array $optParams Optional parameters.
*
* @opt_param string delimiter The delimiter used to separate cell values. This
* can only consist of a single character. Default is ,.
* @opt_param string encoding The encoding of the content. Default is UTF-8. Use
* auto-detect if you are unsure of the encoding.
* @return Google_Service_Fusiontables_Table
*/
public function importTable($name, $optParams = array())
{
  $params = array('name' => $name);
  $params = array_merge($params, $optParams);
  return $this->call('importTable', array($params), "Google_Service_Fusiontables_Table");
}

这个函数读起来很简单,虽然我不知道如何用实际数据来提供它,可能是从 CSV 文件中获取的。

我在这里Google PHP API Client & Fusion Tables: How to use importRows? 找到了关于另一个函数 importRows() 的迟到答案。它解释了使用 optParams 数组键“数据”将实际数据作为逗号分隔列表插入。 首先,函数的注释中没有描述所有使用的参数,那么哪里可以找到好的文档呢? 其次,我不清楚如何指定由多行组成的数据(因为函数名称以复数形式读取'rows')。

希望能找到有关此 Google API PHP 客户端库的专家。

【问题讨论】:

  • 感谢您指出我已经在我的问题中提到的一个问题,因为它不是重复的(importTable 与 importRows),另一个问题的答案对我来说不够清晰/完整。
  • 为什么这个标签是google-maps?好像和地图没什么关系。
  • 因为我将使用 Fusiontable 在 Google 地图中显示大量位置,而熟悉 Google 地图的开发人员肯定也有使用 Fusiontables 的经验。

标签: php google-maps google-api google-fusion-tables google-api-php-client


【解决方案1】:
  1. "Standard parameters" 的 PHP 函数在相关的PHP client function method 上没有详细说明。

  2. importRows 导入的数据的一般格式是 CSV。因此,要指定多行,输入 blob 中的行应由适当的换行符分隔。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-25
    • 1970-01-01
    • 2013-12-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多