Closed jmvanel closed 5 years ago
That's because "4.48029E1"
is a String
, not a number (and that's javascript, not specific to Leaflet). Try { "lat": 4.84029E1 }
paying attention to your quotes, and do read https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat
That's not a big deal, but I still think that it should be done: there is an automatic conversion in Leaflet from "48.4029" to the number 48.4029 , why not from "4.48029E1" to 4.48029E1 ?
No, again automatic type casting is a JS thing, not a Leaflet thing. Leaflet works as expected when feeding strings to function/method calls that accept numbers anyway, there's no need for extra manipulation. See e.g. https://plnkr.co/edit/J8oRqoKnV4DBjdXWItxO?p=preview
Like `"lat": "4.84029E1" ,
`where "48.4029" works.
I have to do this in my code, and I think it is better in LeafLet code:
Number( lat )