douyuefei3546 2019-07-02 11:22
浏览 67
已采纳

使用PHP中的API更新ArcGIS Feature图层数据

I'm facing an issue with update data on the ArcGIS feature layer using API in PHP. Data is updating on the feature layer as expected, But data on the map is not representing. Every time when I'm pushing data to the Feature layer, Map is showing blank. But it's data section showing correct data.

Below is my code sample:-

<?php

$feature = [
    'geometry' => [
        'longitude' => $longitude,
        'latitude' => $latitude
    ],
    'attributes' => [
        'id'                                => (int) $item->id,
        'project_name'                      => (string) $item->project_name,
        'queue_position'                    => (string) $item->queue_position,
        'request_receive_date'              => $item->request_receive_date,
        'queue_date'                        => $item->queue_date,
        'application_status'                => (string) $item->application_status,
        'study_process'                     => (string) $item->study_process,
        'type_1'                            => (string) $item->type_1,
        'type_2'                            => (string) $item->type_2,
        'fuel_1'                            => (string) $item->fuel_1,
        'fuel_2'                            => (string) $item->fuel_2,
        'mw_1'                              => (string) $item->mw_1,
        'mw_2'                              => (string) $item->mw_2,
        'mw_total'                          => (string) $item->mw_total,
        'deliverability_status'             => (string) $item->deliverability_status,
        'county'                            => (string) $item->county,
        'state'                             => (string) $item->state,
        'utility'                           => (string) $item->utility,
        'substation_or_transmission_line'   => (string) $item->substation_or_transmission_line,
        'proposed_online_date'              => $item->proposed_online_date,
        'current_online_date'               => $item->current_online_date,
        'supplemental_review'               => (string) $item->supplemental_review,
        'phase_1_cluster_study'             => (string) $item->phase_1_cluster_study,
        'phase_2_cluster_study'             => (string) $item->phase_2_cluster_study,
        'optional_study'                    => (string) $item->optional_study,
        'agreement_status'                  => (string) $item->agreement_status,
        'latitude'                          => $latitude,
        'longitude'                         => $longitude
    ]
];

$formParams = [
    'token'                 => 'aUIIAqYYo3gx-5rgBGxLGBFOn_KOm9bbNe..',
    'features'              => json_encode([$feature]),
    'f'                     => 'json',
];

$url = "https://services9.arcgis.com/Azs8YqOMYfa7g8wo/arcgis/rest/services/test_layer/FeatureServer/0/addFeatures";

// I'm using guzzle.
$client = new Client();
$response = $client->post($url, ['form_params' => $formParams]);
$result = json_decode($response->getBody());

I'm getting success response:-

{
    "code": 200,
    "message": "Success",
    "data": {
        "addResults": [
            {
                "objectId": 32,
                "uniqueId": 32,
                "globalId": null,
                "success": true
            },
            ...
        ]
    }
}

And data is also updated in the Feature layer data section. But that updated data points are not reflecting on the map. It seems geometry is not correct.

  • 写回答

1条回答 默认 最新

  • dqzlqfqeh845799833 2019-07-04 09:43
    关注

    You need to correct geometry data. Here is the correct:-

    {
        "x" : $longitude, 
        "y" : $latitude, 
        "spatialReference" : {
            "wkid" : 4326
        }
    }
    

    you can read documentation from here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 STM32 INMP441无法读取数据
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥500 把面具戴到人脸上,请大家贡献智慧
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。
  • ¥15 各位 帮我看看如何写代码,打出来的图形要和如下图呈现的一样,急
  • ¥30 c#打开word开启修订并实时显示批注
  • ¥15 如何解决ldsc的这条报错/index error
  • ¥15 VS2022+WDK驱动开发环境