I have problems to find lost projection and hope someone could give a hint. I think there is no way to find the projection automatically so I did try a semi-automatic approach shown below.
My initial data are ESRI Shapefiles (only .DBF, .SHP, .SHX). The only information I have is that these Shapefiles should be somewhere in Germany. So my idea was to collect first all Projections for Germany. I did that using the following filter on this website:
https://epsg.io/?q=Germany+kind%3APROJCRS
There are about 71 projections. I wrote a small application using Openlayers, OpenStreetMap and proj4js and it looks like this:
A click on a Listitem registers a new projection and I am able to tell at a glance if the projection is correct or not. That works for a small set of Data unfortunally. Most of them apprearing somewhere in the water. Here is the JS Method that load a new projection:
function switchProjection(stringProj4JSDefinition) {
var arrTmp = stringProj4JSDefinition.split('#');
var epsg = arrTmp[0];
var projection = arrTmp[1];
proj4.defs('' + epsg + '', '' + projection + '');
ol.proj.proj4.register(proj4);
map.setView(new ol.View({
projection: '' + epsg + ''
}));
var vectorSource;
map.getLayers().forEach(function (layer) {
if (layer instanceof ol.layer.Group) {
layer.getLayers().forEach(function (groupLayer) {
if (layer instanceof ol.layer.Vector) {
vectorSource = layer.getSource();
}
});
}
else if (layer instanceof ol.layer.Vector) {
vectorSource = layer.getSource();
} else if (layer instanceof ol.layer.VectorImage) {
vectorSource = layer.getSource();
} else if (layer instanceof ol.layer.Image) {
vectorSource = layer.getSource();
} else {
vectorSource = layer.getSource();
}
});
map.getView().fit(vectorSource.getExtent(), map.getSize());
}
Any ideas what else I could try?
I am new to GIS.
Most of my shapefiles are already projected to Cartesian coordinate system, so maybe that's problem here but I'm usure.
