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

maploader

v0.0.1

Published

A tiny library to help load shsmi JSAPI for JavaScript modules in non-Dojo applications

Downloads

1

Readme

smap-shsmi-loader

是上海市测绘院地图 JSAPI 的加载器,通过该JSAPI加载器实现上海测绘院地图数据加载显示(仅限上海市政务网可用)

该加载器具有以下特性: 支持以 普通JS 和 npm包 两种方式使用; 有效避免错误异步加载导致的 JSAPI 资源加载不完整问题; 支持指定 JSAPI 版本; 允许多次执行加载操作,网络资源不会重复请求,便于大型工程模块管理

注意

地图控件仍在开发中

使用

以普通 JS 方式使用 Loader

使用新版本4X JSAPI 3D地图

 <script src="http://10.108.3.16/smi/shsmi/loader/loader.min.js"></script>
 <script>
   MapLoader.load(["smi/SMap"]).then(([SMap]) => {
     const smap=new SMap('mapcontainer',{
        viewMode: '3D',
        center: [0, 0],
        zoom: 8,
        zooms: [1, 9],
        pitch: 75
     },function(map){ console.log(map) });
   })
 </script>

Image text

使用新版本4X JSAPI 2D地图

 <script src="http://10.108.3.16/smi/shsmi/loader/loader.min.js"></script>

 MapLoader.load(['smi/SMap']).then(([SMap]) => {
  const smap = new SMap('container', { 
     center: [0, 0],
     zoom: 1,
     zooms: [1, 9],
     rotateEnable: trues
  }, function(map) {
    console.log(map)
  })
})

Image text

使用老版本3X JSAPI 2D地图

  <script src="http://10.108.3.16/smi/shsmi/loader/loader.min.js"></script>
  <script>
    MapLoader.load(["smi/SMap"],{version:'3.32',css:true}).then(([SMap]) => {
      const smap = new SMap('mapcontainer',{
         center: [0, 0],
         zoom: 5,
         zooms: [1, 9],
         keyboardEnable: true, //是否可以键盘导航
         doubleClickZoom: true,//是否双击缩放
         dragEnable: true,     //是否地图拖拽
         zoomEnable: true,     //是否可以缩放
         mapNavigation: true   //是否可以地图导航
      },function(map){
              console.log(map)
          });
    })
  </script>

Image text

以 NPM 包方式使用 Loader

安装

npm install smap-shsmi-loader --save

使用新版本4X JSAPI 3D地图

 import MapLoader from 'smap-shsmi-loader'

 MapLoader.load(['smi/SMap']).then(([SMap]) => {
  const smap = new SMap('container', { 
     viewMode: '3D'
     center: [0, 0],
     zoom: 8,
     zooms: [1, 9],
     pitch: 75
    }, function(map) {
     console.log(map)
  })
})

使用新版本4X JSAPI 2D地图

 import MapLoader from 'smap-shsmi-loader'

 MapLoader.load(['smi/SMap']).then(([SMap]) => {
  const smap = new SMap('container', {
    center: [0, 0],
    zoom: 1,
    zooms: [1, 9],
    rotateEnable: true
  }, function(map) {
    console.log(map)
  })
})

使用老版本3X JSAPI 2D地图

 import MapLoader from 'smap-shsmi-loader'

 MapLoader.load(['smi/SMap'], { version: '3.32', css: true }).then(([SMap]) => {
  const smap = new SMap('container', {
     center: [0, 0],
     zoom: 5,
     zooms: [1, 9],
     keyboardEnable: true, //是否可以键盘导航
     doubleClickZoom: true,//是否双击缩放
     dragEnable: true,     //是否地图拖拽
     zoomEnable: true,     //是否可以缩放
     mapNavigation: true   //是否可以地图导航
  }, function(map) {
    console.log(map)
  })
})

自定义API和地图控件包地址

4X API

    dojoConfig = {
     async: true,
     packages: [{
       location: 'http://10.108.3.16/smi/4x',
       name: 'smi'
     }],
     deps: ['@dojo/framework/shim/main'],
     has: {
       'esri-promise-compatibility': 1,
       'esri-featurelayer-webgl': 1
     }
   }

    MapLoader.load(["smi/SMap"], {
      url: 'http://10.108.3.16/smiapi/arcgis/4.15/init.js',
      css: 'http://10.108.3.16/smiapi/arcgis/4.15/esri/themes/light/main.css',
      dojoConfig: dojoConfig
  }).then(([SMap]) => {
     const smap = new SMap('mapcontainer', {
          viewMode: '3D',
          center: [0, 0],
          zoom: 1,
          zooms: [1, 9],
          rotateEnable: true
      }, function (map) {});
  })

3X API

 dojoConfig = {
  async: true,
  packages: [{
    location: 'http://10.108.3.16/smi/3x', 
    name: 'smi'
  }]
 };

   MapLoader.load(["smi/SMap"], {
     url: 'http://10.108.3.16/smiapi/arcgis/3.32/init.js',
     css: 'http://10.108.3.16/smiapi/arcgis/3.32/esri/css/esri.css',
     dojoConfig: dojoConfig
 }).then(([SMap]) => {
    const smap = new SMap('mapcontainer', {
      center: [0, 0],
      zoom: 5,
      zooms: [1, 9],
      keyboardEnable: true, //是否可以键盘导航
      doubleClickZoom: true,//是否双击缩放
      dragEnable: true,     //是否地图拖拽
      zoomEnable: true,     //是否可以缩放
      mapNavigation: true   //是否可以地图导航
    }, function (map) {});
 })

技术支持

                           QQ号: 314984468 

Image text

                           微信号:ioioya 

Image text