This project contains the TypeScript definitions for the Bing Maps V8 Web Control.

Overview

Bing Maps Logo

NuGet npm license

Bing Maps V8 TypeScript Definitions

These are the official TypeScript definitions for the Bing Maps V8 Web Control. These can be used to provide intellisense and richer error catching functionality to your IDE.

Bing Maps V8 Intellisense

Note: Due to popular demand, version 2.x now puts these definitions in a types folder instead of a scripts folder.

How to get the definitions

Use the NuGet Package

Using the Bing Maps V8 TypeScript Definitions NuGet package will make it easy to both add the definitions to your project and to also keep them up to date.

If using Visual Studio, open the nuget package manager, select the Browse tab and search for "Bing Maps V8". This should reduce the list of results enough to fine the "Bing Maps V8 TypeScript Definitions" package. The owner of the package is bingmaps.

Alternatively, if you are using the nuget commandline:

PM>  Install-Package Microsoft.BingMaps.V8.TypeScript

Install npm package

Using the Bing Maps V8 TypeScript npm package is another easy way to add the definitions to your project and keep them up to date.

npm install -g bingmaps

Download definitions

Simply press the download button for this repository. Unzip the downloaded file, and copy the types folder into your project. Note that you will need to do this process again from time to time if you want to have the most recent definitions. This should only be needed if you want to use newer features or if bugs in the definitions have been corrected.

Usage

If using Visual Studio, you can add a reference to the core Bing Maps V8 functionality by adding the following to the top of your TypeScript file.

/// <reference path="types/MicrosoftMaps/CustomMapStyles.d.ts" />
/// <reference path="types/MicrosoftMaps/Microsoft.Maps.d.ts" />

If you want to also use some of the Bing Maps modules, you can either update the above reference to the following:

/// <reference path="types/MicrosoftMaps/Microsoft.Maps.All.d.ts" />

or you can add a reference to the individual module definitions.

Module Path
Autosuggest types/MicrosoftMaps/Modules/Autosuggest.d.ts
Clustering types/MicrosoftMaps/Modules/Clustering.d.ts
Contour types/MicrosoftMaps/Modules/Contour.d.ts
Data Binning types/MicrosoftMaps/Modules/DataBinning.d.ts
Directions types/MicrosoftMaps/Modules/Directions.d.ts
Drawing Tools types/MicrosoftMaps/Modules/DrawingTools.d.ts
GeoJSON types/MicrosoftMaps/Modules/GeoJson.d.ts
GeoXml types/MicrosoftMaps/Modules/GeoXml.d.ts
Heat Map Layer types/MicrosoftMaps/Modules/HeatMapLayer.d.ts
Search types/MicrosoftMaps/Modules/Search.d.ts
Spatial Data Services types/MicrosoftMaps/Modules/SpatialDataServices.d.ts
Spatial Math types/MicrosoftMaps/Modules/SpatialMath.d.ts
Traffic types/MicrosoftMaps/Modules/Traffic.d.ts
Well Known Text types/MicrosoftMaps/Modules/WellKnownText.d.ts

Note:

This project is just TypeScript definitions and not actual API code. You will need to add a script reference to the Bing Maps V8 Web Control in your application to load the functional API. For example:

<script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=[Your_Bing_Maps_Key]' async defer></script>

Screenshots

The following shows the intellisense for events. Notice how a list of the supported events are displayed, thus saving you from having to go back to documentation to verify the correct event name. Also notice how the structure of the event argument is known and you can easily access its properties.

Bing Maps V8 Event Intellisense

The following shows the intellisense for adding modules. A list of the supported modules appears, saving you from having to go looking for the correct name/spelling used in Bing Maps V8.

Bing Maps V8 Load Module Intellisense

Q & A

  • Q: When will new Bing Maps features be added to these definitions.
    • A: New features will be added to the definitions when they have graduated out of the experimental branch and into the main release branch of V8. This will often be done in parallel with MSDN documentation updates. A list of new features can be found in the release notes here.
  • Q: Whats the difference between version 1.x and 2.x?
    • A: Version one put all the definitions in a scripts folder while version 2.x adds them to a types folder.

Contributing

We welcome contributions. Feel free to file issues and pull requests on the repo and we'll address them as we can. Learn more about how you can help on our Contribution Rules & Guidelines.

You can reach out to us anytime with questions and suggestions using our communities below:

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Related Projects

Additional Resources

License

MIT

See License for full license text.

