示例#1
0
        public override IList <Earthquake> Collect()
        {
            try
            {
                IList <Earthquake>   earthquakes     = new List <Earthquake>();
                List <MagnitudeType> MagnitudesTypes = new List <MagnitudeType>();
                List <Place>         Places          = new List <Place>();

                var docEMSC = SourceManagerXML.GetDocument(WebSiteUrl);


                //check if data is available
                if (string.IsNullOrEmpty(docEMSC.Document.ToString()))
                {
                    UpdateSourceStatus(false);
                    return(new List <Earthquake>());
                }

                UpdateSourceStatus(true);

                IEnumerable <XElement> query  = from c in docEMSC.Descendants("item") select c;
                IEnumerable <XElement> query5 = from d in query.Descendants("title") select d.Parent;

                foreach (var aaa in query5)
                {
                    var      cantidad = query5.Count();
                    string[] asdf     = aaa.ToString().Split(new Char[] { '\n' });

                    var viewCountry = asdf[1].Replace("<title>", "").Replace("</title>", "").Trim();

                    //IGNORES WORLD EARTHQUAKES ----Only parse ARGENTINA CHILE AND BOLIVIA ....
                    if (viewCountry.Contains("ARGENTINA") || viewCountry.Contains("CHILE") || viewCountry.Contains("BOLIVIA") ||
                        viewCountry.Contains("PARAGUAY") || viewCountry.Contains("URUGUAY"))
                    {
                        string   LocalDateTimeHour = string.Empty;
                        string   LocalDateTimeYear = string.Empty;
                        DateTime UtcDateTime       = new DateTime();
                        decimal  Latitude          = 0;
                        decimal  Longitude         = 0;
                        decimal  Depth             = 0;
                        decimal  Magnitude         = 0;

                        Place         Place         = null;
                        MagnitudeType MagnitudeType = null;
                        bool          IsSensible    = false;

                        #region PARSE-REGION
                        for (int j = 1; j < asdf.Length; ++j)
                        {
                            var value = asdf[j];
                            switch (j)
                            {
                            //Local time
                            case (1):


                                var haber = value.Replace("<title>", "").Replace("</title>", "").Trim();

                                string[] ololo = haber.Split(',');
                                if (ololo.Length == 2)
                                {
                                    var carac = ololo[0].ToCharArray();

                                    int cantidadEspacios = 0;

                                    StringBuilder sbs           = new StringBuilder();
                                    bool          anteriorSpace = false;

                                    for (int i = 0; i < carac.Length; ++i)
                                    {
                                        if (cantidadEspacios == 2)
                                        {
                                            sbs.Append(carac[i]);
                                        }

                                        if (cantidadEspacios < 2 && carac[i].Equals(' ') && !anteriorSpace)
                                        {
                                            cantidadEspacios++;
                                            anteriorSpace = true;
                                        }
                                        else
                                        {
                                            anteriorSpace = false;
                                        }
                                    }


                                    var locationTemp = sbs.ToString().Trim();

                                    var location = locationTemp.ToString().ToUpper();
                                    var pais     = ololo[1].Trim().ToUpper();

                                    var pla = Places.Where(pl => pl.PlaceName.Equals(location) && pl.Country.Equals(pais)).FirstOrDefault();

                                    if (pla == null)
                                    {
                                        pla = this.IPlaceRepository.FindByPlaceCountry(location, pais);
                                        if (pla != null)
                                        {
                                            Places.Add(pla);
                                        }
                                    }

                                    if (pla == null)
                                    {
                                        pla = this.IPlaceFactory.Create(location, pais);
                                        IPlaceRepository.DbContext.Places.Add(pla);
                                        IPlaceRepository.Save();
                                        Places.Add(pla);
                                    }

                                    Place = pla;
                                }
                                else
                                {
                                    ololo[0] = ololo[0].ToUpper();
                                    char[] carac            = ololo[0].ToCharArray();
                                    int    cantidadEspacios = 0;

                                    StringBuilder sbs           = new StringBuilder();
                                    bool          anteriorSpace = false;
                                    for (int i = 0; i < carac.Length; ++i)
                                    {
                                        if (cantidadEspacios == 2)
                                        {
                                            sbs.Append(carac[i]);
                                        }

                                        if (cantidadEspacios < 2 && carac[i].Equals(' ') && !anteriorSpace)
                                        {
                                            cantidadEspacios++;
                                            anteriorSpace = true;
                                        }
                                        else
                                        {
                                            anteriorSpace = false;
                                        }
                                    }

                                    string pais     = string.Empty;
                                    string location = string.Empty;

                                    if (!sbs.ToString().Equals(string.Empty))
                                    {
                                        var locationTemp = sbs.ToString().Trim();

                                        string[] aaasas = locationTemp.Split(' ');

                                        var paisTemp = aaasas[0].Trim().ToUpper();

                                        location = locationTemp.ToString().ToUpper();


                                        if (side.Contains(paisTemp))
                                        {
                                            pais = aaasas[aaasas.Length - 1];
                                        }
                                        else
                                        {
                                            pais = location;
                                        }


                                        Place = this.IPlaceRepository.FindByPlaceCountry(location, pais);
                                        if (Place == null)
                                        {
                                            Place = this.IPlaceFactory.Create(location, pais);
                                            IPlaceRepository.DbContext.Places.Add(Place);
                                            IPlaceRepository.Save();
                                        }
                                    }

                                    var pla = Places.Where(pl => pl.PlaceName.Equals(location) && pl.Country.Equals(pais)).FirstOrDefault();

                                    if (pla == null)
                                    {
                                        pla = this.IPlaceRepository.FindByPlaceCountry(location, pais);
                                        if (pla != null)
                                        {
                                            Places.Add(pla);
                                        }
                                    }

                                    if (pla == null)
                                    {
                                        pla = this.IPlaceFactory.Create(location, pais);
                                        IPlaceRepository.DbContext.Places.Add(pla);
                                        IPlaceRepository.Save();
                                        Places.Add(pla);
                                    }

                                    Place = pla;
                                }

                                break;

                            //ignore, id earthquake
                            case (2):
                                break;

                            //Latitude
                            case (3):
                                var decimalString = value.Replace("<geo:lat xmlns:geo=\"http://www.w3.org/2003/01/geo/\">", "").Replace("</geo:lat>", "").Trim();
                                Latitude = Convert.ToDecimal(decimalString, CultureInfo.InvariantCulture);
                                break;

                            //Longitude
                            case (4):
                                var decimalString1 = value.Replace("<geo:long xmlns:geo=\"http://www.w3.org/2003/01/geo/\">", "").Replace("</geo:long>", "").Trim();
                                Longitude = Convert.ToDecimal(decimalString1, CultureInfo.InvariantCulture);
                                break;

                            //Depth
                            case (5):
                                var      decimalString2 = value.Replace("<emsc:depth xmlns:emsc=\"http://www.emsc-csem.org\">", "").Replace("</emsc:depth>", "").Trim();
                                string[] tempString     = decimalString2.Split(' ');
                                Depth = Convert.ToDecimal(tempString[0], CultureInfo.InvariantCulture);
                                break;

                            //Magnitude
                            case (6):
                                var      decimalString3 = value.Replace("<emsc:magnitude xmlns:emsc=\"http://www.emsc-csem.org\">", "").Replace("</emsc:magnitude>", "").Trim();
                                string[] magnitudArray  = decimalString3.Split(' ');
                                Magnitude = Convert.ToDecimal(magnitudArray[magnitudArray.Length - 1], CultureInfo.InvariantCulture);


                                magnitudArray[0] = magnitudArray[0].ToUpper();

                                var mtypes = MagnitudesTypes.Where(mt => mt.Type.Equals(magnitudArray[0])).FirstOrDefault();

                                if (mtypes == null)
                                {
                                    mtypes = this.IMagnitudeTypeRepository.FindByType(magnitudArray[0]);
                                    if (mtypes != null)
                                    {
                                        MagnitudesTypes.Add(mtypes);
                                    }
                                }

                                if (mtypes == null)
                                {
                                    mtypes = this.IMagnitudeTypeFactory.Create(magnitudArray[0]);
                                    IMagnitudeTypeRepository.DbContext.MagtitudesTypes.Add(mtypes);
                                    IMagnitudeTypeRepository.Save();
                                    MagnitudesTypes.Add(mtypes);
                                }

                                MagnitudeType = mtypes;

                                break;

                            //DateTime
                            case (7):
                                var           decimalString4 = value.Replace("<emsc:time xmlns:emsc=\"http://www.emsc-csem.org\">", "").Replace("</emsc:time>", "").Trim();
                                string[]      a1             = decimalString4.Split('-');
                                string[]      a2             = a1[2].Split(' ');
                                string[]      a3             = a2[1].Replace("UTC", "").Split(':');
                                StringBuilder sb             = new StringBuilder();
                                const string  format         = "yyyy/MM/dd HH:mm:ss";
                                string        stringValue    = sb.Append(a1[0]).Append("/").Append(a1[1]).Append("/").Append(a2[0]).Append(" ")
                                                               .Append(a3[0]).Append(":").Append(a3[1]).Append(":").Append(a3[2]).ToString();

                                UtcDateTime = DateTime.ParseExact(stringValue, format, CultureInfo.InvariantCulture);

                                break;
                            }
                        }
                        //si informan desde el exterior un sismo en Argentina, da por hecho que es sensible
                        if (Magnitude > Convert.ToDecimal(4.5) || viewCountry.Contains("ARGENTINA"))
                        {
                            IsSensible = true;
                        }
                        if (viewCountry.Contains("ARGENTINA") || (!viewCountry.Contains("ARGENTINA") && IsSensible))
                        {
                            Earthquake earthquake = this.IEarthqueakeFactory.Create(UtcDateTime, Latitude, Longitude, Depth,
                                                                                    Magnitude, IsSensible, Place, Source, MagnitudeType);
                            earthquakes.Add(earthquake);
                        }



                        #endregion
                    }
                }



                return(earthquakes);
            }
            catch (Exception ex)
            {
                ExceptionUtility.Error(ex, this.GetType());
                return(new List <Earthquake>());
            }
        }
