-1

I have an app that displays gps markers on the map. The coordinates are from images and they are correct, but the marking is very inaccurate.

Here is my code: https://stackblitz.com/edit/angular-ivy-c97txg?file=src/app/app.component.html

The expected position is like here on the picture: correct position

I understand that it has something to do with the projection of the coordinates, but unfortunately I do not understand exactly how.

0bmis
  • 46
  • 1
  • 8
  • It is impossible to answer. You are right, it has to do with projections, but we cannot tell you more, because we ahve no idea what you did, which projections did you use, etc. – Giacomo Catenazzi Feb 15 '21 at 10:04
  • EPSG:3857 is predefined in OpenLayers, you do not need to declare in in proj4 or set the extent. If you remove that from your code the feature is in the correct position. – Mike Feb 15 '21 at 10:20
  • @GiacomoCatenazzi There is a stackblitz link with the code – 0bmis Feb 15 '21 at 13:45
  • I never look in links. But so, you should put relevant part also in your question, This is a reference site, so we want that all data is included in the relevant page (and so it is easier to google it). External links have different lifetime. – Giacomo Catenazzi Feb 15 '21 at 14:21

1 Answers1

0

As Mike has already pointed out in the comments, it is the extent. If this is not set, the coordinates are displayed correctly.

Line to remove

this.projection.setExtent(this.extent);
Dharman
  • 30,962
  • 25
  • 85
  • 135
0bmis
  • 46
  • 1
  • 8