Распарсить файл xml из mapsplatform.google //не удается получить доступ к файлу
Необходимо распарсить xml файл, чтобы получить данные адресата
используется гугл вычисление координат в xml формате, которое у меня показывает сообщение
You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account
о отказе в запросе показания данного файла //для вычитания Latitude and Longitude.
Подскажите, что нужно сделать, чтобы иметь доступ к данному файлу гугл (открыть аккаунт, либо другое) ?
код, модели, который парсит этот файл
using System;
using System.Xml;
namespace MapsPeople.Models
{
public class MapManager
{
XmlDocument xd;
public string Lat { get; set; }
public string Lng { get; set; }
public string Error { get; set; }
const string UrlGoogle = "https://maps.google.com/maps/api/geocode/xml?address=";
const string XmlPath = "GeocodeResponse/result/geometry/location";
public bool ParseAddress(string address)
{
try
{
Error = "";
xd = new XmlDocument();
xd.LoadXml(UrlGoogle + address); // todo:(for later) manage unicode
XmlNode node = xd.SelectSingleNode(XmlPath);
if (node == null)
return false;
Lat = node.ChildNodes[0].InnerText.Trim();
Lng = node.ChildNodes[1].InnerText.Trim();
return true;
}
catch (Exception ex)
{
Lat = "0";
Lng = "0";
Error = ex.Message;
}
return false;
}
}
}