示例#2
0
 public EMSCEarthquakeCollectorXML(IWebSourceManagerXML webSourceManagerXML, string webSiteUrl, Source source,
                                   IPlaceRepository iPlaceRepository, IPlaceFactory iPlaceFactory, IMagnitudeTypeRepository iMagnitudeTypeRepository,
                                   IMagnitudeTypeFactory iMagnitudeTypeFactory, IEarthqueakeFactory iEarthqueakeFactory) :
     base(webSiteUrl, source, iPlaceRepository, iPlaceFactory, iMagnitudeTypeRepository,
          iMagnitudeTypeFactory, iEarthqueakeFactory)
 {
     base.SourceManagerXML = webSourceManagerXML;
     base.WebSiteUrl       = webSiteUrl;
     Source = source;
     this.IPlaceRepository         = iPlaceRepository;
     this.IPlaceFactory            = iPlaceFactory;
     this.IMagnitudeTypeRepository = iMagnitudeTypeRepository;
     this.IMagnitudeTypeFactory    = iMagnitudeTypeFactory;
     this.IEarthqueakeFactory      = iEarthqueakeFactory;
 }
示例#3
0
        public override IList <Earthquake> Collect()
        {
            try
            {
                IList <Earthquake>   earthquakes     = new List <Earthquake>();
                List <MagnitudeType> MagnitudesTypes = new List <MagnitudeType>();
                List <Place>         Places          = new List <Place>();

                var docArgentina = SourceManagerHTML.GetDocument(WebSiteUrl);


                //check if data is available
                if (string.IsNullOrEmpty(docArgentina.DocumentNode.InnerText))
                {
                    UpdateSourceStatus(false);
                    return(new List <Earthquake>());
                }
                UpdateSourceStatus(true);

                // Get all tables in the document
                HtmlNodeCollection tables = docArgentina.DocumentNode.SelectNodes("//table");

                var earthquakeTable = tables.Where(tb => tb.Id.Equals("sismos")).Single();



                // Iterate all rows in the first table
                HtmlNodeCollection rows1 = earthquakeTable.SelectNodes(".//tr");
                if (rows1.Count > 1)
                {
                    for (int i = 2; rows1.Count > i; ++i)
                    {
                        // Iterate all columns in this row
                        HtmlNodeCollection cols = rows1[i].SelectNodes(".//td");
                        var cantidadColumnas    = cols.Count;
                        if (cantidadColumnas >= 8)
                        {
                            var  sensible1  = cols[8];
                            bool isSensible = sensible1.OuterHtml.Contains("#D40000");



                            string        LocalDateTimeYear = string.Empty;
                            DateTime      UTCDateTime       = new DateTime();
                            decimal       Latitude          = 0;
                            decimal       Longitude         = 0;
                            decimal       Depth             = 0;
                            decimal       Magnitude         = 0;
                            decimal       decimalValue      = 0;
                            Place         Place             = null;
                            MagnitudeType MagnitudeType     = null;

                            for (int j = 0; j < cols.Count; ++j)
                            {
                                string value = cols[j].InnerText;
                                switch (j)
                                {
                                //Local time
                                case (1):
                                    LocalDateTimeYear = value;
                                    break;

                                case (2):
                                    StringBuilder sb          = new StringBuilder();
                                    string        stringValue = sb.Append(LocalDateTimeYear).Append(" ").Append(value).ToString();
                                    const string  format      = "dd/MM/yyyy HH:mm:ss";
                                    var           realtime    = DateTime.ParseExact(stringValue, format, CultureInfo.InvariantCulture);
                                    UTCDateTime = GlobalWebData.ToUniversalTime(realtime);
                                    break;

                                //Latitude
                                case (3):
                                    /*string[] coord1 = value.Split('�');
                                     * string[] coord2 = coord1[1].Split('\'');
                                     * var degrees = Convert.ToDecimal(coord1[0], CultureInfo.InvariantCulture);
                                     * var minutes = Convert.ToDecimal(coord2[0], CultureInfo.InvariantCulture);
                                     * var seconds = Convert.ToDecimal(coord2[1], CultureInfo.InvariantCulture);
                                     * Latitude = Earthquake.GetDecimal(degrees, minutes, seconds);*/
                                    Latitude = decimal.Parse(value, CultureInfo.InvariantCulture);
                                    break;

                                //Longitude
                                case (4):
                                    /*string[] coord3 = value.Split('�');
                                     * string[] coord4 = coord3[1].Split('\'');
                                     * var degrees1 = Convert.ToDecimal(coord3[0], CultureInfo.InvariantCulture);
                                     * var minutes1 = Convert.ToDecimal(coord4[0], CultureInfo.InvariantCulture);
                                     * var seconds1 = Convert.ToDecimal(coord4[1], CultureInfo.InvariantCulture);
                                     * Longitude = Earthquake.GetDecimal(degrees1, minutes1, seconds1);*/
                                    Longitude = decimal.Parse(value, CultureInfo.InvariantCulture);
                                    break;

                                //Depth
                                case (5):
                                    string[] depthArray = value.Split(' ');
                                    decimalValue = Convert.ToDecimal(depthArray[0], CultureInfo.InvariantCulture);
                                    Depth        = decimalValue;
                                    break;

                                //Magnitude
                                case (6):
                                    string[] magnitudArray = value.Split(' ');
                                    decimalValue = Convert.ToDecimal(magnitudArray[0], CultureInfo.InvariantCulture);
                                    Magnitude    = decimalValue;

                                    //tambien inferir que los sismos de 3.5 o mas son sensibles...

                                    double? d            = 3.5;
                                    decimal?topMagnitude = (decimal?)d.Value;
                                    // decimal topMagnitude = decimal.Parse( "3.5");
                                    if (Magnitude >= topMagnitude)
                                    {
                                        isSensible = true;
                                    }
                                    var mtypes = MagnitudesTypes.Where(mt => mt.Type.Equals(magnitudeTypeArgentina)).FirstOrDefault();

                                    if (mtypes == null)
                                    {
                                        mtypes = this.IMagnitudeTypeRepository.FindByType(magnitudeTypeArgentina);
                                        if (mtypes != null)
                                        {
                                            MagnitudesTypes.Add(mtypes);
                                        }
                                    }

                                    if (mtypes == null)
                                    {
                                        mtypes = this.IMagnitudeTypeFactory.Create(magnitudeTypeArgentina);
                                        IMagnitudeTypeRepository.DbContext.MagtitudesTypes.Add(mtypes);
                                        IMagnitudeTypeRepository.Save();
                                        MagnitudesTypes.Add(mtypes);
                                    }

                                    MagnitudeType = mtypes;
                                    break;

                                //Place
                                case (7):
                                    value = value.ToUpper();
                                    string country;

                                    if (value.Contains("CHILE"))
                                    {
                                        country = countryChile;
                                    }
                                    else if (value.Contains("BOLIVIA"))
                                    {
                                        country = countryBolivia;
                                    }
                                    else
                                    {
                                        country = countryArgentina;
                                    }

                                    var pla = Places.Where(pl => pl.PlaceName.Equals(value) && pl.Country.Equals(country)).FirstOrDefault();

                                    if (pla == null)
                                    {
                                        pla = this.IPlaceRepository.FindByPlaceCountry(value, country);
                                        if (pla != null)
                                        {
                                            Places.Add(pla);
                                        }
                                    }

                                    if (pla == null)
                                    {
                                        pla = this.IPlaceFactory.Create(value, country);
                                        IPlaceRepository.DbContext.Places.Add(pla);
                                        IPlaceRepository.Save();
                                        Places.Add(pla);
                                    }

                                    Place = pla;
                                    break;
                                }
                            }
                            Earthquake earthquake = this.IEarthqueakeFactory.Create(UTCDateTime, Latitude, Longitude, Depth,
                                                                                    Magnitude, isSensible, Place, Source, MagnitudeType);
                            earthquakes.Add(earthquake);
                        }
                        else
                        {
                            ExceptionUtility.Warn(string.Concat("cantidad de columnas", " ", cantidadColumnas, " ", this.GetType()));
                        }
                    }
                }
                return(earthquakes);
            }
            catch (Exception ex)
            {
                ExceptionUtility.Error(ex, this.GetType());
                return(new List <Earthquake>());
            }
        }
