3.0.1 • Published 2 years ago

@neshan-maps-platform/react-openlayers v3.0.1

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

⚙️ 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

2 years ago

3.0.0

2 years ago

2.0.17

2 years ago

2.0.16

2 years ago

2.0.15

2 years ago

2.0.14

2 years ago

2.0.13

2 years ago

2.0.12

2 years ago

2.0.11

2 years ago

2.0.10

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago