Esempio n. 1
0
        static async Task Main(string[] args)
        {
            var api = new RestAPI();

            CultureInfo.CurrentCulture = new CultureInfo("en-US");
            var result = await api.Get <DawaZip[]>("http://dawa.aws.dk/postnumre");

            await SaveZipAsKlm("All", result);
        }
Esempio n. 2
0
        private static async Task <List <Location> > GetBingArea(double latitude, double longitude)
        {
            var key = Environment.GetEnvironmentVariable("BINGKEY");
            var url = $"http://platform.bing.com/geo/spatial/v1/public/Geodata?SpatialFilter=GetBoundary({latitude},{longitude},0,'Postcode1',0,0)&PreferCuratedPolygons=1&$format=json&key={key}";

            var api = new RestAPI();

            var bingResult = await api.Get(url);

            if (bingResult.d.results.Count > 0)
            {
                string          coords      = bingResult.d.results[0].Primitives[0].Shape;
                List <Location> coordinates = new List <Location>();
                TryParseEncodedValue(coords.Substring(2), out coordinates);
                return(coordinates);
            }
            return(null);
        }