Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
bmap-geojson
Advanced tools
Readme
基于百度地图生成geojson
百度地图
传统引入方式:
<script src="http://api.map.baidu.com/getscript?v=3.0&ak=KAYsf1crZqV9xgyWEzsGpaVzvobclAmu&t=1"></script>
<script src="thirdparty/bmap/bmap-geojson.js"></script>
ES6引入方式
注意,在引用的时候就要确保百度地图已经被加载了。
npm install BmapGeo
import * as BmapGeo from 'bmap-geojson'
var geo = new BmapGeo(map, geojson, BMap)
name | type | require | description |
---|---|---|---|
map | mapobject | true | 当前地图对象 |
geojson | jsonobject | false | 显示已经绘制完成的geojson |
var map = new BMap.Map('container')
map.centerAndZoom("北京", 12)
map.enableScrollWheelZoom(true)
var geo = new BmapGeo(map)
geo.showControl() // 显示内置控制图标
geo.on('add', function (type, result) { // 元素被添加触发事件
console.log(result)
})
geo.on('delete', function (type, result) { // 元素被删除触发事件
console.log(result)
})
显示内置绘制控件,目前内置了绘制区域polygon
控件和绘制坐标点point
控件
开始绘制
Parameters
name | Type | Default | description |
---|---|---|---|
open | type | 1 | 绘制的模式,1表示绘制区域polygon,2表示绘制坐标点point。在不调用showControl()时,可以使用这个方法实现自定义绘制控件。 |
清除使用后生成的数据,便于重新使用。
结束绘制
eventName | description |
---|---|
add | 元素被添加触发事件 |
delete | 元素被删除触发事件 |
change | 元素属性被修改触发,目前只修改name属性 |
FAQs
基于百度地图生成geojson
We found that bmap-geojson demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.