In native Leaflet map, lib CRS attribute should be set as below
var mymap = L.map('mapid', {
center: [-1800, 1000],
zoom: 13,
crs: L.CRS.Simple,
minZoom: 0,
maxZoom: 13,
});
How to do that in react-leaflet, I had tried some things but nothing successful :/
<Map crs={CRS.useSimple()} center={[-1800, 1000]} zoom={13} doubleClickZoom={false} >
</Map>
But there is an error that CRS is not imported. How to import CRS?
Where do I wrong?
I need to import CRS from native leaflet.
import React, { Component } from 'react';
import {Map} from 'react-leaflet'
import {CRS} from 'leaflet';
and then in MAP
component
<Map center={[0, 0]} zoom={2} doubleClickZoom={false} crs={CRS.Simple}>
...
</Map
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With