Comments
  • Add module export for Microsoft.Maps.d.ts

    Add module export for Microsoft.Maps.d.ts

    I want to do this.... import { Microsoft } from 'bingmaps/scripts/MicrosoftMaps/microsoft.maps';

    but because you are not including an export on the module, I am not able to. Can we add explicit export statements to allow for greater integration with Typescript?

    e.g. change "declare module Microsoft.Maps {" to "export declare module Microsoft.Maps {"

    please also do so for all the files inside the "modules" folder... this will allow imports to be cleaner.

    Thanks!

    opened by Chrisbright10 20
  • @types/bingmaps

    @types/bingmaps

    Can you work with the typescript team to get this released on @types. It's much easier to manage using npm that way without having to pull the definitions into a local project. See https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/

    question 
    opened by jefbarn 11
  • Uncaught ReferenceError: BirdseyeV2InfoExitControl is not defined

    Uncaught ReferenceError: BirdseyeV2InfoExitControl is not defined

    Uncaught ReferenceError: BirdseyeV2InfoExitControl is not defined at o._appendBirdseyeV2InfoExitControl (www.bing.com/rms/MapDelayPluginBundle/cj,nj/32eb50fc/55a5cff6.js?bu=rms+answers+MapsSDKRelease+AnonymousBeginNavigationMapDelay.enMapDelayPluginStartTransitLandmarkOverlaySharingImagePermalinkDefaultPrimitiveCriteriaIRoutePolylineOptionsIRoutePushpinOptionsITransitPushpinOptionsRoutePolylineRoutePushpinListDataSourceKeyProviderBrowserKeyProviderPointerProviderBrowserPointerProviderMapInteractionKeyboardStateMapInteractionMapModeStateHistoryPrintContentBrowserHistoryManagerHashBasedHistoryHistoryWrapperNavigationControlAerialBirdsEyeTransitionManagerNavigationBarMePoiNavigationButtonNavigationButtonTemplateNavigationHelperRotateControlGeochainControlGeochainOverlayGeochainTemplateGeochainSegmentGeochainManagerLocateMeControlLocateMeErrorDialogSelectorControlMapInteractionBehaviorOverlayManagerNavigationBarOverlayGlobalDataEventHandlerImageFromCssHelperDataHandlerKeysIDirectionsTaskStateWaypointCollectionEnumeratorsOverlayEntityOverlayDataEntityActionTaskTypesTaskDataHandlerHelperLocalSearchEntityRecommendationEntityGeocoderReverseGeocoderGeolocationProviderManipulationDeltaInertiaPointerTrailManipulationDeltaTrailStreetsideAutoEntryBehaviorStreetsideAutoEntryBubblePickerOverlayStreetsideBootstrapperStreetsideModeBootstrapperStreetsideMiniOverlayStreetsideMiniBootstrapperStreetsideDirectionsOverlayStreetsideDirectionsBootstrapperStreetsideLocalDetailsBootstrapperStreetsideCoverageBehaviorStreetsideBubblePickerOverlayStreetsideLoggerConstantsStreetsidePerfConstantsZoomInButtonZoomOutButtonMapTypeSwitcherButtonTrafficToggleButtonRadialMenuMapTypeButtonMapTypeButtonTemplateRoadButtonAerialButtonBirdseyeButtonStreetsideButtonOrdnanceSurveyButtonSeasonalButtonGrayscaleButtonCanvasDarkButtonCanvasLightButtonSymbolicNightButtonWinterButtonLabelToggleButtonBirdseyeV2ExitButtonLandmarksManagerLandmarksOverlayCityPolygonManagerMapDelayPluginEndAnonymousEnd*ExternalPromise:1)

    opened by timilsinagd 10
  • TypeScript Error - Cannot find name Microsoft

    TypeScript Error - Cannot find name Microsoft

    I followed the instructions provided in the website https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions . My Visual Studio Code is not showing any errors though I get the error "Cannot find name Microsoft" when I try to run my angular project.

    I tried both methods and still get the below error.

    • Install npm package
    • Use DefinitelyTyped

    I also tried to include the bingmaps in the package.json and that didn't work either. Can someone please tell me what I am doing wrong?

    Error:

    error TS2304: Cannot find name 'Microsoft'.

    Below is my code sample

    var options = {maxResults: 5, businessSuggestions: true};
    Microsoft.Maps.loadModule('Microsoft.Maps.AutoSuggest', function () {
    var manager = new Microsoft.Maps.AutosuggestManager( options );
    manager.attachAutosuggest('#searchBox', '#searchBoxContainer', suggestionSelected);
    });
    
    

    First attempt

    /// <reference path="../../../../../../node_modules/bingmaps/types/MicrosoftMaps/CustomMapStyles.d.ts" />
    /// <reference path="../../../../../../node_modules/bingmaps/types/MicrosoftMaps/Microsoft.Maps.d.ts" />
    /// <reference path="../../../../../../node_modules/bingmaps/types/MicrosoftMaps/Modules/Autosuggest.d.ts" />
    

    Second attempt

    /// <reference path="../../../../../../node_modules/@types/bingmaps/index.d.ts" />
    /// <reference path="../../../../../../node_modules/@types/bingmaps/Autosuggest.d.ts" />
    /// <reference path="../../../../../../node_modules/@types/bingmaps/Clustering.d.ts" />
    

    Environment Info

    OS: Windows 10 Browser: Chrome 69.0.3497.92 (Official Build) (64-bit) Angular: 5.1.0 TypeScript: 2.4.2

    opened by nsankaranarayanan 9
  • Cannot read property

    Cannot read property

    I am trying to use the SpatialMath class of the Bing Maps API, but when I try and use it below I am getting this error. "Uncaught TypeError: Cannot read propert of 'getHeading' of undefined.

    `locs = this.generatePolylinePointsWithArrow(locs, numArrows, arrowLength);

    // Finds the heading for the arrow that will be added at the center of the line
    var midIdx = Math.floor(locs.length / 2);
    var heading: any;
    setTimeout(() => {
      
    }, 2000)
    
    heading = Microsoft.Maps.SpatialMath.getHeading(locs[midIdx], locs[midIdx + 1]);
    
    // Create the arrow pushpin
    var arrowPin = new Microsoft.Maps.Pushpin(locs[midIdx + 1], {
      icon: '<svg xmlns="http://www.w3.org/2000/svg" height="32" width="32"><path d="M10.5 31 L16 16 21.5 31" style="stroke:#FFB500;stroke-width:2px;fill:none;" transform="rotate(' + heading + ', 16, 16)"/></svg>',//'../../../../../assets/Images/arrow.png',//'<img src="../../../../../assets/Images/arrow.png" transform="rotate(' + heading + ', 16, 16)"></img>',
      anchor: new Microsoft.Maps.Point(16, 16)
    });`
    

    I suspect this is because my file hasn't loaded SpatialMath yet, but I still don't know how to resolve this issue.

    I have these two lines at the top of my file /// <reference path="..\..\..\..\..\..\node_modules\bingmaps\scripts\MicrosoftMaps\Modules\SpatialMath.d.ts"/> /// <reference path="..\..\..\..\..\..\node_modules\bingmaps\scripts\MicrosoftMaps\Microsoft.Maps.d.ts"/>

    opened by drewteachout 9
  • Cannot import types into project

    Cannot import types into project

    Am working on Typescript project and having trouble importing the bingmap types. I try to import the types like so:

    import { Location } from 'bingmaps'
    import * as all from 'bingmaps'
    import { Microsoft } from 'bingmaps'
    

    I didn't try to import them all at the same time. These are just three ways I tried to import. In anycase I don't think the way I try to import them is the problem.

    My compiler keeps complaining node_modules/bingmaps/types/MicrosoftMaps/Microsoft.Maps.all.d.ts is not a module.

    Looking into node_modules/bingmaps folder, there are files.

    I have the script and my map is working as expected. There must be some way to import the type definitions in my project... this surely should be documented somewhere. Can someone help?

    opened by isabellachen 8
  • this in CustomOverlay prototype methods

    this in CustomOverlay prototype methods

    It is probably not only CustomOverlay problem but with all utilities doing similar staff, but in my case its CustomOverlay. It would be nice to be able to access the CustomOverlay members from this when inside constructional methods like onAdd, onLoad, onRemove...

    Thank you.

    opened by Spown 7
  • DefinitelyTyped/bingmaps

    DefinitelyTyped/bingmaps

    Hi, is the type definition here: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/bingmaps for Bing Maps V8? If not, is it possible for you to add one for V8?

    question 
    opened by payson 7
  • Changing the view from Road to Aerial, Javascript Error

    Changing the view from Road to Aerial, Javascript Error

    We are using TypeScript definitions package for the Bing Maps V8 Web Control in our React application.

    While changing the view from Road to Aerial, we are getting the below error.

    image

    Please refer this url for more details https://social.msdn.microsoft.com/Forums/en-US/2052b8db-8e85-4d7f-bb02-760a32c7725a/bing-maps-v8-typescript-definitions-javascript-error?forum=bingmapsajax

    opened by pandillaanil 6
  • Last 'scripts' folder references to be renamed to the current 'types' folder reference.

    Last 'scripts' folder references to be renamed to the current 'types' folder reference.

    opened by METACEO 4
  • IModuleOptions errorCallback type doesn't match documentation

    IModuleOptions errorCallback type doesn't match documentation

    opened by jordan-schneider 3
  • Missing

    Missing "square" NavigationBarMode

    Hi, I'd like to use "square" navigation bar mode, that is described in bingmaps docs, unfortunatelly here in defined enumeration it is not avaialble. Could you please add it there, or explain why it should not be avaialble?

    opened by Stusu 1
Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers.

