0.6.1 • Published 3 years ago
r-atlas v0.6.1
React Atlas
WORK IN PROGRESS. DO NOT USE!
React wrapper of Openlayers written in TypeScript.
Installation
# using yarn
yarn add r-atlas
# using npm
npm install r-atlas
Development
Build project with watcher
yarn build:watch
Usage
Display simple map:
import { MapContainer, TileLayer } from 'r-atlas'
const Map = () => {
return (
<MapContainer center={[0, 0]} zoom={12} style={{ width: 600, height: 300 }}>
<TileLayer source="OSM" />
</MapContainer>
)
}
Using openlayers object:
import { MapContainer, TileLayer, useMap } from 'r-atlas'
const SubComponent = () => {
const { map } = useMap()
// you can access the openlayers object via using useMap hook
return <div>I'm sub</div>
}
const Map = () => {
return (
<MapContainer center={[0, 0]} zoom={12} style={{ width: 600, height: 300 }}>
<TileLayer source="OSM" />
</MapContainer>
)
}
Contributing
See the CONTRIBUTING file.