Exemple #1
0
        public async Task <IEnumerable <ResultItem> > GeocodeAsync(IEnumerable <string> addresses, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (addresses == null)
            {
                throw new ArgumentNullException("addresses");
            }

            string[] adr = (from a in addresses
                            where !string.IsNullOrWhiteSpace(a)
                            group a by a into ag
                            select ag.Key).ToArray();
            if (adr.IsNullOrEmpty())
            {
                throw new ArgumentException("Atleast one none blank item is required in addresses");
            }

            var f = new BatchGeocodeRequest(key, adr)
            {
                UseOSM = this.UseOSM
            };
            MapQuestResponse res = await Execute(f, cancellationToken).ConfigureAwait(false);

            return(HandleBatchResponse(res));
        }
Exemple #2
0
        public IEnumerable <ResultItem> Geocode(IEnumerable <string> addresses)
        {
            if (addresses == null)
            {
                throw new ArgumentNullException("addresses");
            }

            string[] adr = (from a in addresses
                            where !string.IsNullOrWhiteSpace(a)
                            group a by a into ag
                            select ag.Key).ToArray();
            if (adr.IsNullOrEmpty())
            {
                throw new ArgumentException("Atleast one none blank item is required in addresses");
            }

            var f = new BatchGeocodeRequest(key, adr)
            {
                UseOSM = this.UseOSM
            };
            MapQuestResponse res = Execute(f);

            return(HandleBatchResponse(res));
        }
		public ICollection<ResultItem> Geocode(IEnumerable<string> addresses)
		{
			if (addresses == null)
				throw new ArgumentNullException("addresses");

			string[] adr = (from a in addresses
							where !string.IsNullOrWhiteSpace(a)
							group a by a into ag
							select ag.Key).ToArray();
			if (adr.IsNullOrEmpty())
				throw new ArgumentException("Atleast one none blank item is required in addresses");

			var f = new BatchGeocodeRequest(key, adr) { UseOSM = this.UseOSM };
			MapQuestResponse res = Execute(f);
			return HandleBatchResponse(res);
		}