public MapViewModel(IBingMapsApi bingMaps, ICensusApi censusApi) { this.bingMaps = bingMaps; this.censusApi = censusApi; _items = new ObservableCollection<PopulatedEntityViewModel>(); _centerOfUs = new Coordinates(39.833333, -98.583333); _zoomLevel = 5.0; }
public async Task SelectLocation(Coordinates location) { Address address = await bingMaps.GetAddress(location); if (address == null) return; string fips = Mappings.StateAbbreviationToFips(address.AdminDistrict); if (string.IsNullOrEmpty(fips)) return; var population = await censusApi.GetPopulationForZipCode(fips, address.PostalCode); if (population == null) return; Items.Add(new PopulatedZipCode(new UsState(fips, string.Format("{0} ({1})", address.Locality, address.PostalCode), location.Latitude, location.Longitude)) { Population = population }); }
public CensusEntityViewModel(string fips, string name, double lat, double lng) { Fips = fips; Name = name; Center = new Coordinates(lat, lng); }