summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLGeometry.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLGeometry.mm')
-rw-r--r--platform/darwin/src/MGLGeometry.mm9
1 files changed, 9 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLGeometry.mm b/platform/darwin/src/MGLGeometry.mm
index 715a70f0b8..63886b6474 100644
--- a/platform/darwin/src/MGLGeometry.mm
+++ b/platform/darwin/src/MGLGeometry.mm
@@ -106,3 +106,12 @@ CGPoint MGLPointRounded(CGPoint point) {
#endif
return CGPointMake(round(point.x * scaleFactor) / scaleFactor, round(point.y * scaleFactor) / scaleFactor);
}
+
+MGLMapPoint MGLMapPointMake(CLLocationCoordinate2D coordinate, double zoomLevel) {
+ mbgl::Point<double> projectedCoordinate = mbgl::Projection::project(MGLLatLngFromLocationCoordinate2D(coordinate), std::pow(2.0, zoomLevel));
+ MGLMapPoint point;
+ point.x = projectedCoordinate.x;
+ point.y = projectedCoordinate.y;
+ point.zoomLevel = zoomLevel;
+ return point;
+}