Open paul121 opened 2 years ago
I'm hoping to find an alternative solution to the use-case I described above but it seems that this would be a useful function to have available
It would also be convenient to have the basic transform
function so you can convert an OL coordinate to lat/lon. Common uses may be the center of the view or the event.coordinate
when clicking on the map.
https://openlayers.org/en/latest/apidoc/module-ol_proj.html#.transform
I would like to get the lat/lon for the four corners of the current view's extent. This s.o. explains how it can be done: https://stackoverflow.com/questions/28166471/openlayer3-how-to-get-coordinates-of-viewport
Unfortunately
var extent = map.getView().calculateExtent(map.getSize());
returns an extent in EPSG:3857 not EPSG:4326. OL has a method for transforming extents:extent = ol.proj.transformExtent(extent, 'EPSG:3857', 'EPSG:4326');
but because farmOS-map does not export this function it is not accessible without bundling parts of OL myself.Could we either export this function and make it available at
window.farmOS.map
or make it available on the farmOS-map instance itself?