全球API自定义标记图标

Custom Marker Icon For Globe API

本文关键字:图标 自定义 API 全球      更新时间:2024-03-12

经过长时间的搜索,我发现没有设置标记图标的选项。我现在正试图用两种不同的类型来绘制我的标记。我需要通过使用两个单独的图标来清楚地可视化它,是否有任何选项可以在Globe中设置自定义标记图标。更快的回应将非常有帮助,因为我正处于最后期限的边缘。

我正在使用简单的Globe api

    var earth = new WE.map('earth_div');
      WE.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(earth);
    {% for last_place_marker in last_place_markers %}
    var marker = WE.marker([{{last_place_marker.destination_lat}}, {{last_place_marker.destination_longit}}]).addTo(earth);
    marker.bindPopup("<b>{{last_place_marker.destinaton}}</b><br>{{last_place_marker.when}}<br /><span style='font-size:10px;color:#999'>{{last_place_marker.description}}</span>", {maxWidth: 150, closeButton: true});
    //.openPopup()
    {% endfor %}
    {% for target_marker in target_markers %}
    {% if target_marker.target_destination_lat %}
        var marker = WE.marker([{{target_marker.target_destination_lat}}, {{target_marker.target_destination_longit}}]).addTo(earth);
        marker.bindPopup("<b>{{target_marker.target}}</b><br>{{target_marker.when}}<br /><span style='font-size:10px;color:#999'>{{target_marker.description}}</span>", {maxWidth: 150, closeButton: true});
        //.openPopup()
    {% endif %}
    {% endfor %}
    earth.setView([25, 79], 2.5);

Globe API是一个开源API,它不会提供自定义标记图标,打开谷歌地图将是更好的选择。

您可以更改CSS样式中的值。

<style>
    .we-pm-icon {
    background-image: url(http://madridhoy.info/imagejpg.php?url=http://campinadigital.me/wp-content/uploads/2020/06/160620-planas.jpg&rs=1)!important;
    }
</style>