From cf2dcc2e401d1df57a3db72d00488aac3867b765 Mon Sep 17 00:00:00 2001 From: Maciej Maj Date: Tue, 21 May 2019 14:32:12 +0200 Subject: [PATCH] Fix for map API Request --- Assets/MainScene.unity | 4 ++-- Assets/Scripts/GoogleMapDisplay.cs | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Assets/MainScene.unity b/Assets/MainScene.unity index f6a5e2f..32edbba 100644 --- a/Assets/MainScene.unity +++ b/Assets/MainScene.unity @@ -25699,7 +25699,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.0000021741748} + m_AnchoredPosition: {x: 0, y: 0.00000088978703} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1371052592 @@ -26384,7 +26384,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 134.06734, y: 60} + m_AnchoredPosition: {x: 275.22116, y: 60} m_SizeDelta: {x: 0, y: 150} m_Pivot: {x: 1, y: 1} --- !u!114 &1433522477 diff --git a/Assets/Scripts/GoogleMapDisplay.cs b/Assets/Scripts/GoogleMapDisplay.cs index cd95479..f9a8774 100644 --- a/Assets/Scripts/GoogleMapDisplay.cs +++ b/Assets/Scripts/GoogleMapDisplay.cs @@ -219,12 +219,16 @@ string ReturnApiUrl(OneRequest request) { Vector2 metersPos = Conversion.MetersToLatLon(new Vector2(tempPos.x, tempPos.y)); string output = ""; string retinaMultiplayer = ""; + string positionX = metersPos.x.ToString(); + positionX = positionX.Replace(',', '.'); + string positionY = metersPos.y.ToString(); + positionY = positionY.Replace(',', '.'); if (CheckUIScale.isRetina) retinaMultiplayer = "@2x"; if (useGoogleMaps) - output = string.Format("http://maps.googleapis.com/maps/api/staticmap?center={0},{1}&zoom={2}&size=640x640&key={3}{4}", metersPos.x, metersPos.y, request.zoomLevel, GoogleLocationApi.instance.apiKey, style); + output = string.Format("http://maps.googleapis.com/maps/api/staticmap?center={0},{1}&zoom={2}&size=640x640&key={3}{4}", positionX, positionY, request.zoomLevel, GoogleLocationApi.instance.apiKey, style); else - output = string.Format("https://api.mapbox.com/styles/v1/bionicl/cjbfocd42b59q2rqasdw3ezwb/static/{1},{0},{2},0,0/640x640{3}?access_token={4}&logo=false&attribution=false", metersPos.x, metersPos.y, request.zoomLevel-1, retinaMultiplayer, GoogleLocationApi.instance.mapBoxApiKey); + output = string.Format("https://api.mapbox.com/styles/v1/bionicl/cjbfocd42b59q2rqasdw3ezwb/static/{1},{0},{2},0,0/640x640{3}?access_token={4}&logo=false&attribution=false", positionX, positionY, request.zoomLevel-1, retinaMultiplayer, GoogleLocationApi.instance.mapBoxApiKey); return output; } }