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

wind-layer

v0.1.2

Published

a openlayers ol bmap amap maptalks extension to windjs

Downloads

75

Readme

wind-layer

a openlayers | bmap | amap | maptalks extension to windjs

示例:openlayers | ol6.x | bmap | amap | maptalks

Build Status NPM downloads JS gzip size Npm package GitHub stars GitHub license FOSSA Status

下载

git clone https://github.com/sakitam-fdd/wind-layer.git
npm install
npm run dev
npm run build

安装

npm安装

npm install wind-layer --save
import windLayer from 'wind-layer'

// 分模块
import {
  AMapWind, // amap
  BMapWind, // bmap
  OlWind // openlayers
} from 'wind-layer'

// ol5
import OlWindy from 'wind-layer/dist/OlWindy.js'
import OlWindy from 'wind-layer/dist/OlWindy.esm.js'

// ol6
import OlWindy from 'wind-layer/dist/Ol6Windy.js'
import OlWindy from 'wind-layer/dist/Ol6Windy.esm.js'

// maptalks
import MaptalksWindy from 'wind-layer/dist/MaptalksWindy.js'
import MaptalksWindy from 'wind-layer/dist/MaptalksWindy.esm.js'

cdn

目前可通过 unpkg.com / jsdelivr 获取最新版本的资源。

# jsdelivr (jsdelivr由于缓存原因最好锁定版本号,否则可能会出现意料之外的问题)
https://cdn.jsdelivr.net/npm/[email protected]/dist/windLayer.js
https://cdn.jsdelivr.net/npm/[email protected]/dist/windLayer.min.js
# npm
https://unpkg.com/wind-layer/dist/windLayer.js
https://unpkg.com/wind-layer/dist/windLayer.min.js

# 分模块
https://cdn.jsdelivr.net/npm/[email protected]/dist/AMapWind.js // amap
https://cdn.jsdelivr.net/npm/[email protected]/dist/BMapWind.js // bmap
https://cdn.jsdelivr.net/npm/[email protected]/dist/OlWind.js // openlayers
https://cdn.jsdelivr.net/npm/[email protected]/dist/MaptalksWindy.js // maptalks

示例

文档

点击查看示例

如何获取数据

天气数据由全球预报系统(GFS)生成, 由美国国家气象局管理。 预测每天产生四次,并可用于 从NOMADS下载。 这些文件位于GRIB2 格式并包含超过300条记录。 我们只需要这些记录中的一小部分就可以在特定的等压线上可视化风资料。 下面的命令下载 1000 hPa风向量,并使用grib2json将它们转换为JSON格式。

YYYYMMDD=<a date, for example: 20140101>
curl "http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs.pl?file=gfs.t00z.pgrb2.1p00.f000&lev_10_m_above_ground=on&var_UGRD=on&var_VGRD=on&dir=%2Fgfs.${YYYYMMDD}00" -o gfs.t00z.pgrb2.1p00.f000
grib2json -d -n -o current-wind-surface-level-gfs-1.0.json gfs.t00z.pgrb2.1p00.f000
cp current-wind-surface-level-gfs-1.0.json <earth-git-repository>/public/data/weather/current

使用node服务获取数据

默认运行在3000端口, 使用koa2构建。 目前仅抓取少量数据, 全部数据数据量过大会造成抓取时间过长和转换失败。

npm run start // 调试环境启动服务
npm run prd:server // 部署环境启动服务

目前共暴露7个接口

| url | params | desc | | :--- | :--- | :---------- | | autofetch | null | 无需参数,开启自动抓取程序,默认30分钟抓取一次数据源 | | stopautofetch | null | 停止自动抓取程序 | | getdata | Object (目前只支持time 参数,时间戳) | 获取json数据,存在转换过的直接返回,若只存在元数据则转换后返回,若元数据也不存在则抓取转换后再响应 | | gribdata | Object (目前只支持time 参数,时间戳) | 获取grib2数据(强制抓取数据) | | getSourceTree | null | 无需参数,获取抓取的数据源 grib2 源数据。返回一个list,包含文件名和服务器地址。 | | getParseTree | null | 无需参数,获取转换后的 json 数据。返回一个list,包含文件名和服务器地址。 | | getDataByFileName | { filename } | 通过文件名请求 json 数据,文件名可为源数据文件和json文件名 |

使用Docker

简单运行

如果想简单的运行一下看看,可以执行这个命令:

docker run -d -p 8080:3333 sakitamclone/wind-server:0.0.1

启动后就可以通过主机的 8080 端口看到运行结果了,比如用的是本机 Docker 的话,访问:http://localhost:8080 即可。

测试结束后,彻底清除容器可以用命令:

docker rm -fv <容器ID>

这样可以停止、删除容器,并清除数据。

使用 DockerCompose

新建文件 docker-compose.yml, 内容如下:

version: '3'

services:
  wind-server:
    image: sakitamclone/wind-server:latest
    build:
      context: ./
      args:
        NODE_ENV: development
    hostname: wind-server
    environment:
      - CORS_ORIGIN=****
    ports:
      - "8080:3333"

volumes:
  yarn:

然后使用命令 docker-compose up -d 来启动,停止服务使用 docker-compose down。

Resources

  • https://github.com/cambecc/earth
  • http://earth.nullschool.net
  • https://github.com/Esri/wind-js
  • https://github.com/danwild/wind-js-leaflet

License

FOSSA Status