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

intest-openlayers

v1.1.4

Published

基于openlayers加载地图

Downloads

7

Readme

intest-openlayers

install

npm install intest-openlayers

文档完善中..

  • 在main.js中初始化
import intestMap  from 'intest-openlayers'
Vue.use(intestMap)
const defaultOptions = {
  vid:vid,
  layersOpts:[{
    name: "TileLayer_"+vid,
    //type:"TileLayer", 根据source.params.TILED的状态判断
    extent: transformExtent(
      [
        "116.51730104853488",
        "39.790733740927706",
        "116.52315047535953",
        "39.795646559880254"
      ],
      "EPSG:4326",
      "EPSG:3857"
    ),
    source:{
      url: "http://192.168.1.34:8024/geoserver/wms", //地图服务地址,需要赋值给OpenLayers中layer的source的url。
      params: {
        LAYERS: "BJEV_test01", //layers=tiger-ny:图层名,需要赋值给layer的source的params. LAYERS属性。
        TILED: true
      },
      serverType: "geoserver"
    }
  }],
  viewOpts:{
    center: fromLonLat([116.51912, 39.79253]), //中心点 使用fromLonLat 方法转换成google的摩卡托坐标
    zoom: 18, //视图默认显示的缩放等级
    minZoom: 17, //视图最小缩放等级,
    multiWorld: false,
    constrainResolution: true,
    constrainRotation: 4
    // extent:transformExtent(['116.51730104853488','39.790733740927706','116.52315047535953','39.795646559880254'], 'EPSG:4326', 'EPSG:3857'),
  },
  minzoom:17,
  zoom:17,
  center:fromLonLat([116.51912, 39.79253]),
}
intestMap.initMapOptions(defaultOptions)
  • demo
<template>
  <imap>
    <!-- imap-marker点击之后显示infowindow并重新设置位置 -->
    <imap-marker @markerClick="handleClick" :position="markerposition" />
    <!-- imap-marker点击之后移除 -->
    <imap-marker @markerClick="handleRemove" :position="[116.51912, 39.79473]" />
    <!--  创建5000个marker测试 -->
    <!--  <imap-marker  v-for="(marker,index) in this.markers" :key="index" :position="marker.position" /> -->
    <!-- 直线 -->
    <imap-line
      :points="[[116.51912, 39.79273],[116.51912, 39.79473]]"
      :color="'#198A23'"
      @lineClick="handlelineclick"
    />
    <!-- 根据经纬度坐标数组生成折线 -->
    <imap-line :points="points" @lineClick="handlelineclick" :color="'#998A23'" />
    <!-- 绑定是否显示属性visible的infowindow -->
    <imap-infowindow :contentTxt="content" :position="infoposition" :visible="visible" />
    <!-- 创建infowindow -->
    <imap-infowindow :contentTxt="content" :position="[116.51912, 39.79473]" />
    <!-- 根据点数据生成多边形 -->
    <imap-polygon :points="polygonpoints" @polygonClick="polygonClick" />
    <!-- 根据点数据生成圆 -->
    <imap-circle :radius="radius" :center="center" @circleClick="circleClick" />
  </imap>
</template>

<script>
export default {
  name: "app",
  data() {
    return {
      markers: [],
      radius: 80,
      content: "<p>信息框在这里</p>",
      markerposition: [116.51912, 39.79273],
      infoposition: [116.51912, 39.79273],
      visible: false,
      center: [116.51912, 39.79273],
      points: [
        [116.51912, 39.79273],
        [116.51912, 39.79373],
        [116.51812, 39.79273],
        [116.51812, 39.79473],
        [116.51712, 39.79473],
        [116.51912, 39.79273],
      ],
      polygonpoints: [
        [116.51912, 39.79273],
        [116.51912, 39.79373],
        [116.51812, 39.79273],
        [116.51812, 39.79473],
        [116.51712, 39.79473],
        [116.51912, 39.79273],
      ],
    };
  },
  created() {
    let basePosition = [116.51912, 39.79273];
    for (let i = 0; i < 5000; i++) {
      this.markers.push({
        position: [basePosition[0], basePosition[1] + i * 0.0003],
      });
    }
  },
  methods: {
    //点击之后移除对应marker
    handleRemove(e) {
      e.source.removeFeature(e.marker);
    },
    //点击之后移除对应line
    handlelineclick(e) {
      e.source.removeFeature(e.line);
    },
    polygonClick(e) {
      e.source.removeFeature(e.polygon);
    },
    circleClick(e) {
      this.radius = Math.random() * 100;
      this.center = [
        116.51912 + Math.random() * 0.0009,
        39.79473 + Math.random() * 0.0005,
      ];
      e.source.removeFeature(e.circle);
    },
    handleClick(e) {
      this.visible = false;
      this.markerposition = [
        116.51912 + Math.random() * 0.0001,
        39.79473 + Math.random() * 0.0001,
      ];

      this.content = "当前点所在位置为" + this.markerposition;
      this.infoposition = this.markerposition;
      this.points = [];
      for (let i = 0; i < 5; i++) {
        this.points.push([
          116.51912 + Math.random() * 0.0009,
          39.79473 + Math.random() * 0.0005,
        ]);
      }
    },
  },
};
</script>

<style>
html,
body {
  height: 100%;
}
#app {
  min-height: calc(100vh - 50px);
  width: 100%;
}
</style>