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 🙏

© 2026 – Pkg Stats / Ryan Hefner

radar-w-fast

v1.0.2

Published

* 目前只支持 `CR` 文件类型, 文档简陋, 后续完善

Readme

雷达 bin 文件解析绘图程序

  • 目前只支持 CR 文件类型, 文档简陋, 后续完善

更新说明

  • v1.0.0: 初始版本, 当前只支持 CR 文件类型
    • v1.0.1:
      • 修改了CRParse中的 drawCanvas方法. 现在它额外接收一个参数用来控制格子大小和图片绘制范围
      • CRParse 中新增了一个 drawGrayCanvas(drawParams: DrawParams) 方法, 用来绘制灰度图, 这个方法不受色标的影响, 只根据数据值的大小来绘制灰度图, 适合用来调试数据和色标的关系
    • v1.0.2:
      • 增加了产品类型是 54的解析器, 他也是 CR 文件类型

使用

  1. 安装这个库
npm i radar-w-fast
  1. 使用示例
<script lang="ts" setup>
import { ref } from 'vue'
import RadarReader from 'radar-w-fast'
import file from 'xxx.bin?url' // 这里是你的bin文件路径

const minRef = ref()
const maxRef = ref()
const init = async () => {
    const radar = new RadarReader(file)
    await radar.start() // start() 方法用来解析基本信息, 不包括产品数据
    
    // 如果需要自行注册其他解析器传入一个Map对象即可
    // const map = new Map()
    // map.set(18, YourParser) // 18是CR文件的类型
    // radar.registryParser(map)
    
    await radar.parse() // parse() 是根据注册的解析器和产品类型来解析的, 每个产品是不一样的解析器,也是不同的结果

    const legend = await radar.getDefaultLegend() // 获取默认的色标, 当然你也可以自己定义色标
    let color: string[] = []
    let level: number[] = []
    if (legend) {
        color = legend.colors
        level = legend.levels
    }

    const station = radar.stationInfo   // stationInfo 是站点基本信息, 需要使用其中的经纬度信息, (是所有数据的中心点)
    if (!station) return

    if (radar.radarBaseInfo?.productParams) {   // 这里是产品参数段, 在 `parse()`之后生成
        // - const canvas = radar.drawCanvas(radar.radarBaseInfo?.productParams, level, color)
        const canvas = radar.drawCanvas(radar.radarBaseInfo?.productParams, level, color, {
            size: 4, //格子大小
            min: minRef.value,
            max: maxRef.value
        })
        const bounds = radar.getBounds() // 获取数据的边界范围, 需要配合地图使用 (leaflet为基准), AMap中使用的是[lng,lat]的格式, leaflet中使用的是[lat,lng]的格式, 注意区分
        // 叠加到地图上
        // leaflet为例: 
        // L.imageOverlay(canvas.toDataURL(), bounds).addTo(map)
        
        // AMap为例: 
        // new AMap.ImageLayer({
        //   url: canvas.toDataURL('image/png'),
        //   bounds: [bounds[0][1], bounds[0][0], bounds[1][1], bounds[1][0]],
        // })
    }
}
</script>

@author: wangrl

维护随缘