
Research
/Security News
OpenAPI React Query Codegen Compromised in Mini Shai-Hulud npm Supply Chain Attack
Ten malicious OpenAPI React Query Codegen versions were published to npm in the Mini Shai-Hulud attack, all with valid provenance.
my-openlayer
Advanced tools
my-openlayer 是一个基于 [OpenLayers](https://openlayers.org/) 的现代地图组件库,专为 Web GIS 应用开发者设计。提供完整的 TypeScript 支持、模块化的类型定义、强大的错误处理和事件管理系统,支持天地图底图加载、要素绘制、图层管理、事件监听等丰富功能,极大提升地图开发效率。
my-openlayer 是一个基于 OpenLayers 的现代地图组件库,专为 Web GIS 应用开发者设计。提供完整的 TypeScript 支持、模块化的类型定义、强大的错误处理和事件管理系统,支持天地图底图加载、要素绘制、图层管理、事件监听等丰富功能,极大提升地图开发效率。
my-openlayer🗺️ 底图管理 (MapBaseLayers)
📍 要素操作
🛠️ 地图工具
⚡ 高级特性
EPSG:4326、EPSG:4490、EPSG:4549,支持基于 proj4.def 的自定义投影注册npm install my-openlayer
# 或
yarn add my-openlayer
# 或
pnpm add my-openlayer
import MyOl, { MapInitType } from 'my-openlayer';
const mapConfig: MapInitType = {
center: [119.81, 29.969],
zoom: 10,
token: import.meta.env.VITE_TIANDITU_TOKEN, // 天地图 Token
annotation: true
};
const map = new MyOl('map-container', mapConfig);
// 获取模块实例
const point = map.getPoint();
const line = map.getLine();
const polygon = map.getPolygon();
// 添加点位
point.addPoint([{ lgtd: 119.81, lttd: 29.969, name: '示例点' }], {
layerName: 'example-point',
img: 'marker.png'
});
当需要展示大量预警点位时,优先使用 addPulsePointLayer。它与 addPoint 保持一致的 img、scale、textKey 等参数习惯,通过单个 requestAnimationFrame 驱动整个 VectorLayer,避免为每个点创建 DOM 动画。
const pulseLayer = point.addPulsePointLayer(
[
{ lgtd: 119.81, lttd: 29.969, lev: 0, stnm: '风险村' },
{ lgtd: 119.86, lttd: 29.992, lev: 3, stnm: '普通村' }
],
{
layerName: 'village-pulse',
levelKey: 'lev',
textKey: 'stnm',
img: '/icons/village.svg',
scale: 0.8,
textVisible: true,
pulse: {
duration: 2400,
radius: [8, 28],
colorMap: {
0: 'rgba(255, 48, 54, 0.48)',
1: 'rgba(255, 136, 0, 0.45)',
2: 'rgba(253, 216, 46, 0.4)',
3: 'rgba(6, 183, 253, 0.32)'
}
}
}
);
pulseLayer?.stop();
pulseLayer?.start();
pulseLayer?.remove();
Line 模块现在支持流光线与流动线图标动画,调用方式与 Point.addPulsePointLayer() 保持一致,返回可控 handle。
const flow = map.getLine().addFlowLine(lineData, {
layerName: 'river-flow',
animationMode: 'icon+dash',
strokeColor: '#19b1ff',
strokeWidth: 3,
lineDash: [18, 12],
flowSymbol: {
src: '/symbols/boat.svg',
scale: 0.9,
color: '#19b1ff',
rotateWithView: true,
count: 2,
spacing: 0.2
}
});
flow?.pause();
flow?.resume();
flow?.remove();
为了提供更详细的说明,我们将文档拆分为独立的模块文件:
const baseLayers = map.getMapBaseLayers();
baseLayers.switchBaseLayer('img_c'); // 切换到影像底图
import { MeasureHandler } from 'my-openlayer';
// 需要传入原生的 OpenLayers map 实例
const measure = new MeasureHandler(map.map);
measure.start('LineString'); // 开始测距
measure.end(); // 结束测量
注意:部分高级功能(如 SelectHandler)可以通过
map.getSelectHandler()访问。
欢迎提交 Issue 或 Pull Request!
git checkout -b feature/your-featuregit commit -m 'feat: 新功能描述'git push origin feature/your-feature联系方式: 2364184627@qq.com | GitHub Issues
FAQs
my-openlayer 是一个基于 [OpenLayers](https://openlayers.org/) 的现代地图组件库,专为 Web GIS 应用开发者设计。提供完整的 TypeScript 支持、模块化的类型定义、强大的错误处理和事件管理系统,支持天地图底图加载、要素绘制、图层管理、事件监听等丰富功能,极大提升地图开发效率。
The npm package my-openlayer receives a total of 109 weekly downloads. As such, my-openlayer popularity was classified as not popular.
We found that my-openlayer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Research
/Security News
Ten malicious OpenAPI React Query Codegen versions were published to npm in the Mini Shai-Hulud attack, all with valid provenance.

Security News
Socket joins more than 100 technology, cybersecurity, and financial organizations calling for a global surge in cyber defense.

Product
Enterprise security teams can now detect malware, credential theft, suspicious network activity, and risky updates across Microsoft Edge extensions.