谷歌地图API PHP客户端-创建功能


Google Maps API PHP Client - create feature

我无法使用谷歌地图API PHP客户端创建功能。我不知道在哪里设置坐标。

我代码:

$tableID = "xxxx";
$postBody = new Google_Service_MapsEngine_FeaturesBatchInsertRequest();
$feature = new Google_Service_MapsEngine_Feature();
$feature->setType("Feature");
$geometry = new Google_Service_MapsEngine_GeoJsonGeometry();
$geometry->setType("Point");
$point = new Google_Service_MapsEngine_GeoJsonPoint();
$coordinates = "[86.9253,27.9881]"; 
$point->setCoordinates($coordinates);
$feature->setGeometry($geometry);
$properties =  array("gx_id" => "804940557", "mountain_name" => "Mt Everest", "height" => "8848");
$feature->setProperties($properties);
$postBody->setFeatures(array($feature));

$postBody->setFeatures(array($feature));
$service->tables_features->batchInsert($tableID, $postBody);

我不确定。在官方文档中有关于CURL和JSON的所有内容。但通过我在github上的快速分析,我猜是这样的:$feature->setGeometry(array("geometry" => array("type" => "Polygon","coordinates"=>"[86.9253,27.9881]")));

$feature->setGeometry(array("type" => "Polygon","coordinates"=>"[86.9253,27.9881]"));