Working directly in JavaScript on a geojson file, I could not find any easy way to transform my coordinates from EPSG3035 to geographic (Lon,Lat). By easy I mean: not installing another software like QGIS or similar. I have tried proj4, and ol, but both failed.
I have no clue. [the OL solution is in "t.niese" answer below]
let coordinates = [4035675.373507705517113, 2862363.090465864632279]; // Luxembourg
console.log(coordinates);
// a "well-known text" WKT-OGC definition from https://epsg.io/3035
const WKT3035 = `PROJCS["ETRS89 / LAEA Europe",GEOGCS["ETRS89",DATUM["European_Terrestrial_Reference_System_1989",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6258"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4258"]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["latitude_of_center",52],PARAMETER["longitude_of_center",10],PARAMETER["false_easting",4321000],PARAMETER["false_northing",3210000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","3035"]]`;
// trying OpenLayers
try {
const fromLonLat = ol.proj.getTransform("EPSG:3035", "EPSG:4326");
coordinates = fromLonLat(coordinates);
console.log("using ol.proj", coordinates);
} catch (err) {
console.error(err)
}
try { // trying proj4
coordinates = [4035675.373507705517113, 2862363.090465864632279];
const srcProj = new proj4.Proj(WKT3035);
proj4(srcProj).inverse(coordinates);
console.log("using proj4", coordinates);
} catch (err) {
console.error(err)
}
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.8.1/build/ol.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.7.5/proj4.js"></script>