【发布时间】: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