簡體   English   中英

Google Maps API PHP客戶端-創建功能

[英]Google Maps API PHP Client - create feature

我無法使用Google Maps 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]"));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM