2

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.

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.
2
  • 1
    What happens if you pass lat/lng? Does it 1) run without errors and 2) display the correct view?
    – Emily
    Jan 27, 2014 at 22:10
  • var map = L.map('map',{crs: L.CRS.EPS26915}).setView([44.8846225,-93.2203424], 13); returns the same error and displays no content on the page.
    – Matt
    Jan 27, 2014 at 22:19

1 Answer 1

1

Try:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.