{"id":19013396,"url":"https://github.com/z41z/sp-bmap","last_synced_at":"2025-11-10T17:30:51.035Z","repository":{"id":39779385,"uuid":"160755628","full_name":"z41z/sp-bmap","owner":"z41z","description":"Common Map functions based on Baidu Map","archived":false,"fork":false,"pushed_at":"2023-01-04T19:10:24.000Z","size":884,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-01T22:13:25.505Z","etag":null,"topics":["baidumap","bmap","map"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/z41z.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":"2018-12-07T01:45:21.000Z","updated_at":"2019-10-16T06:23:58.000Z","dependencies_parsed_at":"2023-02-02T20:15:29.513Z","dependency_job_id":null,"html_url":"https://github.com/z41z/sp-bmap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z41z%2Fsp-bmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z41z%2Fsp-bmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z41z%2Fsp-bmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z41z%2Fsp-bmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/z41z","download_url":"https://codeload.github.com/z41z/sp-bmap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240051442,"owners_count":19740346,"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":["baidumap","bmap","map"],"created_at":"2024-11-08T19:23:51.269Z","updated_at":"2025-11-10T17:30:51.006Z","avatar_url":"https://github.com/z41z.png","language":"JavaScript","readme":"# sp-map\n\nCommon Map methods\n\n## Usage\n\n- ### init\n\n- ### CDN\n\n``` html\n  \u003c!DOCTYPE html\u003e\n  \u003chtml lang=en\u003e\n  \u003chead\u003e\n    \u003cmeta charset=UTF-8\u003e\n    \u003cmeta name=viewport content=\"width=device-width,initial-scale=1\"\u003e\n    \u003cmeta http-equiv=X-UA-Compatible content=\"ie=edge\"\u003e\n    \u003ctitle\u003esp-bmap\u003c/title\u003e\n    \u003cstyle\u003e\n      #map {\n        width: 100vw;\n        height: 100vh;\n      }\n    \u003c/style\u003e\n  \u003c/head\u003e\n\n  \u003cbody\u003e\n    \u003cdiv id=map\u003e\u003c/div\u003e\n    \u003cscript src=\"http://api.map.baidu.com/api?v=2.0\u0026ak=DzQo095C0bFagPhpWFXS9aEcIqI0DGfG\"\u003e\u003c/script\u003e\n    \u003cscript\u003e\n    \u003cscript src=\"https://unpkg.com/sp-bmap/dist/index.min.js\"\u003e\u003c/script\u003e\n      window.onload = function () {\n        var map = __Map.map.init(\"map\");\n      }\n    \u003c/script\u003e\n  \u003c/body\u003e\n\n  \u003c/html\u003e\n```\n\n- ### NPM\n\n  ``` node\n  npm i sp-bmap //or yarn add sp-bmap\n  ```\n\n  ``` js\n\n  let __Map = require(\"sp-bmap\");\n  ```\n\n- ### map\n\n  - init(elementId, [lng = 0, lat =0, zoomLevel = 3])\n\n  ``` js\n   __Map.map.init(\"map\", lng, lat, zoomLevel);\n  ```\n\n  - center([point = (lng = 0, lat = 0)])\n\n  ``` js\n  let point = __Map.point(lng, lat);\n   __Map.map.center(point);\n  ```\n\n  - zoom([zoomLevel = 3])\n\n  ``` js\n  __Map.map.zoom(12);\n  ```\n\n  - scroll([isScroll = true])\n\n  ```js\n  __Map.map.scroll(false);\n  ```\n\n  - moveTo(lng, lat)\n\n  ```js\n  __Map.map.moveTo(106, 26);\n  ```\n\n- ### point([lng = 0, lat = 0])\n\n  ``` js\n  __Map.point(lng, lat);\n  ```\n\n- ### polygon\n\n- #### egg(radius, [level = 1, lng = 0, lat = 0, options = {}, rotateDegree = 0])\n\n``` js\n      let map = __Map.map.init(\"map\", 110, 30, 16)\n      let marker = new BMap.Marker(__Map.point(104.075277, 30.548096))\n      map.addOverlay(marker)\n\n      let polygonOptions = {\n        fillColor: '#f00',\n        fillOpacity: .3,\n        strokeWeight: 1,\n        strokeOpacity: .3\n      }\n      let radius = [100, 300, 800]\n      radius.forEach(r=\u003e{\n        let egg = __Map.polygon.egg(r, 1, 104.075277, 30.548096, polygonOptions)\n        map.addOverlay(egg);\n      })\n```\n\n![egg](./static/polygon_egg.png)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz41z%2Fsp-bmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fz41z%2Fsp-bmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz41z%2Fsp-bmap/lists"}