I have a geojson file in UTM coordinates (WGS_1984_UTM_Zone_39N) and I'm trying to load it via openlayers.
I have the below code and it's working with long/lat coordinates but not with UTM:
proj4.defs('ESRI:53009', '+proj=moll +lon_0=0 +x_0=0 +y_0=0 +a=6371000 ' +
'+b=6371000 +units=m +no_defs');
// Configure the Sphere Mollweide projection object with an extent,
// and a world extent. These are required for the Graticule.
var sphereMollweideProjection = new ol.proj.Projection({
code: 'ESRI:53009',
extent: [-9009954.605703328, -9009954.605703328,
9009954.605703328, 9009954.605703328],
worldExtent: [-179, -89.99, 179, 89.99]
});
var map = new ol.Map({
keyboardEventTarget: document,
layers: [
new ol.layer.Vector({
source: new ol.source.Vector({
url: 'countries.json',
format: new ol.format.GeoJSON()
})
})
],
target: 'map',
view: new ol.View({
center: [0, 0],
projection: sphereMollweideProjection,
resolutions: [65536, 32768, 16384, 8192, 4096, 2048],
zoom: 1
})
});
new ol.Graticule({map: map});
My geojson file:
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[241247.75229999982,3356026.0593],[241247.52570000011,3356022.5901999995],[241266.4857999999,3356003.4778000005],[241253.77740000002,3355990.8706],[241240.8663999997,3356005.2499],[241228.51240000036,3355995.1236000005],[241214.33559999987,3356010.1105000004],[241241.2714999998,3356034.1602999996],[241247.75229999982,3356026.0593]]]},"properties":{"RefName":"15"}},
I did a search and found that I have to use 'ESRI:32639', but it's still not working.
I'm totally new on web GIS and openlayers and I don't understand what is wrong in my code.