Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

An Azure Maps Web SDK module that provides a control that displays a scale bar relative to the pixel resolution at the center of the map.

License

Notifications You must be signed in to change notification settings

Azure-Samples/azure-maps-scale-bar-control

Repository files navigation

page_type description languages products
sample
An Azure Maps Web SDK module that provides a control that displays a scale bar relative to the pixel resolution at the center of the map.
javascript
typescript
azure
azure-maps

This is now built into Azure Maps Web SDK under atlas.control.ScaleControl

Azure Maps Scale Bar Control module

An Azure Maps Web SDK module that provides a control that displays a scale bar relative to the pixel resolution at the center of the map.

Samples

Simple Scale Bar Control

Getting started

Download the project and copy the azure-maps-scale-bar-control JavaScript file from the dist folder into your project.

Usage

//Add scale bar control to the map.
map.controls.add(new atlas.control.ScaleBarControl());

API Reference

ScaleBarControl class

Implements: atlas.Control

Namespace: atlas.control

A control that displays a scale bar relative to the pixel resolution at the center of the map.

Contstructor

ScaleBarControl(options?: ScaleBarControlOptions)

ScaleBarControlOptions interface

Properties

Name Type Description
maxBarLength number The maximum length of the scale bar in pixels. Default: 100
units 'imperial' | 'metric' | 'meters' | 'kilometers' | 'yards' | 'feet' | 'miles' | 'nauticalMiles' The distance units of the scale bar. Default: 'imperial'

Related Projects

Additional Resources

Contributing

We welcome contributions. Feel free to submit code samples, 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.

License

MIT

See License for full license text.

About

An Azure Maps Web SDK module that provides a control that displays a scale bar relative to the pixel resolution at the center of the map.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published