Polymaps Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers. See http://polymaps.org for more details.

Urban Airship 1.6k Dec 23, 2022
A simple web extension that redirects Twitter, YouTube, Instagram & Google Maps requests to privacy friendly alternatives.

Get Donate FIRO aEyKPU7mwWBYRFGoLiUGeQQybyzD8jzsS8 BTC: 3JZWooswwmmqQKw5iW6AYFfK5gcWTrvueE ETH: 0x90049dc59365dF683451319Aa4632aC61193dFA7 About A web

Simon Brazell 1.6k Dec 29, 2022
:leaves: JavaScript library for mobile-friendly interactive maps

Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps. Weighing just about 39 KB of gzipped JS plus 4 KB of gzipp

Leaflet 36.5k Jan 1, 2023
An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics

Cesium 9.7k Dec 26, 2022
the easiest way to use Google Maps

Important If you're developer, I'm moving gmaps.js to NPM, you can give your opinion and check the migration progress in Issue #404 gmaps.js - A Javas

Gustavo Leon 7.1k Dec 28, 2022
UNMAINTAINED Open source JavaScript renderer for Kartograph SVG maps

This project is not maintained anymore. Here are a few reasons why I stopped working on kartograph.js: there's no need to support non-SVG browsers any

null 1.5k Dec 11, 2022
An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics

