Socket
Socket
Sign inDemoInstall

mapbox_static_helper

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mapbox_static_helper

Provides urls and pixel positions for loading MapBox's static (square) tiles and create a bigger image


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Install size
7.02 kB
Created
Weekly downloads
 

Readme

Source

mapbox_static_helper

Provides urls and pixel positions for loading MapBox's static (square) tiles and create a bigger image

  • Used for creating the SRT log viewer in https://djitelemetryoverlay.com

Installation

Using npm:

$ npm install mapbox_static_helper

Usage

//Load module
let map = require('mapbox_static_helper');

//set values

//for example satellite-v9

map.setup({
  mapBoxToken, // Provided by MapBox
  screen_width,
  screen_height,
  zoom,
  map_style, //Available styles can be found here: https://www.mapbox.com/api-documentation/#styles
  location_data, //location_data must be an instance of this other module: https://github.com/JuanIrache/latlon_to_xy
  tile_size,
  attribution, // Whether to attribute MapBox on the image itself. Attribution is mandatory https://docs.mapbox.com/help/how-mapbox-works/attribution/#static--print
  double // Retrieve double resolution images
});
let image_urls = mp.getUrlsAndXY();
//getUrlsAndXY() returns an array of objects, with 3 values each: url (string), x and y (center position of image on screen)

//Other methods
map.setStyle(style); //sets the style string
console.log(map.getStyle()); //returns the style string
map.setLocation(location_data); //sets the location instance of latlon_to_xy
let location_data = map.getLocation(); //returns the location instance of latlon_to_xy

TODO

  • Not sure it's working well in conjunction with the laton_to_xy conversions module when changing tile size. What works for me is setting the tile size to 512 in the laton_to_xy module ant to 1024 here
  • Maybe we should make this module completely independent of laton_to_xy

Keywords

FAQs

Last updated on 07 Sep 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc