Displaying Bing Map layers

Microsoft Bing Maps is popular web mapping applications, which license is less restrictive when compared to other services. Therefore it can be used in VTS 3D Geospatial Software Stack as one of the Bound layers.

Setting up mapproxy resources

VTS Mapproxy has support for tms-bing driver. It will be configured as standard Bound layer for VTS Mapproxy. Therefore we need to know following inputs, before we start:

  • Metadata URL - the Bing REST Api url
  • Bing Secret key - your unique key to Microsoft services
  • Reference frame definition - the lodRange and tileRange
  • Other metadata, like credits definition etc.

Before you start, it might be worth to check Bing Maps documentation.

Bing secret key

As first step, you need a Bing Maps key. For this, you have to visit Microsoft admin interface and let the key generate there.

../_images/bing-api-key.png

You should have some ling alpha-numeric chain (we will refer to it as SECRET_KEY) which is needed to further configuration.

Metata URL

Layer metadata URL is all the time the same and has following format (check the documentation).:

https://dev.virtualearth.net/REST/v1/Imagery/Metadata/[IMAGERY_SET]?key=[SECRET_KEY]

There is a list of availabe imagery sets

  • Aerial
  • AerialWithLabels
  • AerialWithLabelsOnDemand
  • CanvasDark
  • CanvasLight
  • CanvasGray
  • Road
  • RoadOnDemand

Reference frame definition

We are going to present two reference frame configurations:

  • the melown2015, which covers not only the Earth from Equator to cca 85° on the North and South, but also the polar caps. Since Bing maps do have generated tiles from zoom level 1 (when compared to e.g. Google, which starts with 0), the lodRange is to be defined between 2 - 21.
  • the webmerc-projected, which shows the “flat” map (famous Google-Mercator projection). In this case, the LOD range is set between [0, 21]

Credits

We may also display the copyright notice of the Bing Maps. This is defined by simple notice {copy}{Y} Microsoft Corporation.

Creating Bound layer configuration snippet

Putting this all together, we can now approach the Bing map bound layer configuration part.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    {
        "comment" : "Microsoft Bing Maps orthophoto",
        "credits" : [ "microsoft" ],
        "definition" : {
            "metadataUrl" : "http://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialWithLabels?key=As################################################mbk"
        },
        "driver" : "tms-bing",
        "group" : "melown",
        "id" : "bing-world",
        "referenceFrames": {
            "melown2015" : {
                "lodRange" : [ 2, 21 ],
                "tileRange" : [ [ 0, 0 ], [ 1, 1 ] ]
            },
            "webmerc-projected" : {
                "lodRange" : [ 0, 21 ],
                "tileRange" : [ [ 0, 0 ], [ 1, 1 ] ]
            }
        },
        "registry" : {
            "credits" : {
                "microsoft" : { "id" : 5, "notice" : "{copy}{Y} Microsoft Corporation" }
            }
        },
        "type" : "tms"
    },

Displaying the data

We need to define at least one “empty” spheroid-dem type of surface layer, with our bing layer in it’s definition.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    {
        "comment": "spheroid",
        "group": "melown",
        "id": "dem",
        "type": "surface",
        "driver": "surface-spheroid",
        "referenceFrames": {
            "melown2015" : {
                "lodRange": [0,21],
                "tileRange": [ [ 0, 0], [1, 1]]
            },
            "webmerc-projected" : {
                "lodRange": [0,21],
                "tileRange": [ [ 0, 0], [1, 1]]
            }
        },
        "credits": [],
        "definition": {
            "introspection": {
                "tms": [{
                    "group": "melown",
                    "id": "bing-world"
                }]
            }
        }
    }

When running VTS Mapproxy with the projects/bing/resources.json (e.g. using Docker), you should see a globe with Bing maps on it.

../_images/bing-globe.png

The Bing AerialWithLabels layer on the spheroid using melown2015 reference frame.

../_images/bing-flat.png

The Bing AerialWithLabels layer in the web-mercator projection, using the webmerc-projected reference frame.