Socket
Socket
Sign inDemoInstall

@types/mapbox-gl

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/mapbox-gl

TypeScript definitions for Mapbox GL JS


Version published
Weekly downloads
597K
decreased by-14.45%
Maintainers
1
Weekly downloads
 
Created

What is @types/mapbox-gl?

@types/mapbox-gl provides TypeScript type definitions for the Mapbox GL JS library, which is used for creating interactive, customizable maps in web applications.

What are @types/mapbox-gl's main functionalities?

Creating a Map

This feature allows you to create a new map instance with specified options such as container, style, center, and zoom level.

const map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/streets-v11',
  center: [-74.5, 40],
  zoom: 9
});

Adding a Marker

This feature allows you to add a marker to the map at a specified longitude and latitude.

const marker = new mapboxgl.Marker()
  .setLngLat([-74.5, 40])
  .addTo(map);

Adding a Popup

This feature allows you to add a popup to the map with specified text and location.

const popup = new mapboxgl.Popup({ offset: 25 })
  .setText('Hello, Mapbox!')
  .setLngLat([-74.5, 40])
  .addTo(map);

Geolocation Control

This feature allows you to add a geolocation control to the map, enabling the map to track the user's location.

const geolocateControl = new mapboxgl.GeolocateControl({
  positionOptions: {
    enableHighAccuracy: true
  },
  trackUserLocation: true
});
map.addControl(geolocateControl);

Navigation Control

This feature allows you to add navigation controls (zoom and rotation) to the map.

const nav = new mapboxgl.NavigationControl();
map.addControl(nav, 'top-left');

Other packages similar to @types/mapbox-gl

FAQs

Package last updated on 08 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc