{"id":13675255,"url":"https://github.com/maptalks/maptalks.mapboxgl","last_synced_at":"2025-04-12T00:10:03.214Z","repository":{"id":50731381,"uuid":"86569384","full_name":"maptalks/maptalks.mapboxgl","owner":"maptalks","description":"MapboxglLayer for maptalks.js","archived":false,"fork":false,"pushed_at":"2022-11-09T14:32:44.000Z","size":118,"stargazers_count":59,"open_issues_count":10,"forks_count":24,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-31T03:27:56.687Z","etag":null,"topics":["mapbox","mapbox-gl","mapbox-gl-js","maptalks","maptalks-layer","maptalks-plugins"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maptalks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-29T10:31:18.000Z","updated_at":"2025-01-30T18:41:00.000Z","dependencies_parsed_at":"2023-01-22T10:15:53.795Z","dependency_job_id":null,"html_url":"https://github.com/maptalks/maptalks.mapboxgl","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maptalks%2Fmaptalks.mapboxgl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maptalks%2Fmaptalks.mapboxgl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maptalks%2Fmaptalks.mapboxgl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maptalks%2Fmaptalks.mapboxgl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maptalks","download_url":"https://codeload.github.com/maptalks/maptalks.mapboxgl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237111680,"owners_count":19257389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mapbox","mapbox-gl","mapbox-gl-js","maptalks","maptalks-layer","maptalks-plugins"],"created_at":"2024-08-02T12:00:36.938Z","updated_at":"2025-02-04T12:05:08.347Z","avatar_url":"https://github.com/maptalks.png","language":"JavaScript","readme":"# maptalks.mapboxgl\n\n[![NPM Version](https://img.shields.io/npm/v/maptalks.mapboxgl.svg)](https://github.com/maptalks/maptalks.mapboxgl)\n\nA plugin to add [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js) as a layer for [maptalks.js](https://github.com/maptalks/maptalks.js).\n\n![screenshot](https://cloud.githubusercontent.com/assets/13678919/25611501/ec90d0a4-2f59-11e7-91b5-1ed6c7b9352d.jpg)\n\n## Tips\n\n**This is just a temporary solution for vector tilelayer**\n\n**The webgl context of maptalks and the webgl context of mapboxgl will not be shared**\n\nPlease familiarize yourself with the above when you use the plugin, and it is recommended to use the webgl ecology library from maptalks [maptalks-gl-layers](https://github.com/fuzhenn/maptalks-gl-layers)\n\n## Examples\n\n* [mapbox-gl-js demo with light style](https://maptalks.github.io/maptalks.mapboxgl/demo/).\n\n## Install\n  \n* Install with npm: ```npm install maptalks.mapboxgl```. \n* Download from [dist directory](https://github.com/maptalks/maptalks.mapboxgl/tree/gh-pages/dist).\n* Use unpkg CDN: ```https://unpkg.com/maptalks.mapboxgl/dist/maptalks.mapboxgl.min.js```\n\n## Usage\n\nAs a plugin, `maptalks.mapboxgl` must be loaded after `maptalks.js` and `mapbox-gl.js` in browsers.\n```html\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/maptalks/dist/maptalks.min.js\"\u003e\u003c/script\u003e\n\u003cscript src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.36.0/mapbox-gl.js'\u003e\u003c/script\u003e\n\u003clink href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.36.0/mapbox-gl.css' rel='stylesheet' /\u003e\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/maptalks.mapboxgl/dist/maptalks.mapboxgl.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nvar mapboxglLayer = new maptalks.MapboxglLayer('tile',{\n        glOptions : {\n            'style' : 'mapbox://styles/mapbox/light-v9'\n        }\n    }).addTo(map);\n\u003c/script\u003e\n```\n\n## Supported Browsers\n\nIE 11, Chrome, Firefox, other modern and mobile browsers support WebGL.\n\n## API Reference\n\n```MapboxglLayer``` is a subclass of [maptalks.Layer](https://maptalks.github.io/docs/api/Layer.html) and inherits all the methods of its parent.\n\n### `Constructor`\n\n```javascript\nnew maptalks.MapboxglLayer(id, options)\n```\n\n* id **String** layer id\n* options **Object** options\n    * glOptions **Object** mapboxgl creation options defined in [mapbox-gl-js api doc](https://www.mapbox.com/mapbox-gl-js/api/#map)\n    * other options defined in [maptalks.Layer](https://maptalks.github.io/docs/api/Layer.html)\n\n### `getGlMap()`\n\nget mapbox-gl-js map instance used by the layer\n\n**Returns** `Map`\n\n### `toJSON()`\n\nexport the layer's JSON.\n\n```javascript\nvar json = mapboxglLayer.toJSON();\n```\n\n**Returns** `Object`\n\n## Contributing\n\nWe welcome any kind of contributions including issue reportings, pull requests, documentation corrections, feature requests and any other helps.\n\n## Develop\n\nThe only source file is ```index.js```.\n\nIt is written in ES6, transpiled by [babel](https://babeljs.io/) and tested with [mocha](https://mochajs.org) and [expect.js](https://github.com/Automattic/expect.js).\n\n### Scripts\n\n* Install dependencies\n```shell\n$ npm install\n```\n\n* Watch source changes and generate runnable bundle repeatedly\n```shell\n$ gulp watch\n```\n\n* Tests\n```shell\n$ npm test\n```\n\n* Watch source changes and run tests repeatedly\n```shell\n$ gulp tdd\n```\n\n* Package and generate minified bundles to dist directory\n```shell\n$ gulp minify\n```\n\n* Lint\n```shell\n$ npm run lint\n```\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaptalks%2Fmaptalks.mapboxgl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaptalks%2Fmaptalks.mapboxgl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaptalks%2Fmaptalks.mapboxgl/lists"}