none
Problem with Microsoft.Maps.loadModule - property does not exist RRS feed

  • General discussion

  • Hi, I have a problem with the code below. This gives me an error and says the property doesn't exist in typeof Maps. I tried other modules such as Traffic and I have the same issue. It doesn't compile. The code is taken from an example in the documentation and it works when it is in a script in an HTML as shown in this link:

    https://github.com/Microsoft/BingMapsV8CodeSamples/blob/master/Samples/GeoJSON/GeoJson_BasicWithStyle.html

    But, in my TypeScript project it doesn't work. The problem is in the .read function below. It seems the module is not loaded after all. When I hover over GeoJson.read I see the error that says the property doesn't exist.

    This is API V8. I am using TypeScript. 

    Any ideas will be very much appreciated. Thanks very much

    var myGeoJson = {

    "type": "Polygon",
    "coordinates": [[
    [-122.12901, 47.64178],
    [-122.12901, 47.64226],
    [-122.12771, 47.64226],
    [-122.12771, 47.64178],
    [-122.12901, 47.64178]
    ]]
    };
    //Load the GeoJson Module.
    Microsoft.Maps.loadModule('Microsoft.Maps.GeoJson', function () {
    //Parse the GeoJson object into a Bing Maps shape.
    var shape = Microsoft.Maps.GeoJson.read(myGeoJson, {
    polygonOptions: {
    fillColor: 'rgba(255,0,0,0.5)',
    strokeColor: 'white',
    strokeThickness: 5
    }
    });
    })
    Wednesday, March 28, 2018 9:26 PM

All replies

  • Are you referencing the v8 definitions?

    They are here with documentation on how to use them: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions


    Friday, March 30, 2018 5:51 PM
    Moderator
  • Hi,

    It seems that updating the references solves this. I am not clear however how other modules were loading corrcetly without the update. I will find out more.

    Thanks!

    Tuesday, April 10, 2018 11:03 AM