允许使用 REST 创建和修改数据的位置服务 API

Location service which allows creating and modifying data with REST API

我想知道是否有 REST API 我可以在其中 create/update/delete 数据。例如,我想做的是通过 REST API 在地图上创建一个图钉或保存我在地图上找到的最喜欢的地方。

Google 地图以前有此功能,但从 post 开始已弃用:https://cloud.google.com/blog/products/maps-platform/announcing-deprecation-of-place-add

我正在浏览 Google 地图 API 并且看不到这个选项,我也检查了 HERE 地图 API 但它似乎没有提供这个。

有没有 API 我可以做到这一点,基本上是发送 POST/PUT/DELETE 请求来检查 maps/location 服务如何工作?

我发现 ArcGIS 提供了我需要的东西,我可以使用 REST API 在地图上 add/update/delete 个点(或他们所说的图层)。

以防其他人遇到同样的问题,这篇文章很好地解释了如何做到这一点:https://developers.arcgis.com/labs/rest/add-edit-and-remove-features/

您可以直接使用 Fleet Telematics Custom Locations REST api or you can use HERE maps for JavaScript API 与此 REST api 通信。

第二个选项是使用HERE studio,它非常容易使用。

这是一个简单的示例,说明如何使用 HERE 地图为 JavaScript API:

上传点几何图形(标记)
// assuming there is already H.Map (map) & H.service.Platform (platform) instance

const layerId = 'MY_LAYER';
const cleService = platform.getCustomLocationService();

// check if layer in fleet telematics custom location service exists.
// if yes, upload data. 
// If not create new layer, then upload data
cleService.getLayer(layerId, uploadData, createLayer);

/*
 * this method creates marker with random position and uploads it to the server
 */
function uploadData(table) {
  let row = table.addRow(),
      bearing = Math.random() * 360,
      distance = Math.random() * 3000,
      // marker with random position in radius 3km from map's center
      marker = new H.map.Marker(map.getCenter().walk(bearing, distance));

  // add marker to the map
  map.addObject(marker);

  row.setCell('NAME', 'Test name'); // optional
  row.setCell('WKT', marker.getGeometry()); // mandatory

  // push the marker's geometry to the fleet telematics custom location service
  cleService.appendRows([row], () => {console.log('O.K.')}, console.log);
}

/*
 * this method creates new layer in fleet telematics custom location service
 */
function createLayer() {
  // only WKT is mandatory column name
  let metaInfo = {
    layerId,
    columnNames: ['NAME', 'GEOMETRY_ID', 'WKT']
  };

  cleService.createLayer(metaInfo, uploadData, console.error);
}

这里是一个简单的示例,说明如何使用 JavaScript API:

的 HERE 地图在地图上显示上传的点几何形状
// assuming there is already H.Map (map) & H.service.Platform (platform) instance

const layerId = 'MY_LAYER';
const cleService = platform.getCustomLocationService();

// Create a tile layer:
cleLayer = cleService.createTileLayer({layerId}, {
  resultType: H.service.extension.TileProvider.ResultType.MARKER
});

// Add the tile layer to the map
map.addLayer(cleLayer); // uploaded geometries start to show from zoom 12