Socket
Book a DemoInstallSign in
Socket

palmjs

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

palmjs

A lightweight javascript map package

0.0.3
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Palmjs's Logo

Pretty Awesome Lightweight Maps

npm Bundle Size

Palmjs is a simple, lightweight library for embedding maps into your website. It leverages tile-based map rendering and supports custom tile layers, making it perfect for basic mapping needs without the overhead of larger libraries.

Features

  • Lightweight and easy to integrate.
  • Supports custom tile layers.
  • Automatically calculates visible tiles based on the container size.

Installation

$ npm install palmjs

Usage

Basic map

<!-- Add element to html where map will be rendered. -->
<div id="map"></div>
// Initialize a new map with the given element id and map options.
new Palmjs('map', {
  latitude: 51.5,
  longitude: -0.15,
  zoom: 14,
});

Basic map example

Custom tile layer

new Palmjs('map', {
  latitude: 51.5,
  longitude: -0.15,
  zoom: 14,
  tileLayerUrl:
    'https://api.tiles.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.png?access_token=[YOUR_TOKEN]',
});

Custom tile layer example

API Reference

ParameterTypeDescriptionRequired
elementIdstringThe ID of the container element where the map will be rendered.Yes
optionsMapOptionsConfiguration options for the map (see MapOptions interface).Yes

MapOptions Interface

ParameterTypeDescriptionRequiredDefault
latitudenumberThe initial latitude of the map.Yes
longitudenumberThe initial longitude of the map.Yes
zoomnumberThe initial zoom level of the map (must be a positive number).Yes
tileLayerUrlstringThe URL template for the map tiles. Use {x}, {y}, and {z} as placeholders for the tile coordinates and zoom.Nohttps://tile.openstreetmap.org/{z}/{x}/{y}.png

Roadmap

  • Add map panning and zooming
  • Add support for markers
  • Add test coverage with coveralls

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

Lightweight Map

FAQs

Package last updated on 20 Nov 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.