I am trying to implement support for multiple projections in qgis2web. I believe that the correct approach would be to export the QGIS layers to EPSG:4326 geoJSON. I've implemented that.
However, I cannot get the points to display on the EPSG:3857 OL3 map. I've looked through the OL3 API, and I've only found that under ol.format.GeoJSON, the option defaultDataProjection
exists. It's not clear to me whether I should set this to the JSON's projection 4326 or the map's 3857. I've tried both, but the points still do not appear.
A sample qgis2web OL3 map is here: https://www.dropbox.com/s/nyjvn8s0w14a04j/ol3map.zip?dl=0. Can anyone help me figure this out? What am I missing?
UPDATE: I might have figured this out. In the dropboxed code /layers/layers.js
line 5, adding {dataProjection: 'EPSG:4326', featureProjection: 'EPSG:3857'}
as the second argument to readFeatures might have done the job. Will confirm or deny after testing.