forked from sakitam-fdd/wind-layer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request sakitam-fdd#6 from sakitam-fdd/wind-server
fix projection and add service feature
- Loading branch information
Showing
20 changed files
with
932 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,18 +34,20 @@ import WindLayer from 'wind-layer' | |
目前可通过 [unpkg.com](https://unpkg.com/wind-layer/dist/windLayer.js) / [jsdelivr](https://cdn.jsdelivr.net/npm/[email protected]/dist/windLayer.js) 获取最新版本的资源。 | ||
|
||
```bash | ||
// 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 | ||
// jsdelivr (jsdelivr由于缓存原因最好锁定版本号,否则可能会出现意料之外的问题) | ||
https://cdn.jsdelivr.net/npm/[email protected]/dist/windLayer.js | ||
https://cdn.jsdelivr.net/npm/[email protected]/dist/windLayer.min.js | ||
``` | ||
|
||
#### [![示例](https://sakitam-fdd.github.io/wind-layer/windy.jpg)](https://jsfiddle.net/sakitamfdd/hgvdu76j/?utm_source=website&utm_medium=embed&utm_campaign=hgvdu76j) | ||
|
||
#### [文档](//sakitam-fdd.github.io/wind-layer/) | ||
|
||
#### [点击查看示例](//sakitam-fdd.github.io/wind-layer/examples/index.html) | ||
|
||
## 如何获取数据 | ||
|
||
天气数据由[全球预报系统](http://en.wikipedia.org/wiki/Global_Forecast_System)(GFS)生成, | ||
|
@@ -72,14 +74,17 @@ npm run dev:server // 调试环境启动服务 | |
npm run prd:server // 部署环境启动服务 | ||
``` | ||
|
||
### 目前共暴露4个接口 | ||
### 目前共暴露7个接口 | ||
|
||
| url | params | desc | | ||
| :--- | :--- | :---------- | | ||
| `autofetch` | `null` | 无需参数,开启自动抓取程序,默认30分钟抓取一次数据源 | | ||
| `stopautofetch` | `null` | 停止自动抓取程序 | | ||
| `getdata` | `Object` (目前只支持`time` 参数,时间戳) | 获取json数据,存在转换过的直接返回,若只存在元数据则转换后返回,若元数据也不存在则抓取转换后再响应 | | ||
| `gribdata` | `Object` (目前只支持`time` 参数,时间戳) | 获取grib数据(强制抓取数据) | | ||
| `gribdata` | `Object` (目前只支持`time` 参数,时间戳) | 获取grib2数据(强制抓取数据) | | ||
| `getSourceTree` | `null` | 无需参数,获取抓取的数据源 `grib2` 源数据。返回一个list,包含文件名和服务器地址。 | | ||
| `getParseTree` | `null` | 无需参数,获取转换后的 `json` 数据。返回一个list,包含文件名和服务器地址。 | | ||
| `getDataByFileName` | `{ filename }` | 通过文件名请求 `json` 数据,文件名可为源数据文件和json文件名 | | ||
|
||
## Resources | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,10 +40,16 @@ | |
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<div id="map"> | ||
<div class="menu"> | ||
<button class="base-button" onclick="getData()">获取数据</button> | ||
<button class="base-button" onclick="setData()">设置数据</button> | ||
<button class="base-button" onclick="clearWind()">移除图层</button> | ||
</div> | ||
</div> | ||
<script src="https://cdn.jsdelivr.net/npm/openlayers/dist/ol.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/windLayer.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected].3/dist/windLayer.js"></script> | ||
<script> | ||
var Maps = new ol.Map({ | ||
target: 'map', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
### npm安装 | ||
#### npm安装 | ||
|
||
```bash | ||
npm install wind-layer --save | ||
import WindLayer from 'wind-layer' | ||
|
||
// 指定版本安装 | ||
npm install [email protected].1 --save | ||
npm install [email protected].2 --save | ||
import WindLayer from 'wind-layer' | ||
|
||
``` | ||
### cdn | ||
|
||
目前可通过 [unpkg.com](https://unpkg.com/wind-layer/dist/windLayer.js) 获取最新版本的资源。 | ||
目前可通过 [unpkg.com](https://unpkg.com/wind-layer/dist/windLayer.js) / [jsdelivr](https://cdn.jsdelivr.net/npm/[email protected]/dist/windLayer.js) 获取最新版本的资源。 | ||
|
||
```bash | ||
// 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://unpkg.com/[email protected]/dist/windLayer.js | ||
https://unpkg.com/[email protected]/dist/windLayer.min.js | ||
``` | ||
|
||
|
||
|
@@ -33,7 +31,7 @@ var wind = new WindLayer(res.data, { | |
minResolution: undefined, | ||
maxResolution: undefined, | ||
zIndex: 0, | ||
projection: 'EPSG:3857', | ||
projection: 'EPSG:3857', // EPSG:4326 | ||
ratio: 1 | ||
}) | ||
wind.appendTo(Maps) | ||
|
@@ -47,7 +45,7 @@ wind.appendTo(Maps) | |
| minResolution | 最小分辨率 | `Number` | 默认为 `undefined` | | ||
| maxResolution | 最大分辨率 | `Number` | 默认为 `undefined` | | ||
| zIndex | 图层index | `Number` | 默认为 `0` | | ||
| projection | 投影 | `String` | 现在默认支持且仅支持 `EPSG:3857` | | ||
| projection | 投影 | `String` | 现在默认支持 `EPSG:3857`, `EPSG:4326`測試中 | | ||
| ratio | 画布和地图窗口的比值 | `Number` | 现在默认 `1.5` | | ||
|
||
#### methods | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "wind-layer", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "a openlayers extension to windjs", | ||
"author": "FDD <[email protected]>", | ||
"homepage": "https://sakitam-fdd.github.io/wind-layer", | ||
|
@@ -72,7 +72,7 @@ | |
"koa-views": "^5.2.1", | ||
"nodemon": "^1.12.5", | ||
"pm2": "^2.9.2", | ||
"rollup": "0.54.1", | ||
"rollup": "^0.55.1", | ||
"rollup-plugin-babel": "^3.0.2", | ||
"rollup-plugin-buble": "^0.16.0", | ||
"rollup-plugin-commonjs": "^8.2.6", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
module.exports = { | ||
port: 3000, // 端口 | ||
staticDir: 'public', // 静态文件目录 | ||
serviceUrl: 'http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_1p00.pl', | ||
sourceDataDir: 'public/sourceData/', // 二进制数据源 | ||
parseDataDir: 'public/parseData/' // 转换后的json数据 | ||
sourceDataDir: '/sourceData/', // 二进制数据源 | ||
parseDataDir: '/parseData/' // 转换后的json数据 | ||
} |
Oops, something went wrong.