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

sgmapgd

v0.4.4

Published

这是一个基于高德地图的React地图引擎组件,实现指定中心点的卫星地图显示,航拍或手绘高清地图瓦片加载,位置选择,区块划分,路网规划等功能。

Downloads

13

Readme

SGMapGD

这是一个基于高德地图的React地图引擎组件,实现指定中心点的卫星地图显示,航拍或手绘高清地图瓦片加载,位置选择,区块划分,路网规划等功能。

当前版本

v0.4.4 polyline增加connected属性用于表示道路连通性

v0.4.3 强制在pickcenter模式下不加载瓦片

v0.4.2 修复轨道分支branch属性不能修改问题

v0.4.1 修复预览页面设备详情框不能关闭的问题 增加了轨道类型的路网线段properties.branch字段

v0.4.0 设备marker增加focus效果

v0.3.9 优化组件大小 处理部分bug

v0.3.6 修复路网线段距离修正功能数据保存不生效的问题

v0.3.5 优化路网在非编辑模式下的显示

v0.3.4 去除部分调试日志

v0.3.3 优化地图缩放大小 将地图secruitykey内置到组件,并引出配置参数

v0.3.2 调整设备marker样式

v0.2.9 调整地块轮廓线宽度为4

v0.2.8 修复路网不能点击的问题 example中增加preview,通过mqtt实现实时监测

v0.2.7 折线路网增加measure(距离,单位米)字段

v0.2.6 修复blockEditClick点击事件坐标位置变化的问题 修复其它bug

v0.2.5 修复marker双击事件,并增加click事件处理 修复地块图片显示大小问题 路网编辑功能中,针对直线路网增加道路类似字段,并增加轨道类型(geojson中为properties.type='track')

v0.2.4 坐标拾取模式下,增加双击重拾坐标为事件坐标点功能 重新升级高德地图内核至2.1Beta,增加显示地形图的选项(功能暂只提供体验,非完成版) 完善区块管理相关功能,增加区块管理相关事件(详细事件使用见example)

v0.2.3 增加地块渲染及删除功能 修复geojson为空异常

v0.2.2 升级SDK至2.1beta版 增加showTerrain参数,用于控制3D地形图的显示 v0.2.1 优化曲线绘图过程中的点击确认问题 修复某些情况下路网对象id重复造成绘图失败的问题

v0.1.9 增加路网组件的editable功能,但组件只传geojson数据,MapMode!=MapMode.geo时,只能查看路网,不能修改 优化组件代码结构 为marker和markers增加w,h属性,用于设置不同图标的宽高,默认为24x24

v0.1.8 所有路网组件(点、线、面)的选取、删除等操作 路网组件属性不同属性面板功能框架及界面完成

v0.1.7 修复css样式问题

v0.1.6 添加坐标点拾取pickup模式

v0.1.4

完成路网数据传入传出; 完成直线、曲线绘制和修改 处理瓦片默认加载级别范围为15-22,加载高清瓦片 单点绘制(虽然感觉没啥用,但是还是要有) 区域绘制 优化程序结构

待更新功能: 针对不同路网组件,增加如方向、区域类型、限速、路宽等参数设置 线组件方向(单向、双向通行)处理 两条不相交线(直线、曲线)修改为相交的处理(需要判断线段的起点终点拖动过程中与其它线段的相交吸附判断)

目录结构

 -src                      //组件源文件目录
 --index.css               //组件主样式文件
 --index.tsx               //组件主代码
 -example                   //组件使用示例程序

如何使用

示例代码运行

yarn install
cd example
yarn run start

组件安装

yarn add sgmapgd / npm install sgmapgd

使用前说明

  1. 组件中所有涉及地理坐标均采用WGS84(即大地坐标系),包括输入参数(含中心点、点、线和多边形等),和输出参数。输入的坐标参数由组件自行转换成GCJ02坐标系,输出参数也由组件转换回WGS84.

组件引用

import * as React from 'react';
import * as ReactDOM from 'react-dom';



import SGMapGD from 'SGMapGD';

const App = () => {
  return (
    <div>
     <SGMapGD mapkey="0cc03b6fc083ecfc0c4b9f61769b643e" center={[114.35851078387346,30.469962248474555]} 
      zoom={21} 
      tileurl="https://www.sigucloud.cn/map2/{z}/{x}_{y}.png" 
      mapmode={MapMode.geo} 
      geojson={geojson}
      onCenterChange={(c)=>{console.log(c)}} 
      onZoomChange={(z)=>{console.log(z);}}
      onGeojsonChange={(g)=>{console.log(g);}}
      />
    </div>
  );
};

ReactDOM.render(<App />, document.getElementById('root'));

可用属性和方法

属性

| 属性名 | 属性名 | | -- | -- | | mapkey | 地图应用key,需要通过高德开放平台控制台进行申请必须 | | center | 默认中心点坐标(WGS84)必须,[lng,lat] | | zoom | 默认放大倍数 | | tileurl | 需加载的瓦片地图模板路径 | | marker | pickup模式下必填,用于设置需要选取位置的设备或点标记,具体格式见示例 | | mapmode | default - 默认 pickcenter-选取中心点模式,进入设置中心点模式,该模式主要用于场地位置选择场景 pickup- 选取位置 geo - 路网规划 | | geojson | 完整路网数据,详情见example/index.tsx文件示例|

回调事件方法

| 方法名 | 备注 | | -- | -- | | onCenterChange(AMap.LngLat) | 中心点改变事件,返回参数类型为AMap.LngLat | | onZoomChange(zoom) | 地图缩放事件,返回当前地图对应的放大倍数,如19 | | onGeojsonChange(geojson) | 路网规划编加过程中,如果出现路网的编辑,需要通过该方法返回变化的数据 | | onPickup(lnglat) | 返回选取的位置点坐标,如[114.24,30.12] |