Movatterモバイル変換


[0]ホーム

URL:


@planet/maps

Declarative mapping components for React

The @planet/maps library provides components for rendering maps in your React applications. The library acts as a wrapper aroundOpenLayers, transforming the imperative API into declarative components.

See below for a basic example. Take a look through theexamples directory to learn how to use the library.

import Mapfrom '@planet/maps/Map';import OSMfrom '@planet/maps/source/OSM';import ScaleLinefrom '@planet/maps/control/ScaleLine';import Viewfrom '@planet/maps/View';import TileLayerfrom '@planet/maps/layer/WebGLTile';function MyApp() {  return (    <Map style={{width:'100%', height:'100%'}}>      <View options={{center: [0,0], zoom:1}} />      <TileLayer>        <OSM />      </TileLayer>      <ScaleLine />    </Map>  );}

💿 Installation

The library requires React and OpenLayers. You can install all the dependencies withnpm:
npm install @planet/maps ol react react-dom

✨ Usage tips

🙏 Contributing

Notice a bug or have an idea? Pleasecreate an issueon theGitHub repository.

The @planet/maps library is an open source project fromPlanet.


[8]ページ先頭

©2009-2025 Movatter.jp