-
Notifications
You must be signed in to change notification settings - Fork 1.3k
PrecisionPoint TransformState::latLngToPoint dateline issue #4155
Comments
Related method in PrecisionPoint TransformState::latLngToPoint(const LatLng& latLng) const {
return coordinateToPoint(latLngToCoordinate(latLng));
} which on his turn calls: PrecisionPoint TransformState::coordinateToPoint(const TileCoordinate& coord) const {
mat4 mat = coordinatePointMatrix(coord.zoom);
matrix::vec4 p;
matrix::vec4 c = {{ coord.column, coord.row, 0, 1 }};
matrix::transformMat4(p, c, mat);
return { p[0] / p[3], height - p[1] / p[3] };
} and TileCoordinate TransformState::latLngToCoordinate(const LatLng& latLng) const {
const double tileZoom = getZoom();
const double k = zoomScale(tileZoom) / worldSize();
return {
lngX(latLng.longitude) * k,
latY(latLng.latitude) * k,
tileZoom
};
} |
I can reproduce this issue in the iOS SDK. From my location in California, if I zoom out to z0 and pan west, the user location annotation disappears as soon as the map view’s center point crosses the antimeridian. The iOS SDK similarly positions the user location annotation using |
To make this problem a bit more visual, see this clip where I'm visualising the touch events. |
@brunoabinader I'm on it, currently building specifically from that commit. |
The user location and camera are LatLng [longitude=179.931, latitude=-16.945] Just before crossing the dateline the camera is on LatLng [longitude=179.99965655644286, latitude=-16.91392665410768] the values are x: 40.649273 and y: 906.33923. Just after crossing the dateline the camera is on LatLng [longitude=-179.99907836847547, latitude=-16.91429282823615] the values are x: 3601749.0 and y: 618666.6 While it should be almost the same as before crossing, the x value should be a bit lower. |
On it 👍 |
👉 #4214. |
If the center and point coordinates are not in the same side of the antimeridian, we need to unwrap the point longitude to make sure it can still be seen from the visible side of the antimeridian that is opposite to the center side. Fixes #4155.
Added missing case. Really fixes #4155 this time.
Issue in
mbgl
when calculating points based on LatLng from the left side of the dateline after crossing the dateline from left to right. This is a follow up issue for #3995.An example:
Take this LatLng:
before crossing the dateline
latLngToPoint
is giving us Point[x=455.80133, y= 746.6456]while after crossing the dateline
latLngToPoint
is giving us Point[x=393667.44, y=747.1837].Normally we should see a small decrease in value not a big increase.
The text was updated successfully, but these errors were encountered: