i use google earth to create polygon area and save it into kml. the kml coordinate format is longitude-latitude. But Leaflet format is latitude-longitude
here's the example
var statesData =
{"type":"FeatureCollection",
"features":[
{"type":"Feature","id":"72","properties":
{"name":"Puerto Rico","density":1082 },
"geometry":{"type":"Polygon","coordinates":[
[109.2299584026405,-7.251704676336486],109.2376875108402,-7.255838896277941],[109.2454156842918,-7.264692077983154]]]}]};
anyone know how to convert Lat-Long to Long-Lat in this javascript or maybe save kml file to Lat-Long format?
i have more than 200 rows coordinate and it will be so much not efficient if i switch manually
thanks
The code sample you show follows a standard GeoJSON format (with a small mistake, but I guess it is just a typo).
Leaflet automatically does the conversion when you parse that GeoJSON data through the L.geoJSON()
factory.
You can also directly use your KML file, e.g. by using the leaflet-omnivore plugin.