0.1.16 • Published 2 years ago

react-leaflet2 v0.1.16

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-leaflet2

地图渲染。

✨ Features

  • 瓦片图
  • 矢量图
  • 覆盖物
  • 标记
  • WKT、GeoJson
  • 绘图

📦 Install

npm i react-leaflet2 --save

🔨 Usage

import React, { Fragment } from 'react';
import { Map, TileLayer, latLng } from 'react-leaflet2';

const ACCESS_TOKEN =
  'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw';
const MB_ATTR =
  'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, ' +
  'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>';
const MB_URL =
  'https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token=' + ACCESS_TOKEN;

export default () => {
  return (
    <Fragment>
      <Map center={latLng(37.77396, -122.4366)} zoom={13} style={{ width: '100%', height: 400 }}>
        <TileLayer url={MB_URL} attribution={MB_ATTR} id="light-v9" />
      </Map>
    </Fragment>
  );
};

🖥 Development

$ git clone https://github.com/Alfred-sg/react-leaflet2
$ npm install
$ npm run docs

打开浏览器访问 http://127.0.0.1:8000。

参考

LICENSE

MIT

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago