有什么方法可以在地图上添加我的自定义 POI?

Is there any way to add my custom POIs on maps?

我的数据库中有很多兴趣点,包括位置 属性。如何根据我在地图上的位置添加这些兴趣点?我发现 HERE SDK 有 api 和 'Explore Popular Places by Category',但这些类别是由 HERE 预定义的。我不认为我可以将我的 POI 添加到 HERE 并通过这些 API 进行搜索。

我知道一个解决方案,就是在地图上添加集群标记。但是如果我每次都在我的数据库中检索 POI,这既困难又昂贵。就像找到一个圆区域内(半径为 10 英里)内的所有 POI。对于在 HERE 地图上添加自定义 POI,您有更好的解决方案吗?

谢谢

您可能正在寻找 Custom Location Extension

您可以使用 HERE maps 添加带有自定义图像的自定义 POI(标记),代码如下:

初始化映射onButtonClick后,

SearchRequest searchRequest = new SearchRequest("Water");
searchRequest.execute(discoveryResultPageListener);

然后添加这个方法:

private ResultListener<DiscoveryResultPage> discoveryResultPageListener = new ResultListener<DiscoveryResultPage>() {
    @Override
    public void onCompleted(DiscoveryResultPage discoveryResultPage, ErrorCode errorCode) {

        if (errorCode == ErrorCode.NONE) {

            List<DiscoveryResult> s_ResultList = discoveryResultPage.getItems();
            for (DiscoveryResult item : s_ResultList) {
                /*
                 * Add a marker for each result of PlaceLink type.For best usability, map can be
                 * also adjusted to display all markers.This can be done by merging the bounding
                 * box of each result and then zoom the map to the merged one.
                 */
                if (item.getResultType() == DiscoveryResult.ResultType.PLACE) {
                    PlaceLink placeLink = (PlaceLink) item;
                    addMarkerAtPlace(placeLink);
                    Log.e("nameeee   ",""+placeLink.getTitle());
                }
            }
        } else {
            Toast.makeText(m_activity,
                    "ERROR:Discovery search request returned return error code+ " + errorCode,
                    Toast.LENGTH_SHORT).show();
        }
    }
};

在此之后添加自定义标记的方法,

private void addMarkerAtPlace(PlaceLink placeLink) {
    Image img = new Image();
    try {
        img.setImageResource(R.drawable.camping);

    } catch (Exception e) {
        e.printStackTrace();
    }

    MapMarker mapMarker = new MapMarker();
    mapMarker.setIcon(img);
    mapMarker.setTitle(placeLink.getTitle());
    mapMarker.setCoordinate(new GeoCoordinate(placeLink.getPosition()));
    m_map.addMapObject(mapMarker);
    m_map.setCenter(new GeoCoordinate(placeLink.getPosition()), Map.Animation.NONE);

    m_map.setZoomLevel(13);
    List<MapObject> m_mapObjectList = new ArrayList<>();
    m_mapObjectList.add(mapMarker);
}