【问题标题】:How to check if a Street Side (or Street View) exist for a coordinate in Bing Maps如何检查 Bing 地图中的坐标是否存在街边(或街景)
【发布时间】:2019-08-26 10:36:03
【问题描述】:

我正在尝试在地图上的 Angular 中创建自定义控件。该控件将在地图顶部显示一个按钮,当用户将鼠标放在地图中的任意位置时,如果地图上的该坐标存在街道一侧,则应加载街景。

否则应提示用户“所选点不存在街道一侧”的消息

如何使用 Bing Maps API 检查街道是否存在。

【问题讨论】:

    标签: bing-maps bing


    【解决方案1】:

    看看下面的 REST API:

    https://docs.microsoft.com/en-us/bingmaps/rest-services/imagery/get-imagery-metadata

    具体来说,您可以请求 Streetside Imagery 元数据以确定 Streetside 在指定缩放级别(以及所述图像的年份)的位置的可用性:

    https://dev.virtualearth.net/REST/v1/Imagery/Metadata/{imagerySet}/{centerPoint}?orientation={orientation}&zoomLevel={zoomLevel}&include={ImageryProviders}&key={BingMapsAPIKey}
    

    来自示例:

    http://dev.virtualearth.net/REST/v1/Imagery/MetaData/Streetside/47.668687,-122.384795?key={BingMapsAPIKey}
    

    这将返回以下信息:

    {
        "authenticationResultCode": "ValidCredentials",
        "brandLogoUri": "http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
        "copyright": "Copyright © 2019 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
        "resourceSets": [
            {
                "estimatedTotal": 1,
                "resources": [
                    {
                        "__type": "StreetsideMetadata:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
                        "imageHeight": 256,
                        "imageUrl": "http:\/\/ecn.{subdomain}.tiles.virtualearth.net\/tiles\/hs0203232101212100{faceId}{tileId}?g=7467&key=AmXtaLCMP57QEyxyjkcduZRBnG2QsKlj-iI5ng6neAGhOFP1md5I_S6iJzyO8GcF",
                        "imageUrlSubdomains": [
                            "t0",
                            "t1",
                            "t2",
                            "t3"
                        ],
                        "imageWidth": 256,
                        "imageryProviders": null,
                        "vintageEnd": "17 Jul 2014 GMT",
                        "vintageStart": "17 Jul 2014 GMT",
                        "zoomMax": 4,
                        "zoomMin": 1,
                        "he": 52.286,
                        "lat": 47.668696,
                        "lon": -122.384813,
                        "pi": 0.638,
                        "ro": -0.326
                    }
                ]
            }
        ],
        "statusCode": 200,
        "statusDescription": "OK",
        "traceId": "d5b39048afed42d29841380a6f57bed1|CO0000112F|7.7.0.0"
    }
    

    【讨论】:

    • 通过这个 API,我得到了街道边的元数据,以获取没有街道边的坐标。如何验证在地图上点击的点没有街道。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多