示例#4
0
 public InpresEarthquakeCollectorHtml(IWebSourceManagerHtml webSourceManagerHtml, string webSiteUrl, Source source,
                                      IPlaceRepository iPlaceRepository, IPlaceFactory iPlaceFactory, IMagnitudeTypeRepository iMagnitudeTypeRepository,
                                      IMagnitudeTypeFactory iMagnitudeTypeFactory, IEarthqueakeFactory iEarthqueakeFactory) :
     base(webSiteUrl, source, iPlaceRepository, iPlaceFactory, iMagnitudeTypeRepository, iMagnitudeTypeFactory, iEarthqueakeFactory)
 {
     base.SourceManagerHTML = webSourceManagerHtml;
     base.WebSiteUrl        = webSiteUrl;
     Source = source;
     this.IPlaceRepository         = iPlaceRepository;
     this.IPlaceFactory            = iPlaceFactory;
     this.IMagnitudeTypeRepository = iMagnitudeTypeRepository;
     this.IMagnitudeTypeFactory    = iMagnitudeTypeFactory;
     this.IEarthqueakeFactory      = iEarthqueakeFactory;
 }
示例#5
0
 public EarthquakeCollector(string webSiteUrl, Source source,
                            IPlaceRepository iPlaceRepository, IPlaceFactory iPlaceFactory, IMagnitudeTypeRepository iMagnitudeTypeRepository,
                            IMagnitudeTypeFactory iMagnitudeTypeFactory, IEarthqueakeFactory iEarthqueakeFactory)
 {
     WebSiteUrl                    = webSiteUrl;
     Source                        = source;
     this.IPlaceRepository         = iPlaceRepository;
     this.IPlaceFactory            = iPlaceFactory;
     this.IMagnitudeTypeRepository = iMagnitudeTypeRepository;
     this.IMagnitudeTypeFactory    = iMagnitudeTypeFactory;
     this.IEarthqueakeFactory      = iEarthqueakeFactory;
 }
