public CartoPlaceInfo(GoogleLocationResult result) { _raw = result.RawJson; _data = new CartoPlaceData(); _data.PlaceKey = result.PlaceID; _data.GoogleKey = result.PlaceID; _data.PlaceType = result.TypedNameSource; _data.Name = TextMutate.StripAccents(result.ShortName); _data.LocalName = (_data.Name == result.LongName ? "" : result.LongName); _data.DisplayAs = (_data.Name == result.TypedName ? "" : result.TypedName); _data.Description = result.ColloquialArea; //data.Timezone = // TODO: determine timezone _data.Country = result.Country; _data.Region = result.Region; _data.Subregions = ""; if (!String.IsNullOrWhiteSpace(result.Region2)) { _data.Subregions += result.Region2; } if (!String.IsNullOrWhiteSpace(result.Region3)) { _data.Subregions += @" \ " + result.Region3; } if (!String.IsNullOrWhiteSpace(result.Region4)) { _data.Subregions += @" \ " + result.Region4; } if (!String.IsNullOrWhiteSpace(result.Region5)) { _data.Subregions += @" \ " + result.Region5; } var address = $"{result.StreeNumber} {result.Route}"; _data.Address = (String.IsNullOrWhiteSpace(address) ? result.Intersection : address); _data.Postcode = result.PostalCode; /* * _data.Premise = result.Premise; * if (!String.IsNullOrWhiteSpace(result.SubPremise)) _data.Premise += @" \ " + result.SubPremise; */ _data.Locality = result.Locality; _data.Sublocalities = result.SubLocality; _data.CenterLatitude = result.Center.Latitude; _data.CenterLongitude = result.Center.Longitude; _data.NorthLatitude = result.Bounds.NorthWest.Latitude; _data.WestLongitude = result.Bounds.NorthWest.Longitude; _data.SouthLatitude = result.Bounds.SouthEast.Latitude; _data.EastLongitude = result.Bounds.SouthEast.Longitude; // update place type based on current data MapPlaceType(); }