Cesium 9.7k Jan 3, 2023
the easiest way to use Google Maps

Important If you're developer, I'm moving gmaps.js to NPM, you can give your opinion and check the migration progress in Issue #404 gmaps.js - A Javas

Gustavo Leon 7.1k Apr 7, 2021
React components for Leaflet maps

React Leaflet React components for Leaflet maps. Documentation Getting started API reference Changes See the CHANGELOG file. Contributing See the CONT

Paul Le Cam 4.4k Jan 3, 2023
Vue 2 components for Leaflet maps

Vue2Leaflet Vue2Leaflet is a JavaScript library for the Vue framework that wraps Leaflet making it easy to create reactive maps. How to install npm in

Vue Leaflet 1.9k Dec 29, 2022
Converts geojson to svg string given svg viewport size and maps extent.

geojson2svg Converts geojson to svg string given svg viewport size and maps extent. Check world map, SVG scaled map and color coded map examples to de

Gagan Bansal 163 Dec 17, 2022
AngularJS directive to embed an interact with maps managed by Leaflet library

Angular Leaflet Why the fork? While we are grateful for all the original work at tombatossals/angular-leaflet-directive. We need to be able to operate

AngularUI 313 Nov 10, 2022
Downloads satellite images from Google Maps, only slightly illegal.

Google Maps Satellite Downloader This is a script to download satellite images from Google Maps. The below mentioned optimization system requires that

null 5 Oct 31, 2022
An online tool to generate and visualize maps for irregular and/or gapped LED layouts, for use with FastLED, Pixelblaze and other libraries.

An online tool to generate and visualize maps for irregular and/or gapped LED layouts, for use with FastLED, Pixelblaze and other libraries.

Jason Coon 172 Dec 8, 2022
🖼️ Create beautiful maps from OpenStreetMap data in a webapp

prettymapp ??️ Prettymapp is a webapp to create beautiful maps from OpenStreetMap data (based on prettymaps) ?? Try it out here: prettymapp on streaml

Christoph Rieke 233 Jan 3, 2023
Dashboards-maps is a frontend plugin that helps you in uploading custom GeoJSON to OpenSearch and communicates with the geospatial backend plugin for the same.

Welcome! Project Resources Code of Conduct License Copyright Dashboards-Maps Dashboards-maps is a frontend plugin that helps you in uploading custom G

null 9 Dec 28, 2022
Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL

Mapbox GL JS is a JavaScript library for interactive, customizable vector maps on the web. It takes map styles that conform to the Mapbox Style Specif

Mapbox 9.4k Jan 7, 2023
Geokit - is a command-line interface (CLI) tool written in javascript, that contains all the basic functionalities for measurements, conversions and operations of geojson files.

Geokit Geokit is a command-line interface (CLI) tool written in javascript, that contains all the basic functionalities for measurements, conversions

Development Seed 31 Nov 17, 2022
3D web map rendering engine written in TypeScript using three.js

3D web map rendering engine written in TypeScript using three.js

HERE Technologies 1.2k Dec 30, 2022