示例#6
0
        public override IList <Earthquake> Collect()
        {
            try
            {
                IList <Earthquake>   earthquakes     = new List <Earthquake>();
                List <MagnitudeType> MagnitudesTypes = new List <MagnitudeType>();
                List <Place>         Places          = new List <Place>();

                var docChile = SourceManagerHTML.GetDocument(WebSiteUrl);


                //check if data is available
                if (string.IsNullOrEmpty(docChile.DocumentNode.InnerText))
                {
                    UpdateSourceStatus(false);
                    return(new List <Earthquake>());
                }

                UpdateSourceStatus(true);


                // Get all tables in the document
                HtmlNodeCollection tables = docChile.DocumentNode.SelectNodes("//table");

                var earthquakeTable = tables[0];

                // Iterate all rows in the first table
                HtmlNodeCollection rows = earthquakeTable.SelectNodes(".//tr");
                if (rows.Count > 1)
                {
                    for (int i = 1; rows.Count > i; ++i)
                    {
                        bool IsSensible = false;
                        //determina si fue percibido
                        string sensible = rows[i].Attributes[0].Value;

                        if (sensible.Contains("sensible"))
                        {
                            IsSensible = true;
                        }



                        //Si es percibido entonces obtengo los datos
                        if (IsSensible)
                        {
                            // Iterate all columns in this row
                            HtmlNodeCollection cols = rows[i].SelectNodes(".//th");
                            if (cols == null)
                            {
                                cols = rows[i].SelectNodes(".//td");
                            }

                            DateTime      UTCDateTime   = new DateTime();
                            decimal       Latitude      = 0;
                            decimal       Longitude     = 0;
                            decimal       Depth         = 0;
                            decimal       Magnitude     = 0;
                            decimal       decimalValue  = 0;
                            Place         Place         = null;
                            MagnitudeType MagnitudeType = null;

                            for (int j = 1; j < cols.Count; ++j)
                            {
                                string value = cols[j].InnerText;
                                switch (j)
                                {
                                //Local time : ignore
                                case (0):
                                    break;

                                //UTC time
                                case (1):
                                    const string format = "yyyy/MM/dd HH:mm:ss";
                                    UTCDateTime = DateTime.ParseExact(value, format, CultureInfo.InvariantCulture);
                                    break;

                                //Latitude
                                case (2):
                                    Latitude = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
                                    break;

                                //Longitude
                                case (3):
                                    Longitude = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
                                    break;

                                //Depth
                                case (4):
                                    Depth = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
                                    break;

                                //Magnitude
                                case (5):
                                    string[] magnitudArray = value.Trim().Split(' ');
                                    decimalValue = Convert.ToDecimal(magnitudArray[0], CultureInfo.InvariantCulture);
                                    Magnitude    = decimalValue;

                                    var mtypes = MagnitudesTypes.Where(mt => mt.Type.Equals(magnitudeTypeChile)).FirstOrDefault();

                                    if (mtypes == null)
                                    {
                                        mtypes = this.IMagnitudeTypeRepository.FindByType(magnitudeTypeChile);
                                        if (mtypes != null)
                                        {
                                            MagnitudesTypes.Add(mtypes);
                                        }
                                    }

                                    if (mtypes == null)
                                    {
                                        mtypes = this.IMagnitudeTypeFactory.Create(magnitudeTypeChile);
                                        IMagnitudeTypeRepository.DbContext.MagtitudesTypes.Add(mtypes);
                                        IMagnitudeTypeRepository.Save();
                                        MagnitudesTypes.Add(mtypes);
                                    }

                                    MagnitudeType = mtypes;

                                    break;

                                //Place
                                case (7):
                                    //"AR\r\n"
                                    string        realCountry /*= countryChile*/;
                                    StringBuilder countrySB = new StringBuilder();
                                    countrySB.Append("http://api.geonames.org/countryCode?");

                                    var lat1 = Latitude.ToString().Replace(",", ".");
                                    lat1 = lat1.Remove(6, 1);

                                    var long2 = Longitude.ToString().Replace(",", ".");
                                    long2 = long2.Remove(6, 1);

                                    countrySB.Append("lat=").Append(lat1);
                                    countrySB.Append("&");
                                    countrySB.Append("lng=").Append(long2);
                                    countrySB.Append("&username=argentinaearthquake");

                                    var findedCountry = SourceManagerHTML.GetDocument(countrySB.ToString());
                                    //AR\r\n
                                    if (!string.IsNullOrEmpty(findedCountry.DocumentNode.InnerText) && findedCountry.DocumentNode.InnerText.Contains("AR"))
                                    {
                                        //si informan desde chile un sismo en Argentina, da por hecho que es sensible
                                        IsSensible  = true;
                                        realCountry = countryArgentina;
                                    }
                                    //CL\r\n
                                    else if (!string.IsNullOrEmpty(findedCountry.DocumentNode.InnerText) && findedCountry.DocumentNode.InnerText.Contains("CL"))
                                    {
                                        realCountry = countryChile;
                                    }
                                    //BL\r\n   //Error: no country code found
                                    else if (!string.IsNullOrEmpty(findedCountry.DocumentNode.InnerText) && findedCountry.DocumentNode.InnerText.Contains("BL") && !findedCountry.DocumentNode.InnerText.Contains("no country code found"))
                                    {
                                        realCountry = countryBolivia;
                                    }

                                    else
                                    {
                                        realCountry = countryChile;
                                        if (!findedCountry.DocumentNode.InnerText.Contains("no country code found"))
                                        {
                                            ExceptionUtility.Warn(string.Concat("GEONAMES-API, CHILE COLLECTOR ", findedCountry.DocumentNode.InnerText));
                                        }

                                        //"no country code found" : pacific ocean geopoint
                                    }
                                    value = value.ToUpper();

                                    var pla = Places.Where(pl => pl.PlaceName.Equals(value) && pl.Country.Equals(realCountry)).FirstOrDefault();

                                    if (pla == null)
                                    {
                                        pla = this.IPlaceRepository.FindByPlaceCountry(value, realCountry);
                                        if (pla != null)
                                        {
                                            Places.Add(pla);
                                        }
                                    }

                                    if (pla == null)
                                    {
                                        pla = this.IPlaceFactory.Create(value, realCountry);
                                        IPlaceRepository.DbContext.Places.Add(pla);
                                        IPlaceRepository.Save();
                                        Places.Add(pla);
                                    }

                                    Place = pla;
                                    break;
                                }
                            }
                            Earthquake earthquake = this.IEarthqueakeFactory.Create(UTCDateTime, Latitude, Longitude, Depth,
                                                                                    Magnitude, IsSensible, Place, Source, MagnitudeType);
                            earthquakes.Add(earthquake);
                        }
                    }
                }
                return(earthquakes);
            }
            catch (Exception ex)
            {
                ExceptionUtility.Error(ex, this.GetType());
                return(new List <Earthquake>());
            }
        }