mapbox-utils-service
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Mapbox utils service

Simplifies working with Mapbox GL JS by eliminating boilerplate code. It provides intuitive functions to render and manage maps, markers, lines, and polygons, allowing you to focus on building interactive map features for your project.

Built With

mapboxgl

Get started

Get token

Before you get started with Mapbox GL JS, you need to have a Mapbox access token. This access token associates your map with a Mapbox account. For more information on creating and using access tokens, see mapbox's token management documentation.

See the mapbox's official getting started guide.

Installation

  • Install the npm package.
npm install --save mapbox-gl
  • Include the CSS file in the of your HTML file. The CSS file is required to display the map and make elements like Popups and Markers work.
<link href='https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css' rel='stylesheet' />
  • If you're using a CSS loader like webpack css-loader, you can import the CSS directly in your JavaScript.
import 'mapbox-gl/dist/mapbox-gl.css';

Usage

<body>
    <div id="container-id"></div>
</body>

<script>
    import { setToken, renderMap } from 'mapbox-service';

    // Set the user mapbox token here.
    setToken(##########);

    renderMap('container-id', {...options here});
</script>

Contact

LinkedIn

Leonardo Contreras - joseleoc123@gmail.com

Project link

Package Sidebar

Install

npm i mapbox-utils-service

Weekly Downloads

9

Version

0.0.1

License

MIT

Unpacked Size

67.5 kB

Total Files

17

Last publish

Collaborators

  • joseleoc