Based on examples from:
http://acanimal.github.io/thebookofopenlayers3/chapter03_10_reading_writing_features.html
http://acanimal.github.io/thebookofopenlayers3/chapter07_07_editing_features.html
I have managed to create simple editor, which pastes me created vectors to the textarea and then I created buttons, which downloads this GeoJSON string in a file.
I don't know why, but my app still gives me created vectors in EPSG:3857 instead of EPSG:4326 and it doesn't care that I defined EPSG to 4326 in both vectorLayer and for View.
var vectorLayer = new ol.layer.Vector({
source: new ol.source.StaticVector({
format: format,
**projection: 'EPSG:3857'**
})
´
var map = new ol.Map({
...
})
]),
view: new ol.View({
**projection: 'EPSG:4326',**
})
});
The problem is, that common user isn't clever enough to work with GeoJSON (download, open in QGIS, set up EPSG:3857 and save as EPSG:4326 in some other format), so I decided to create second button (for downloading) and defined var format = new ol.format.KML();
which is easy to use (double click opens and shows it in Google Earth), but this is not possible, because this works only with WGS84 coordinates in that KML file and not with other systems.
Is there (in OpenLayers) any possibility to easily create new duplicate layer with different coordinate system (geometry will be reprojected and I can just export)?
For example something like this could be nice:
var DuplicateWithDifferentEPSG = ol.proj.transformVectorlayer(vectorlayer, 'EPSG:3857', 'EPSG:4326')
How to simply reproject everything in my layer?
Any ideas?
Should I post exact copy of my code?
I don't get any errors.