[GIS] Leaflet setView with non lat/long CRS

coordinate systemjavascriptleafletutm

Is it possible to use setView when using an alternative CRS?

var map = L.map('map',{crs: L.CRS.EPSG26915}).setView([4970081,477018], 13);
// Returns: Uncaught TypeError: Cannot call method 'latLngToPoint' of undefined 

I assume it's related to using a CRS that isn't lat/long.

Thanks!

To clarify in regards to the first comment…

var map = L.map('map'.setView([44.8846225,-93.2203424], 13); // Works fine
var map = L.map('map',{crs: L.CRS.EPSG26915}).setView([44.8846225,-93.2203424], 13); // Same error as above.

Best Answer

Try, please:

var map = L.map('map').setView([44.8846225,-93.2203424], 13, L.CRS.EPSG26915);