public static ILayer CreateCityHoverPoints() { var features = WorldCities.GenerateTop100(); return(new MemoryLayer { DataSource = new MemoryProvider <IFeature>(features), Style = CreateCityStyle(), Name = "Points", IsMapInfoLayer = true }); }
public static ILayer CreateCityHoverPoints() { var features = WorldCities.GenerateTop100(); return(new MemoryLayer { Features = features, Style = CreateCityStyle(), Name = "Points", IsMapInfoLayer = true }); }
public static WorldCities ProcessWorldCities(ShapefileConverter shapefile) { var cities = new WorldCities(); foreach (ShapefileRecord record in shapefile) { var item = new WorldCity(); if (record.Fields != null) { if (item.Population < 0) { item.Population = 0; } // get geo-location from shape file (SHP) item.Longitude = record.Points[0][0].X; item.Latitude = record.Points[0][0].Y; // get data about a location from database file (DBF) if (record.Fields.ContainsKey("COUNTRY_NA")) { item.CountryName = (string)(record.Fields["COUNTRY_NA"]); } if (record.Fields.ContainsKey("NAME")) { item.CityName = (string)(record.Fields["NAME"]); } if (record.Fields.ContainsKey("POPULATION")) { item.Population = (double)(record.Fields["POPULATION"]); } if (record.Fields.ContainsKey("CAPITAL")) { item.IsCapital = (string)(record.Fields["CAPITAL"]) == "N" ? false : true; } //if (item.CountryName == "US" || item.CountryName == "USA") item.CountryName = "United States"; //if (item.CountryName == "UK" || item.CountryName == "GB") item.CountryName = "United Kingdom"; item.Label = "City: " + item.CityName + ", " + item.CountryName + Environment.NewLine + "Population: " + String.Format("{0:#,##0,,.0 M}", item.Population); cities.Population.Update(item.Population); // add an item to data collection cities.Add(item); } } cities.Sort((x, y) => - x.Population.CompareTo(y.Population)); return(cities); }
public static Layer CreateWorldCitiesLayer() { var features = WorldCities.GenerateTop100(); var memoryProvider = new MemoryProvider <IFeature>(features) { CRS = "EPSG:4326" // The DataSource CRS needs to be set }; var dataSource = new ProjectingProvider(memoryProvider) { CRS = "EPSG:3857" }; return(new Layer { DataSource = dataSource, Name = "Cities", Style = CreateCityStyle(), IsMapInfoLayer = true }); }