npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zlmap

v1.4.3

Published

```js import zmap from 'zmap' export default{ components:{ zmap }, data(){ return { toolList: ['select', 'polygon', 'ruler', 'transfer'], // 工具栏,可选 widgets: ['home', 'zoom', 'compass', 'fullscre

Downloads

10

Readme

import zmap from 'zmap'
export default{
  components:{
    zmap
  },
  data(){
    return {
      toolList: ['select', 'polygon', 'ruler', 'transfer'],                           // 工具栏,可选
      widgets: ['home', 'zoom', 'compass', 'fullscreen', 'navigation', 'scalebar'],   // 小部件,可选
      showSearch: true,
      showBaseMapToggle: true,  // 是否显示底图切换工具,可选
      showLonLat: true,          // 是否显示经纬度,可选
      showRegion: true,   // 是否显示行政区划 
      arcgisDojoUrl: 'https://arcgis.ynyc.com/arcgis_js_api/library/4.15/dojo/dojo.js',  // dojo初始化地址,可选
      arcgisCssUrl: 'https://arcgis.ynyc.com/arcgis_js_api/library/4.15/esri/themes/light/main.css', // 可选
      zoom: 7, // 缩放级别
      center: [101.9464253310309, 24.913562152358953], // 初始位置
      showCopyRight: true, // 是否显示天地图的图标
      showPopup: true, // 是否显示弹窗, 见landMixin.js
      containerId: 'dk', // 容器id
      showPickupLonLat: true, // 是否显示坐标拾取
    }
  }
}
<div class="wrapper">
    <zmap :toolList="toolList"
          :widgets="widgets"
          :showBaseMapToggle="showBaseMapToggle"
          :showLonLat="showLonLat"
          :arcgisDojoUrl="arcgisDojoUrl"
          :arcgisCssUrl="arcgisCssUrl"
          :containerId="containerId"
          :show-pickup-lon-lat="showPickupLonLat"
    />
</div>

容器需要指定宽高

.wrapper{
  width: 500px;
  height: 500px;
}

事件总线
mapLoaded: 地图加载完成,返回参数arcgis, view
mapViewChange: 底图切换,返回参数view

组件方法
registerLayers: 通过该方法注册的图层具有和地库地块图层一致的行为,见layerMixin.js。

const Layers = [{
  id: '图层id',
  index: '图层顺序',
  minScale: '最小显示比例',
  fields: '属性字段',
  idField: '主键字段',
  renderer: '渲染器对象',
  getFeatures: '获取列表',
  handleFeatures: '处理接口返回数据的函数',
  gridSize: 0.5,  // 网格跨度,经纬度
  renderFeaturesComplete: '渲染完成回调',
  searchOptions:{
    name: '地块定位',
    placeholder: '地块ID',
    searchFields: ['objectId'],
    displayField: 'objectId',
    // 正则匹配
    regExp: /^[a-z|0-9]{8}-[a-z|0-9]{4}-[a-z|0-9]{4}-[a-z|0-9]{4}-[a-z|0-9]{12}$/,
    // 搜索方法
    searchMethod: (layer, value)=>{}
  },
  // 图层点击事件
  onClick: (graphic, evt)=>{},
  // 范围限定
  extent: {
    xmin: '',
    xmax: '',
    ymin: '',
    ymax: ''
  }
}];
export default {
  mounted() {
    this.$EventBus.$on('mapLoaded', ()=>{
      this.$refs.zmap.registerLayers(Layers)
    })
  }
}

renderFeatures 渲染接口返回的数据方法。

this.$refs.zmap.renderFeatures({
  // 新增的Features
  inserts: [],
  // 需要删除的Features
  deletions: [],
  // 需要更新的Features
  updates: []
})