0

I'm working on a web mapping solution that stores data in PostGIS with EPSG:4326 projection. Everything seems to be good until last week. My customer loaded two shapefiles that some parts are overlapping in QGIS or ArcMap, but they saw about 0.50 meters shift in our OpenLayers viewer. (Please check the screenshots below)

Two layers overlaps in QGIS View

Two layers seen as shifted in OpenLayers View

There is a middleware written in NodeJS that gets vector layer in GeoJSON. I tried both get data in EPSG:4326 and EPSG:3857 projections, but nothing changes.

Then I tried to change the projection of the view of the OpenLayers from default (EPSG:3857 to EPSG:4326) that fixes the problem and layers overlapped, but this time other vector tile layers not worked with the EPSG:4326 projection.

I'm trapped how to solve the problem. I try to limit zoom after 1/1000, but customer want to go in details. If I try to change projection of OpenLayers, there will be changes in both front-end and backend.

What is the best solution? What are the pros and cons of changing projection of OpenLayers to EPSG:4326?

3
  • 3
    That is possibly expected behaviour. For example a line drawn directly from [0, 50] to [20, 60] in a EPSG:4326 projection will pass through [10, 55]. A line drawn directly between the same points in an EPSG:3857 projection does not pass through the same midpoint codesandbox.io/s/simple-forked-wf4q7q?file=/main.js Options are to plot something that is consistent in both projections such as great circle route, or to represent a straight line in one projection with the corresponding curved line in the other (based on sample points along the line).
    – Mike
    May 7, 2022 at 9:57
  • @Mike thanks for the reply. I know there are issues when converting data from one projection to another and I want to solve it in a proper way, because it is working on the view when it has EPSG:4326 projection. May 9, 2022 at 8:09
  • See also gis.stackexchange.com/questions/308871/…
    – Mike
    May 9, 2022 at 9:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.