3.0.1 • Published 5 months ago
@neshan-maps-platform/react-openlayers v3.0.1
⚙️ Before Install
You need a map key to use our map on your react web application. You can signup and get a key from Our Platfrom. For more information, visit our doc page.
📦 Install
npm install @neshan-maps-platform/react-openlayers
npm install @neshan-maps-platform/ol
yarn add @neshan-maps-platform/react-openlayers
yarn add @neshan-maps-platform/ol
🔨 Usage
import {useEffect, useRef} from "react"
import {Map} from "@neshan-maps-platform/ol"
import NeshanMap, {NeshanMapRef} from "@neshan-maps-platform/react-openlayers"
function App() {
const mapRef = useRef<NeshanMapRef | null>(null)
const onInit = (map: Map) => {
map.setMapType("osm-bright")
map.switchTrafficLayer(true)
}
useEffect(() => {
if (mapRef.current?.map) {
mapRef.current?.map.switchTrafficLayer(true)
mapRef.current?.map.setMapType("standard-night")
}
}, [])
return (
<div style={{ width: "100vh"}}>
<NeshanMap
mapKey="Your_Map_Key"
defaultType="neshan"
center={{latitude: 35.7665394, longitude: 51.4749824}}
style={{height: "48vh", width: "100%"}}
onInit={onInit}
zoom={13}
traffic={false}
poi={false}
></NeshanMap>
<hr/>
<NeshanMap
ref={mapRef}
mapKey="Your_Map_Key"
defaultType="dreamy"
style={{height: "48vh", width: "100%"}}
traffic={false}
poi={false}
></NeshanMap>
</div>
)
}
export default App
TypeScript
@neshan-maps-platform/react-openlayers
is written in TypeScript with complete definitions.
3.0.1
5 months ago
3.0.0
5 months ago
2.0.17
5 months ago
2.0.16
1 year ago
2.0.15
1 year ago
2.0.14
1 year ago
2.0.13
1 year ago
2.0.12
1 year ago
2.0.11
1 year ago
2.0.10
1 year ago
2.0.9
1 year ago
2.0.8
1 year ago
2.0.7
1 year ago
2.0.6
1 year ago
2.0.5
1 year ago
2.0.4
1 year ago
2.0.3
1 year ago
2.0.2
1 year ago
2.0.1
1 year ago
2.0.0
1 year ago