{"action":"created","issue":{"url":"https://api.github.com/repos/TorbenK/TK.CustomMap/issues/345","repository_url":"https://api.github.com/repos/TorbenK/TK.CustomMap","labels_url":"https://api.github.com/repos/TorbenK/TK.CustomMap/issues/345/labels{/name}","comments_url":"https://api.github.com/repos/TorbenK/TK.CustomMap/issues/345/comments","events_url":"https://api.github.com/repos/TorbenK/TK.CustomMap/issues/345/events","html_url":"https://github.com/TorbenK/TK.CustomMap/issues/345","id":349888705,"node_id":"MDU6SXNzdWUzNDk4ODg3MDU=","number":345,"title":"How to use map with route getting exception - layout not occurred yet?","user":{"login":"LeoJHarris","id":5468757,"node_id":"MDQ6VXNlcjU0Njg3NTc=","avatar_url":"https://avatars1.githubusercontent.com/u/5468757?v=4","gravatar_id":"","url":"https://api.github.com/users/LeoJHarris","html_url":"https://github.com/LeoJHarris","followers_url":"https://api.github.com/users/LeoJHarris/followers","following_url":"https://api.github.com/users/LeoJHarris/following{/other_user}","gists_url":"https://api.github.com/users/LeoJHarris/gists{/gist_id}","starred_url":"https://api.github.com/users/LeoJHarris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeoJHarris/subscriptions","organizations_url":"https://api.github.com/users/LeoJHarris/orgs","repos_url":"https://api.github.com/users/LeoJHarris/repos","events_url":"https://api.github.com/users/LeoJHarris/events{/privacy}","received_events_url":"https://api.github.com/users/LeoJHarris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-13T05:04:02Z","updated_at":"2018-09-13T19:30:46Z","closed_at":null,"author_association":"NONE","body":"I know somebody had this issue the issue was closed but I cant figure out how to setup this plugin I am getting:\r\n\r\n`Unhandled Exception:\r\n\r\nJava.Lang.IllegalStateException: Error using newLatLngBounds(LatLngBounds, int): Map size can't be 0. Most likely, layout has not yet occured for the map view.  Either wait until layout has occurred or use newLatLngBounds(LatLngBounds, int, int, int) which allows you to specify the map's dimensions. occurred`\r\n\r\nBasically I have my map in the xaml:\r\n\r\n`<tk:TKCustomMap \r\n                            HorizontalOptions=\"FillAndExpand\"\r\n                            MapReady=\"DirectionsMap_MapReady\" \r\n                            x:Name=\"DirectionsMap\"\r\n                            VerticalOptions=\"FillAndExpand\" />`\r\n\r\nIn my code behind I have:\r\n\r\n`private async void DirectionsMap_MapReady(object sender, EventArgs e)\r\n        {\r\n            Plugin.Geolocator.Abstractions.Position myPosition = await Plugin.Geolocator.CrossGeolocator.Current.GetLastKnownLocationAsync();\r\n\r\n            IEnumerable<Plugin.Geolocator.Abstractions.Position> addressPositions = await Plugin.Geolocator.CrossGeolocator.Current.GetPositionsForAddressAsync(\"157 Hobson St, Auckland\");\r\n\r\n            if (addressPositions.Any() && myPosition != null)\r\n            {\r\n                Plugin.Geolocator.Abstractions.Position pos = addressPositions.First();\r\n\r\n                TKRoute route = new TKRoute\r\n                {\r\n                    TravelMode = TKRouteTravelMode.Driving\r\n                };\r\n\r\n                Position myposition = new Position(myPosition.Latitude, myPosition.Longitude);\r\n                Position toposition = new Position(pos.Latitude, pos.Longitude);\r\n                route.Source = myposition;\r\n                route.Destination = toposition;\r\n                route.Color = Color.Red;\r\n                route.TravelMode = TKRouteTravelMode.Any;\r\n                route.LineWidth = 2;\r\n                routes.Add(route);\r\n\r\n                DirectionsMap.RouteCalculationFinishedCommand = new Command(() =>\r\n                {\r\n                    if (routes.All(i => i.IsCalculated))\r\n                    {\r\n                        DirectionsMap.FitToMapRegions(routes.Select(i => i.Bounds), true);\r\n                    }\r\n                });\r\n            }\r\n            else\r\n            {\r\n                Acr.UserDialogs.UserDialogs.Instance.Toast(\"Hotel not found\");\r\n            }\r\n        }`\r\n\r\nWhats wrong with this code the error I am getting is in the android library within the FitToMapRegions I think when I looked at the source code of the plugin.\r\n\r\nIs there something I am doing wrong here??"},"comment":{"url":"https://api.github.com/repos/TorbenK/TK.CustomMap/issues/comments/421125020","html_url":"https://github.com/TorbenK/TK.CustomMap/issues/345#issuecomment-421125020","issue_url":"https://api.github.com/repos/TorbenK/TK.CustomMap/issues/345","id":421125020,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTEyNTAyMA==","user":{"login":"Umar3x","id":15191066,"node_id":"MDQ6VXNlcjE1MTkxMDY2","avatar_url":"https://avatars3.githubusercontent.com/u/15191066?v=4","gravatar_id":"","url":"https://api.github.com/users/Umar3x","html_url":"https://github.com/Umar3x","followers_url":"https://api.github.com/users/Umar3x/followers","following_url":"https://api.github.com/users/Umar3x/following{/other_user}","gists_url":"https://api.github.com/users/Umar3x/gists{/gist_id}","starred_url":"https://api.github.com/users/Umar3x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Umar3x/subscriptions","organizations_url":"https://api.github.com/users/Umar3x/orgs","repos_url":"https://api.github.com/users/Umar3x/repos","events_url":"https://api.github.com/users/Umar3x/events{/privacy}","received_events_url":"https://api.github.com/users/Umar3x/received_events","type":"User","site_admin":false},"created_at":"2018-09-13T19:30:46Z","updated_at":"2018-09-13T19:30:46Z","author_association":"NONE","body":"Hello,\r\n\r\nI think you sould try to set width and height request to your map. Here's an example : \r\n\r\n```\r\n      _customMap = new CustomMap(Constants.InitialLatitudeMap, Constants.InitialLongitudeMap, 200)\r\n            {\r\n                HeightRequest = 80,\r\n                WidthRequest = 960,\r\n                VerticalOptions = LayoutOptions.FillAndExpand,\r\n                HorizontalOptions = LayoutOptions.FillAndExpand,\r\n                IsShowingUser = true,\r\n                IsClusteringEnabled = false\r\n            };\r\n\r\n```"}}
{"actor":{"display_login":"Umar3x"}}