Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

ol-mapbox-style

Package Overview
Dependencies
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ol-mapbox-style - npm Package Compare versions

Comparing version 2.8.4 to 2.9.0

35

index.js

@@ -177,5 +177,8 @@ /*

function updateStyle() {
var element = map.getTargetElement();
if (!element) {
return;
}
var layout = layer.layout || {};
var paint = layer.paint || {};
var element = map.getTargetElement();
var zoom = map.getView().getZoom();

@@ -229,8 +232,9 @@ if ('background-color' in paint) {

var hasView = true;
function processStyle(glStyle, map, baseUrl, host, path, accessToken) {
var view = map.getView();
if ('center' in glStyle && !view.getCenter()) {
if ('center' in glStyle && !hasView) {
view.setCenter(proj.fromLonLat(glStyle.center));
}
if ('zoom' in glStyle && view.getZoom() == undefined) {
if ('zoom' in glStyle && !hasView) {
view.setZoom(glStyle.zoom);

@@ -409,3 +413,20 @@ }

/**
* Loads and applies a Mapbox Style object to an OpenLayers Map.
* Loads and applies a Mapbox Style object to an OpenLayers Map. This includes
* the map background, the layers, the center and the zoom.
*
* The center and zoom will only be set if present in the Mapbox Style document,
* and if not already set on the OpenLayers map.
*
* Layers will be added to the OpenLayers map, without affecting any layers that
* might already be set on the map.
*
* Layers added by `apply()` will have two additional properties:
*
* * `mapbox-source`: The `id` of the Mapbox Style document's source that the
* OpenLayers layer was created from. Usually `apply()` creates one
* OpenLayers layer per Mapbox Style source, unless the layer stack has
* layers from different sources in between.
* * `mapbox-layers`: The `id`s of the Mapbox Style document's layers that are
* included in the OpenLayers layer.
*
* @param {ol.Map|HTMLElement|string} map Either an existing OpenLayers Map

@@ -418,2 +439,7 @@ * instance, or a HTML element, or the id of a HTML element that will be the

* `https://api.mapbox.com/styles/v1/mapbox/bright-v9?access_token=[your_access_token_here]`.
* When passed as JSON style object, all OpenLayers layers created by `apply()`
* will be immediately available, but they may not have a source yet (i.e. when
* they are defined by a TileJSON url in the Mapbox Style document). When passed
* as style url, layers will be added to the map when the Mapbox Style docukment
* is loaded and parsed.
* @return {ol.Map} The OpenLayers Map instance that will be populated with the

@@ -428,2 +454,3 @@ * contents described in the Mapbox Style object.

if (!(map instanceof Map)) {
hasView = false;
map = new Map({

@@ -430,0 +457,0 @@ target: map

6

package.json
{
"name": "ol-mapbox-style",
"version": "2.8.4",
"version": "2.9.0",
"description": "Create OpenLayers maps from Mapbox Style objects",

@@ -53,4 +53,4 @@ "main": "index.js",

"mapbox-to-css-font": "^2.1.0",
"mapbox-to-ol-style": "^3.2.5",
"ol": "^4.5.0",
"mapbox-to-ol-style": "^3.3.0",
"ol": "^4.6.2",
"webfont-matcher": "^1.1.0"

@@ -57,0 +57,0 @@ },

@@ -61,4 +61,20 @@ # ol-mapbox-style

Loads and applies a Mapbox Style object to an OpenLayers Map.
Loads and applies a Mapbox Style object to an OpenLayers Map. This includes
the map background, the layers, the center and the zoom.
The center and zoom will only be set if present in the Mapbox Style document,
and if not already set on the OpenLayers map.
Layers will be added to the OpenLayers map, without affecting any layers that
might already be set on the map.
Layers added by `apply()` will have two additional properties:
- `mapbox-source`: The `id` of the Mapbox Style document's source that the
OpenLayers layer was created from. Usually `apply()` creates one
OpenLayers layer per Mapbox Style source, unless the layer stack has
layers from different sources in between.
- `mapbox-layers`: The `id`s of the Mapbox Style document's layers that are
included in the OpenLayers layer.
**Parameters**

@@ -73,2 +89,7 @@

`https://api.mapbox.com/styles/v1/mapbox/bright-v9?access_token=[your_access_token_here]`.
When passed as JSON style object, all OpenLayers layers created by `apply()`
will be immediately available, but they may not have a source yet (i.e. when
they are defined by a TileJSON url in the Mapbox Style document). When passed
as style url, layers will be added to the map when the Mapbox Style docukment
is loaded and parsed.

@@ -75,0 +96,0 @@ Returns **ol.Map** The OpenLayers Map instance that will be populated with the

Sorry, the diff of this file is too big to display

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