2

I am trying to use mapquest for adding a traffic layer in angular . I believe i have included all the scripts needed to run them in index.html

Feel free to share some other way to add traffic using leaflet if you know .

 var trafficlayer = L.map('map', {
      layers: L.mapquest.mapLayer(),
      center: [ 40.731701, -73.993411 ],
      zoom: 12
    });

The error is Property 'mapquest' does not exist on type 'typeof import("/Users/anandcr/Detect/one_map/node_modules/@types/leaflet/index")'.ts(2339)

index.html

  • added these scripts in index.html and trying to use them in an angular component
<script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-map.js?key=yeblECUdfo04G8hKloADL2DXqP2h0Z2U"></script>
  <script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-traffic.js?key=yeblECUdfo04G8hKloADL2DXqP2h0Z2U"></script> 
  <script src="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest.js"></script>
  <link type="text/css" rel="stylesheet" href="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest.css"/>
kaicr
  • 25
  • 6

1 Answers1

0

While I can't help with the Angular question, I highly recommend only using the latest version of the MapQuest SDK - MapQuest.js. It looks like you're including both the MapQuest.js and the MapQuest Leaflet Plugin in the script tags. I also recommend removing the key.

MQBrian
  • 452
  • 1
  • 3
  • 7