New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

maplibre-google-maps

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maplibre-google-maps

MapLibre Google Maps plugin

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

MapLibre Google Maps plugin

Using this plugin you can add Google Maps layers to MapLibre GL JS.

To install dependency use the following NPM command:

npm install maplibre-google-maps

The libary includes two functions:

  • googleProtocol - protocol handler that needs to be passed to maplibregl.addProtocol with google as the protocol name
  • createGoogleStyle - function to create an instance map style; it accepts 3 arguments:
    • id - source id; can be any string
    • mapType - type of the map; roadmap and satellite are supported
    • key - Google API key with Map Tiles API enabled

Usage example:

import { googleProtocol, createGoogleStyle } from 'maplibre-google-maps';

maplibregl.addProtocol('google', googleProtocol);

const map = new maplibregl.Map({
  container: 'map',
  style: createGoogleStyle('google', 'roadmap', 'YOUR_GOOGLE_KEY'),
});

You need to replace YOUR_GOOGLE_KEY with your Google API key with Map Tiles API enabled. For more information check the official Google documentation.

Keywords

mapbox

FAQs

Package last updated on 12 Jun 2024

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