{"_id":"maplibregl-mapbox-request-transformer","_rev":"3-e4e98aa03bd6777e54525792d3cc96e8","name":"maplibregl-mapbox-request-transformer","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"maplibregl-mapbox-request-transformer","version":"0.0.1","keywords":["mapbox","mapbox-gl","mapbox-gl-js","maplibre","maplibre-gl","maplibre-gl-js","react-map-gl","react"],"author":{"name":"Rowan Winsemius"},"license":"MIT","_id":"maplibregl-mapbox-request-transformer@0.0.1","maintainers":[{"name":"rowanwins","email":"rowanwins@yahoo.com.au"}],"homepage":"https://github.com/rowanwins/maplibregl-mapbox-request-transformer#readme","bugs":{"url":"https://github.com/rowanwins/maplibregl-mapbox-request-transformer/issues"},"dist":{"shasum":"5418d432b809e2962be7ffd0281a907ae3f121e9","tarball":"https://registry.npmjs.org/maplibregl-mapbox-request-transformer/-/maplibregl-mapbox-request-transformer-0.0.1.tgz","fileCount":5,"integrity":"sha512-trIVvIsj7mf1OUtLuvZlTWPdd6wWwYZWQidLBOXywAmci+fjGC7C+ROwO804RB+shFJnEeSs/Ad7r/JBrku87g==","signatures":[{"sig":"MEUCIQCAIRwABfCDKAA+Ze8u/VKOC1CxZdIBihSs7L2blaXF2QIgexFjv2wM6kgo3tMTU9NzVv7GE06COY62ItD+WpZ12Wc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjQ+zaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqMZg/8DFLjgiEez0kwVOxMnU6e9+pWFeojk60mEzSOpPzJPl7EqMQr\r\nJ4u3qMFR1nwSHDEWVbtrB2TFxnvoNsZohgXZsM11/2Ms0QBwPXHqAU49enk1\r\nv0DHZvfs6LvwK+7UkMBRvs0FeRjyYbLE9Qa3JJUiLRbPoZ+uhXajvjoYCcCm\r\nOpLHgOgQB0kCaHRpM81G0Xd88wETk4Zm8RMtE4IrQUXX2cOcal3te4MNeDde\r\nMN8yF3DFLCpkoTrDu4TKvLbGlhuR1t6WICsDEcxUWdsN7Od7tIQPveKogTec\r\nzTRaXJFxWZyujSAyhoBI2uoXEKf48BowZ4rexgat59KxOJVYZFDy9Kccx9AY\r\nqrzuAcjz8wWGMjMICx1bgfdO+LesWeuyTFKgjDfvcOXro+8g1NpFE6Q8EChO\r\niZUq7C8QBsv9PNpM0m8rtzSBuXsd8vtl0ayGHvz12TflSiQkdxJfcVUPMAJw\r\nwBykI+NZQ7w4uY/gjTxyVV28PVrmjzujXyw9RIb7U6hrNhc2tl8boAif5hex\r\nFo1/XyGoeBAwMmVli7WCJoYIxneUlqfuBnpS11VOZra9C9mgzL3hcvIOZqQE\r\nHTxbcDFRmAB2ThKxCtAFP9gMWF/Hp6Zy25IxZYhV6vRSe/oGRVWoF4YZKTzD\r\niQKnoxr46PMYkosL2kd1z8y7nBmiHmmU0VI=\r\n=pJeT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","type":"module","types":"src/index.d.ts","module":"src/index.js","exports":"./src/index.js","gitHead":"e4fed0ec75a9fb5a69d26888a1a675d678099810","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"rowanwins","email":"rowanwins@yahoo.com.au"},"repository":{"url":"git+https://github.com/rowanwins/maplibregl-mapbox-request-transformer.git","type":"git"},"_npmVersion":"8.1.2","description":"Transform mapbox:// urls in MapboxGL Styles for use in MapLibreGL.","directories":{},"_nodeVersion":"16.13.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/maplibregl-mapbox-request-transformer_0.0.1_1665395930450_0.4405528672683532","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"maplibregl-mapbox-request-transformer","version":"0.0.2","keywords":["mapbox","mapbox-gl","mapbox-gl-js","maplibre","maplibre-gl","maplibre-gl-js","react-map-gl","react"],"author":{"name":"Rowan Winsemius"},"license":"MIT","_id":"maplibregl-mapbox-request-transformer@0.0.2","maintainers":[{"name":"rowanwins","email":"rowanwins@yahoo.com.au"}],"homepage":"https://github.com/rowanwins/maplibregl-mapbox-request-transformer#readme","bugs":{"url":"https://github.com/rowanwins/maplibregl-mapbox-request-transformer/issues"},"dist":{"shasum":"5488714e184c58e2dd36f88934dbb463cb64a379","tarball":"https://registry.npmjs.org/maplibregl-mapbox-request-transformer/-/maplibregl-mapbox-request-transformer-0.0.2.tgz","fileCount":5,"integrity":"sha512-P4QLyebbrtfAxwYX5ThKRDn2FT77CFxjQ9a5HtmP9l4s3ddwyjD6cpNjwYf2Hl9OApnD7yP3IpdrCCn0S9fI0g==","signatures":[{"sig":"MEYCIQD8NN9uZjIZIz8qkGugnaxXI3ov8JBxpr6WZNNtd7L98gIhAK9RkbR3Cssn+IVSMN06545a7UAcCzDiwYFylMESKD4g","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5653,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjjcuUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6yA/+Omk48CmPgNOdOLD9btfLh0f/29rjzUZNGtOGn+wGULr0pCN5\r\nTFEjuafvAMZTHfcWzv7UItfm4Zu1bQjYADJiRtdQ8lo5eYDLPOZ6aVNjm4UQ\r\ncgSLsa9P4cHAkv+O016x3RupdtndJPTD5zUNhGXCreSrAs4MBwG+DjT48L0l\r\nNo+vHyLhPL/oAwWusGtJ+oXCMV/WI0YW6ZLEM80Vo/GC6fUt1v54QPLUPrUv\r\nWGWc1jDJeE+FSUHTvFsVOlwyvpjTOaA0ci+lNrud8xuvCMf/VC0iUX0v8hcA\r\n+XSe3wVioaecKxGybELA8zHWF5GYdCwO4UxQEB2JCbGxmLUt42sWM/zOpPSf\r\nXS0n4MZ7YQP2igCS/Dzd72IK/b3/RLl7Uak+ecuPrmMzsefF8FQRFrUY0HNY\r\nUGNdUIRvX594rMO092j+Et0vxaGoIjdKue3bNmiFuglearpawUyM23ELY3Hz\r\nAxjfZkjH06uFyKHuwn2CcVuHdTFw0hw9KixC2G2HzkSfBF6WK/7HqWF9E9OG\r\nEjGuNneQPgPRYmLL4uqsIeYuKc3H29d5n5R2/yTPMLiVonx4GHo6qG6mc6S4\r\nNdQyeAgl3kL7kVLK85jkTMXz8oNmBwGExf29JzuXXIyTAe/8+BYm2fd6JZNQ\r\nbegyrSpCOeV1aPsgEPQPyEhUvYoF7YHYR3s=\r\n=bzKU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","type":"module","types":"src/index.d.ts","module":"src/index.js","exports":"./src/index.js","gitHead":"e4fed0ec75a9fb5a69d26888a1a675d678099810","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"rowanwins","email":"rowanwins@yahoo.com.au"},"repository":{"url":"git+https://github.com/rowanwins/maplibregl-mapbox-request-transformer.git","type":"git"},"_npmVersion":"8.1.2","description":"Transform mapbox:// urls in MapboxGL Styles for use in MapLibreGL.","directories":{},"_nodeVersion":"16.13.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/maplibregl-mapbox-request-transformer_0.0.2_1670237076350_0.6954516493274481","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"maplibregl-mapbox-request-transformer","version":"0.0.3","description":"Transform mapbox:// urls in MapboxGL Styles for use in MapLibreGL.","main":"src/index.js","module":"src/index.js","exports":"./src/index.js","types":"src/index.d.ts","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Rowan Winsemius"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/rowanwins/maplibregl-mapbox-request-transformer.git"},"keywords":["mapbox","mapbox-gl","mapbox-gl-js","maplibre","maplibre-gl","maplibre-gl-js","react-map-gl","react"],"peerDependency":{"maplibre-gl":"^4"},"_id":"maplibregl-mapbox-request-transformer@0.0.3","gitHead":"af3540b800931dd3741ca5eb814384f25c6f03e9","bugs":{"url":"https://github.com/rowanwins/maplibregl-mapbox-request-transformer/issues"},"homepage":"https://github.com/rowanwins/maplibregl-mapbox-request-transformer#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-YqK4em6Ksxx8C5CA5GOyojIbSAmJZgZM64rgUAAG2M5myyTCbRJqRr9y8oBB1aNIQUA1ZCF3WHmWeDT2Pdpjbw==","shasum":"509a4e08cab2ba161f6bdc7a9331b6b650f2d7a6","tarball":"https://registry.npmjs.org/maplibregl-mapbox-request-transformer/-/maplibregl-mapbox-request-transformer-0.0.3.tgz","fileCount":5,"unpackedSize":8518,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCIZOMcY9CxRrHLpINWRSQBdBfic71k1RX8DBnc+y6NcgIgLroJqPPdpNldCQjLaDvT4FQdN0cYzwH8LvzpSPcqCzQ="}]},"_npmUser":{"name":"rowanwins","email":"rowanwins@yahoo.com.au"},"directories":{},"maintainers":[{"name":"rowanwins","email":"rowanwins@yahoo.com.au"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/maplibregl-mapbox-request-transformer_0.0.3_1754627776391_0.3915949251538515"},"_hasShrinkwrap":false}},"time":{"created":"2022-10-10T09:58:50.450Z","modified":"2025-08-08T04:36:16.814Z","0.0.1":"2022-10-10T09:58:50.645Z","0.0.2":"2022-12-05T10:44:36.542Z","0.0.3":"2025-08-08T04:36:16.632Z"},"bugs":{"url":"https://github.com/rowanwins/maplibregl-mapbox-request-transformer/issues"},"author":{"name":"Rowan Winsemius"},"license":"MIT","homepage":"https://github.com/rowanwins/maplibregl-mapbox-request-transformer#readme","keywords":["mapbox","mapbox-gl","mapbox-gl-js","maplibre","maplibre-gl","maplibre-gl-js","react-map-gl","react"],"repository":{"type":"git","url":"git+https://github.com/rowanwins/maplibregl-mapbox-request-transformer.git"},"description":"Transform mapbox:// urls in MapboxGL Styles for use in MapLibreGL.","maintainers":[{"name":"rowanwins","email":"rowanwins@yahoo.com.au"}],"readme":"This library provides a request transforming function enabling the consumption of MapboxGL Styles in MapLibreGL.\n\nBy default Mapbox styles are referenced by, and include others to mapbox URLs such as `mapbox://styles/mapbox/satellite-streets-v11`, however MapLibreGL, since version 2, does not know how to handle these references. This library parsers the mapbox URL and converts into a valid http urls usable by MapLibreGL.\n\nAlso compatible with react-map-gl.\n\n## Install\n````\nnpm install maplibregl-mapbox-request-transformer --save\n````\n\n## Usage\n### For v12 mapbox styles\nFor v12 styles you can either use the built in style transformer\n````\nimport {\n  isMapboxURL,\n  transformMapboxUrl,\n  transformMapboxStyle\n} from 'maplibregl-mapbox-request-transformer'\n\nconst mapboxKey = 'pk.123'\n\nconst transformRequest = (url: string, resourceType: string) => {\n  if (isMapboxURL(url)) {\n    return transformMapboxUrl(url, resourceType, mapboxKey)\n  }\n    return {url}\n}\n\nvar map = new maplibregl.Map({\n  container: 'map',\n  center: [-122.420679, 37.772537],\n  zoom: 13,\n  transformRequest\n});\n\n// For V12 Styles you'll also need to add\nmap.setStyle('mapbox://styles/mapbox/streets-v12', {\n   transformStyle: transformMapboxStyle\n})\n````\nOr pass you can pass in `validateStyle: false` to the map options\n````\nimport {\n  isMapboxURL,\n  transformMapboxUrl\n} from 'maplibregl-mapbox-request-transformer'\n\nconst mapboxKey = 'pk.123'\n\nconst transformRequest = (url: string, resourceType: string) => {\n  if (isMapboxURL(url)) {\n    return transformMapboxUrl(url, resourceType, mapboxKey)\n  }\n    return {url}\n}\n\nvar map = new maplibregl.Map({\n  container: 'map',\n  center: [-122.420679, 37.772537],\n  zoom: 13,\n  style: 'mapbox://styles/mapbox/streets-v12'\n  transformRequest,\n  validateStyle: false,\n});\n\n````\n\n### For < v12 mapbox styles\n````\nimport { isMapboxURL, transformMapboxUrl } from 'maplibregl-mapbox-request-transformer'\n\nconst mapboxKey = 'pk.123'\n\nconst transformRequest = (url: string, resourceType: string) => {\n  if (isMapboxURL(url)) {\n    return transformMapboxUrl(url, resourceType, mapboxKey)\n  }\n  return {url}\n}\n\nvar map = new maplibregl.Map({\n  container: 'map',\n  center: [-122.420679, 37.772537],\n  zoom: 13,\n  style: 'mapbox://styles/mapbox/streets-v11'\n  transformRequest\n});\n\n````\n\n## Notes on Mapbox Pricing\nWhen upgrading from MapLibre v1 to >= v2 or react-map-gl, and using this transformer, be advised that Mapbox bills tile requests using their Vector Tiles API requests. A standard Mapbox GL JS application is billed using the Map Loads API, which includes unlimited Vector Tiles API requests ([see pricing docs](https://docs.mapbox.com/mapbox-gl-js/guides/pricing/)). This billing difference could make hosting an often-visited map more expensive. As of Feb 2023 Mapbox offers 200,000 monthly tile requests on their free tier (see their [pricing page](https://www.mapbox.com/pricing#vector-tiles-api) for current details).\n\n## Acknowledgements\nThis code was mostly taken and adpted from [here](https://github.com/maplibre/maplibre-gl-js/blob/04ff47d53ec16e17b92475fe9028c1477f6df02f/src/util/mapbox.ts).\n","readmeFilename":"README.md"}