コード例 #1
0
        private void TimerOSMSearcher_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (TickStatusOsm)
            {
                _logger.Info("Пропущений тік...");
                return;
            }


            lock (lockerOSM)
            {
                TickStatusOsm = true;
                ProcessPoint point = hdb.GetEpicentrKPointForGeocoding();
                _logger.Info(string.Format("{0} {1} {2}", point.CardId.ToString(), "Address Get DB to OSM:", point.SourceAddress));

                if (point != null)
                {
                    using (OsmPointsSearcher osp = new OsmPointsSearcher())
                    {
                        point = osp.IdentifyCoordinatePoint(point);
                    }
                }
                TickStatusOsm = false;
            }
        }
コード例 #2
0
        public ProcessPoint IdentifyCoordinatePoint(ProcessPoint point)
        {
            //if (point != null)
            //{
            //    _logger.Info(string.Format("{0} {1} {2}", point.CardId.ToString(), "Address Get DB:", point.SourceAddress));
            //}

            point = hgoogle.GetRequestXmlDocumentPointsByAddress(point);
            point.SearchEngine = SearchEngine.Google;

            _logger.Info(string.Format("{0} SearchEngineStatus:{5}, {1} {2} Lat={3}, Lng={4}",
                                       point.CardId.ToString(),
                                       "Point Get Googe:",
                                       point.FormattedAddress,
                                       point.Coordinate != null ? point.Coordinate.Lat : "none",
                                       point.Coordinate != null ? point.Coordinate.Lng : "none",
                                       point.PStatus.ToString()
                                       ));

            if (point.Coordinate != null)
            {
                point.SetSearchEngineStatus("OK");
            }

            if (point.CardId > 0)
            {
                point.Save(hdb);
                _logger.Info(string.Format("{0} {1}", point.CardId.ToString(), "Point Set Data in DB"));
            }

            return(point);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        public void IdentifyCoordinatesOne(PointType pt)
        {
            if (GetRemainingAttemptsCount() <= 0)
            {
                return;
            }

            switch (pt)
            {
            case PointType.CustomerEpicentrK:
            {
                ProcessPoint point = hdb.GetEpicentrKPointForGeocoding();

                _logger.Info(string.Format("{0} {1} {2}", point.CardId.ToString(), "Address Get DB:", point.SourceAddress));

                point = hgoogle.GetRequestXmlDocumentPointsByAddress(point);

                _logger.Info(string.Format("{0} SearchEngineStatus:{5}, {1} {2} Lat={3}, Lng={4}",
                                           point.CardId.ToString(),
                                           "Point Get Googe:",
                                           point.FormattedAddress,
                                           point.Coordinate != null ? point.Coordinate.Lat : "none",
                                           point.Coordinate != null ? point.Coordinate.Lng : "none",
                                           point.PStatus.ToString()
                                           ));

                if (point.CardId > 0)
                {
                    point.Save(hdb);
                    _logger.Info(string.Format("{0} {1}", point.CardId.ToString(), "Point Set Data in DB"));
                }
                break;
            }

            case PointType.BoardPoint:
            {
                break;
            }

            case PointType.CustomerNewLine:
            {
                break;
            }

            case PointType.MarketPoint:
            {
                break;
            }
            }
        }
コード例 #4
0
        /*
         *          using (OsmPointsSearcher osp = new OsmPointsSearcher())
         *          {
         *              point = osp.IdentifyCoordinatePoint(point);
         *          }
         */

        private void OnTimerTimerGoogleSearcher(object sender, System.Timers.ElapsedEventArgs e)
        {
            /*
             * 1. Беремо адресу покупця епицентра (PointMap)
             * 2. Перевіряємо Osm,
             *      -> нема Перевіряємо Google
             *          -> нема або закінчилась кількіть спроб -> перевіряємо через Yandex
             */

            if (TickStatusGoogle)
            {
                _logger.Info("Пропущений тік Google...");
                return;
            }


            lock (lockerGoogle)
            {
                this.TickStatusGoogle = true;


                if (hdb.GetRemainingAttemptsCount() <= 0)
                {
                    this.TickStatusGoogle = false;  // важно!
                    return;
                }

                ProcessPoint point = hdb.GetEpicentrKPointForGeocoding();

                if (point == null)
                {
                    return;
                }

                _logger.Info(string.Format("{0} {1} {2}", point.CardId.ToString(), "Address Get DB to Google:", point.SourceAddress));

                if (point != null)
                {
                    //if (point.Coordinate == null)
                    //{
                    using (GooglePointsSearcher cgp = new GooglePointsSearcher(hdb))
                    {
                        cgp.IdentifyCoordinatePoint(point);
                    }
                    //}
                }
                this.TickStatusGoogle = false;
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: ahaonkoval/GooglePoints
        public ProcessPoint Get(ProcessPoint point)
        {
            WebClientExtended client = new WebClientExtended();

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["isProxy"]))
            {
                string Host            = ConfigurationManager.AppSettings["ProxyHost"];
                int    Port            = Convert.ToInt32(ConfigurationManager.AppSettings["ProxyPort"]);
                System.Net.WebProxy wp = new System.Net.WebProxy(Host, Port);
                client.Proxy = wp;
            }

            string ep  = string.Format(ConfigurationManager.AppSettings["OSMApiPath"]);
            string url = string.Format("{0}{1}&format=xml&addressdetails=1", ep, point.SourceAddress);

            string st = System.Text.Encoding.UTF8.GetString(client.DownloadData(url));

            XmlSerializer serializer = new XmlSerializer(typeof(Searchresults));

            using (TextReader tr = new StringReader(st))
            {
                Searchresults result = (Searchresults)serializer.Deserialize(tr);
                if (result.Place != null)
                {
                    point.Coordinate       = new Coordinate(result.Place.Lat, result.Place.Lon);
                    point.FormattedAddress = result.Place.Display_name;
                    point.SetSearchEngineStatus("OK");
                    point.Conteiner    = (object)result.Place;
                    point.SearchEngine = SearchEngine.Osm;
                }
                else
                {
                    point.SetSearchEngineStatus("ZERO_RESULTS");
                }

                XmlSerializer smr = new XmlSerializer(typeof(Searchresults));
                using (StringWriter tw = new StringWriter())
                {
                    smr.Serialize(tw, result);
                    point.Xml = tw.ToString();
                }


                point.Save(hdb);

                return(point);
            }
        }
コード例 #6
0
        public void GetPointsByListId(int list_id)
        {
            //TODO пишемо запит в БД через храниму процедуру gpo.get_unchecked_address
            ProcessPoint Point = new ProcessPoint();

            Point.Type = PointType.CustomerEpicentrK;
            string DbConnectString = ConfigurationManager.AppSettings["DbConnectString"];

            using (SqlConnection connect = new SqlConnection(DbConnectString))
            {
                SqlCommand cmd = connect.CreateCommand();
                cmd.CommandText = "dbo.get_unchecked_address";
                cmd.CommandType = CommandType.StoredProcedure;
                try
                {
                    cmd.Connection.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    DataTable     t      = new DataTable();
                    t.Load(reader);
                    cmd.Connection.Close();
                    if (t.Rows.Count > 0)
                    {
                        Point.CardId        = Convert.ToInt64(t.Rows[0]["card_id"]);
                        Point.SourceAddress = Convert.ToString(t.Rows[0]["source_address"]);
                    }
                }
                catch (Exception ex)
                {
                    SetError("Ошибка получения адреса", ex);
                }
                finally
                {
                    if (connect.State != ConnectionState.Closed)
                    {
                        connect.Close();
                    }
                }
            }

            //return Point;
            //throw new Exception(" need create 'GetPointsByListId'");
        }
コード例 #7
0
        public ProcessPoint GetRequestXmlDocumentPointsByAddress(ProcessPoint Point)
        {
            try
            {
                if (Point.CardId > 0)
                {
                    string key           = ConfigurationManager.AppSettings["GoogleKey"];
                    string GoogleApiPath = string.Format(ConfigurationManager.AppSettings["GoogleApiPath"], Point.SourceAddress, "&", key);

                    string Host = ConfigurationManager.AppSettings["ProxyHost"];
                    int    Port = Convert.ToInt32(ConfigurationManager.AppSettings["ProxyPort"]);

                    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(GoogleApiPath);

                    if (Convert.ToBoolean(ConfigurationManager.AppSettings["isProxy"]))
                    {
                        System.Net.WebProxy wp = new System.Net.WebProxy(Host, Port);
                        request.Proxy = wp;
                    }

                    HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
                    Stream          dataStream = response.GetResponseStream();

                    XmlSerializer   serializer = new XmlSerializer(typeof(GeocodeResponse));
                    GeocodeResponse message    = (GeocodeResponse)serializer.Deserialize(dataStream);
                    return(ProcessingRequestResult(Point, message));
                }
                else
                {
                    return(Point);
                }
            }
            catch (Exception ex)
            {
                SetError("Ошибка получения данных google", ex);
                return(Point);
            }
            finally
            {
            }
        }
コード例 #8
0
        public ProcessPoint GetNewLinePointForGeocoding()
        {
            ProcessPoint Point           = new ProcessPoint();
            string       DbConnectString = ConfigurationManager.AppSettings["DbConnectString"];

            using (SqlConnection connect = new SqlConnection(DbConnectString))
            {
                SqlCommand cmd = connect.CreateCommand();
                cmd.CommandText = "[nl].[get_unchecked_address]";
                cmd.CommandType = CommandType.Text;

                try
                {
                    cmd.Connection.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    DataTable     t      = new DataTable();
                    t.Load(reader);
                    cmd.Connection.Close();
                    if (t.Rows.Count > 0)
                    {
                        Point.CardId        = Convert.ToInt64(t.Rows[0]["geo_customer_id"]);
                        Point.SourceAddress = Convert.ToString(t.Rows[0]["source_address"]);
                    }
                    cmd.Connection.Open();
                }
                catch (Exception ex)
                {
                    SetError("Ошибка получения адреса", ex);
                }
                finally
                {
                    if (connect.State != ConnectionState.Closed)
                    {
                        connect.Close();
                    }
                }
            }

            return(Point);
        }
コード例 #9
0
        public void SetNewLinePoint(ProcessPoint Point)
        {
            string DbConnectString = ConfigurationManager.AppSettings["DbConnectString"];

            using (SqlConnection connect = new SqlConnection(DbConnectString))
            {
                SqlCommand cmd = connect.CreateCommand();
                cmd.CommandText = "nl.set_point_address";
                cmd.CommandType = CommandType.StoredProcedure;

                string Latitude  = Point.Coordinate == null ? string.Empty : Point.Coordinate.Lat;
                string Longitude = Point.Coordinate == null ? string.Empty : Point.Coordinate.Lng;

                cmd.Parameters.AddWithValue("@geo_customer_id", Point.CardId);
                cmd.Parameters.AddWithValue("@lat", Latitude);
                cmd.Parameters.AddWithValue("@lng", Longitude);
                cmd.Parameters.AddWithValue("@google_status", Point.PStatus.ToString());
                cmd.Parameters.AddWithValue("@formatted_address", Point.FormattedAddress == null ? "" : Point.FormattedAddress);
                cmd.Parameters.Add("@xml", SqlDbType.VarChar, 8000).Value = Point.Xml;

                try
                {
                    cmd.Connection.Open();
                    cmd.ExecuteNonQuery();
                    cmd.Connection.Close();
                }
                catch (Exception ex)
                {
                    SetError("Ошибка сохранения точки в БД", ex);
                }
                finally
                {
                    if (connect.State != ConnectionState.Closed)
                    {
                        connect.Close();
                    }
                }
            }
        }
コード例 #10
0
        public void GetYandexCoordinates()
        {
            ProcessPoint Point = hdb.GetNewLinePointForGeocoding();

            Point.Type = PointType.CustomerNewLine;

            _logger.Info(string.Format("{0} {1} {2}", Point.CardId.ToString(), "Address Get DB for check Yandex:", Point.SourceAddress));

            Point = hyandex.GetRequestXmlDocumentPointsByAddress(Point);
            _logger.Info(string.Format("{0} YandexStatus:{5}, {1} {2} Lat={3}, Lng={4}",
                                       Point.CardId.ToString(),
                                       "Point Get Yandex:",
                                       Point.FormattedAddress,
                                       Point.Coordinate != null ? Point.Coordinate.Lat : "none",
                                       Point.Coordinate != null ? Point.Coordinate.Lng : "none",
                                       Point.PStatus.ToString()
                                       ));
            if (Point.CardId > 0)
            {
                Point.Save(hdb);
                _logger.Info(string.Format("{0} {1}", Point.CardId.ToString(), "Yandex Point Set Data in DB"));
            }
        }
コード例 #11
0
        public void Get(ProcessPoint point)
        {
            WebClientExtended client = new WebClientExtended();

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["isProxy"]))
            {
                string Host            = ConfigurationManager.AppSettings["ProxyHost"];
                int    Port            = Convert.ToInt32(ConfigurationManager.AppSettings["ProxyPort"]);
                System.Net.WebProxy wp = new System.Net.WebProxy(Host, Port);
                client.Proxy = wp;
            }

            string ep  = string.Format(ConfigurationManager.AppSettings["OSMApiPath"]);
            string url = string.Format("{0}{1}&format=xml", ep, point.SourceAddress);

            string        st         = System.Text.Encoding.UTF8.GetString(client.DownloadData(url));
            XmlSerializer serializer = new XmlSerializer(typeof(Searchresults));

            using (TextReader tr = new StringReader(st))
            {
                Searchresults result = (Searchresults)serializer.Deserialize(tr);
            }
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: ahaonkoval/GooglePoints
        public void TestOne()
        {
            ProcessPoint point = hdb.GetEpicentrKPointForGeocoding();

            point = this.Get(point);
        }
コード例 #13
0
        public ProcessPoint GetRequestXmlDocumentPointsByAddress(ProcessPoint Point)
        {
            try
            {
                if (Point.CardId > 0)
                {
                    //string key = ConfigurationManager.AppSettings["GoogleKey"];
                    string GoogleApiPath = string.Format(ConfigurationManager.AppSettings["YandexApiPath"], Point.SourceAddress);

                    string Host = ConfigurationManager.AppSettings["ProxyHost"];
                    int    Port = Convert.ToInt32(ConfigurationManager.AppSettings["ProxyPort"]);

                    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(GoogleApiPath);

                    if (Convert.ToBoolean(ConfigurationManager.AppSettings["isProxy"]))
                    {
                        System.Net.WebProxy wp = new System.Net.WebProxy(Host, Port);
                        request.Proxy = wp;
                    }

                    HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
                    Stream          dataStream = response.GetResponseStream();

                    using (StreamReader reader = new StreamReader(dataStream, Encoding.UTF8))
                    {
                        string xml = string.Empty;
                        while (reader.Peek() >= 0)
                        {
                            string line = reader.ReadLine();
                            if (line.Contains("<pos>"))
                            {
                                string[] position = line.Replace("<pos>", "").Replace("</pos>", "").Trim().Split(' ');

                                if (Point.Coordinate == null)
                                {
                                    Point.Coordinate = new Coordinate(position[1], position[0]);
                                }

                                //if (Point.Coordinate.Lat == string.Empty)
                                //    Point.Coordinate.Lat = position[1];
                                //if (Point.Coordinate.Lng == string.Empty)
                                //    Point.Coordinate.Lng = position[0];
                            }
                            if (line.Contains("AddressLine"))
                            {
                                string addres = line.Replace("<AddressLine>", "").Replace("</AddressLine>", "").Trim();
                                if (Point.FormattedAddress == null)
                                {
                                    Point.FormattedAddress = addres;
                                }
                            }
                            xml = xml + line;
                        }
                        Point.Xml = xml;

                        if (Point.Coordinate != null)
                        {
                            Point.PStatus = ProcessStatus.OK;
                        }
                        else
                        {
                            Point.PStatus = ProcessStatus.EMPTY;
                        }
                    }
                    return(Point);
                }
                else
                {
                    return(Point);
                }
            }
            catch (Exception ex)
            {
                SetError("Ошибка получения данных Yandex", ex);
                return(Point);
            }
            finally
            {
            }
        }
コード例 #14
0
        void LoopThroughAllFlattenedPathPoints(PathGeometry pathGeometryDst, PathGeometry pathGeometrySrc, ProcessPoint callback)
        {
            for (int fig = 0; fig < pathGeometrySrc.Figures.Count; fig++)
            {
                PathFigure pathFigureSrc = pathGeometrySrc.Figures[fig];
                PathFigure pathFigureDst = pathGeometryDst.Figures[fig];
                pathFigureDst.StartPoint = callback(pathFigureSrc.StartPoint);

                for (int seg = 0; seg < pathFigureSrc.Segments.Count; seg++)
                {
                    PathSegment pathSegmentSrc = pathFigureSrc.Segments[seg];
                    PathSegment pathSegmentDst = pathFigureDst.Segments[seg];

                    if (pathSegmentSrc is LineSegment)
                    {
                        LineSegment lineSegmentSrc = pathSegmentSrc as LineSegment;
                        LineSegment lineSegmentDst = pathSegmentDst as LineSegment;
                        lineSegmentDst.Point = callback(lineSegmentSrc.Point);
                    }
                    else if (pathSegmentSrc is PolyLineSegment)
                    {
                        PointCollection pointsSrc = (pathSegmentSrc as PolyLineSegment).Points;
                        PointCollection pointsDst = (pathSegmentDst as PolyLineSegment).Points;

                        for (int index = 0; index < pointsSrc.Count; index++)
                        {
                            pointsDst[index] = callback(pointsSrc[index]);
                        }
                    }
                }
            }
        }
コード例 #15
0
 public GooglePointsSearcher(ProcessPoint point)
 {
     hdb     = new HelperDB();
     hgoogle = new HelperGoogle();
 }
コード例 #16
0
        public void SetEpicentrKPoint(ProcessPoint p)
        {
            using (DictEpicetnrK edict = new DictEpicetnrK())
            {
                if (p.Coordinate != null)
                {
                    edict.SetEpicentrKPoint(
                        p.PointId,
                        p.CardId,
                        p.CrmCustomerId,
                        p.GetSearchEngineStatus(),
                        p.FormattedAddress,
                        p.Xml,
                        p.Coordinate.Lat,
                        p.Coordinate.Lng
                        );

                    if (p.SearchEngine == SearchEngine.Osm)
                    {
                        Core.ObjectSerializer.Place place = (Core.ObjectSerializer.Place)p.Conteiner;

                        edict.SetOsmPoint(
                            place.Osm_id,
                            p.PointId,
                            place.House_number,
                            place.Road,
                            place.Village,
                            place.Town,
                            place.City,
                            place.County,
                            place.Postcode,
                            place.Country,
                            place.Country_code,
                            place.Place_id,
                            place.Osm_type,
                            place.Boundingbox,
                            place.Polygonpoints,
                            place.Lat,
                            place.Lon,
                            place.Display_name,
                            place.Class,
                            place.Type
                            );
                    }
                }
                else
                {
                    edict.SetEpicentrKPoint(
                        p.PointId,
                        p.CardId,
                        p.CrmCustomerId,
                        p.GetSearchEngineStatus(),
                        p.FormattedAddress,
                        p.Xml
                        );
                }
            }

            //string DbConnectString = ConfigurationManager.AppSettings["DbConnectString"];

            //using (SqlConnection connect = new SqlConnection(DbConnectString))
            //{
            //    SqlCommand cmd = connect.CreateCommand();
            //    cmd.CommandText = "dbo.set_point_address";
            //    cmd.CommandType = CommandType.StoredProcedure;

            //    string Latitude = Point.Coordinate == null ? string.Empty : Point.Coordinate.Lat;
            //    string Longitude = Point.Coordinate == null ? string.Empty : Point.Coordinate.Lng;

            //    cmd.Parameters.AddWithValue("@card_id", Point.CardId);
            //    cmd.Parameters.AddWithValue("@lat", Latitude);
            //    cmd.Parameters.AddWithValue("@lng", Longitude);
            //    cmd.Parameters.AddWithValue("@google_status", Point.Status.ToString());
            //    cmd.Parameters.AddWithValue("@formatted_address", Point.FormattedAddress);
            //    cmd.Parameters.AddWithValue("@xml", Point.Xml);

            //    try
            //    {
            //        cmd.Connection.Open();
            //        cmd.ExecuteNonQuery();
            //        cmd.Connection.Close();
            //    }
            //    catch (Exception ex)
            //    {
            //        SetError("Ошибка сохранения точки в БД", ex);
            //    }
            //    finally
            //    {
            //        if (connect.State != ConnectionState.Closed) connect.Close();
            //    }
            //}
        }
コード例 #17
0
        private ProcessPoint ProcessingRequestResult(ProcessPoint p, GeocodeResponse message)
        {
            GoogleEngineStatus status = (GoogleEngineStatus)Enum.Parse(typeof(GoogleEngineStatus), message.status);

            p.SearchEngine = SearchEngine.Google;

            Coordinate GeoPoint = null;

            string formatted_address = string.Empty;

            if (status == GoogleEngineStatus.OK)
            {
                if (message.result.Count() == 1)
                {
                    GeoPoint = new Coordinate(
                        message.result[0].geometry[0].location[0].lat,
                        message.result[0].geometry[0].location[0].lng);
                    formatted_address = message.result[0].formatted_address;
                }
                else
                {
                    status = GoogleEngineStatus.MORE_ONE_POINT;
                }
            }

            /* Перевизначення точки */
            p = new ProcessPoint(
                p.PointId, p.CardId, p.CrmCustomerId, GeoPoint, p.SourceAddress, formatted_address);
            p.Type = PointType.CustomerEpicentrK;
            /* Визначення загального статусу */

            switch (status)
            {
            case GoogleEngineStatus.INVALID_REQUEST:
            {
                p.PStatus = ProcessStatus.ERROR;
                break;
            }

            case GoogleEngineStatus.MORE_ONE_POINT:
            {
                p.PStatus = ProcessStatus.MORE_ONE_POINT;
                break;
            }

            case GoogleEngineStatus.OK:
            {
                p.PStatus = ProcessStatus.OK;
                break;
            }

            case GoogleEngineStatus.OVER_QUERY_LIMIT:
            {
                p.PStatus = ProcessStatus.OVER_QUERY_LIMIT;
                break;
            }

            case GoogleEngineStatus.REQUEST_DENIED:
            {
                p.PStatus = ProcessStatus.ERROR;
                break;
            }

            case GoogleEngineStatus.UNKNOWN_ERROR:
            {
                p.PStatus = ProcessStatus.ERROR;
                break;
            }

            case GoogleEngineStatus.ZERO_RESULTS:
            {
                p.PStatus = ProcessStatus.EMPTY;
                break;
            }
            }

            /* Запис відповіді пошукової машини */
            XmlSerializer serializer = new XmlSerializer(typeof(GeocodeResponse));

            using (StringWriter textWriter = new StringWriter())
            {
                serializer.Serialize(textWriter, message);
                p.Xml = textWriter.ToString();
            }
            return(p);
        }
コード例 #18
0
        public ProcessPoint IdentifyCoordinatePoint(ProcessPoint point)
        {
            try
            {
                var x = new ForwardGeocoder();

                var r = x.Geocode(new ForwardGeocodeRequest
                {
                    queryString = point.addressDb.Get(),//"1600 Pennsylvania Avenue, Washington, DC",

                    BreakdownAddressElements = true,
                    ShowExtraTags            = true,
                    ShowAlternativeNames     = true,
                    ShowGeoJSON = true
                });

                r.Wait();

                return(point);
                //WebClientExtended client = new WebClientExtended();

                //if (Convert.ToBoolean(ConfigurationManager.AppSettings["isProxy"]))
                //{
                //    string Host = ConfigurationManager.AppSettings["ProxyHost"];
                //    int Port = Convert.ToInt32(ConfigurationManager.AppSettings["ProxyPort"]);
                //    System.Net.WebProxy wp = new System.Net.WebProxy(Host, Port);
                //    client.Proxy = wp;
                //}

                //string ep = string.Format(ConfigurationManager.AppSettings["OSMApiPath"]);
                ////string url = string.Format("{0}{1}&format=xml&addressdetails=1", ep, System.Convert.ToBase64String(
                ////    System.Text.Encoding.Default.GetBytes(point.SourceAddress)
                ////    ));

                //string url = string.Format("{0}{1}&format=xml&addressdetails=1", ep, HttpUtility.UrlEncode(point.SourceAddress));

                ////url = HttpUtility.UrlEncode(url);

                //string st = System.Text.Encoding.UTF8.GetString(client.DownloadData(url));

                //XmlSerializer serializer = new XmlSerializer(typeof(Searchresults));

                //using (TextReader tr = new StringReader(st))
                //{
                //    Searchresults result = (Searchresults)serializer.Deserialize(tr);
                //    if (result.Place != null)
                //    {
                //        point.Coordinate = new Coordinate(result.Place.Lat, result.Place.Lon);
                //        point.FormattedAddress = result.Place.Display_name;
                //        point.SetSearchEngineStatus("OK");
                //        point.Conteiner = (object)result.Place;
                //        point.SearchEngine = SearchEngine.Osm;
                //        //point.PStatus = ProcessStatus.;
                //    }
                //    else
                //    {
                //        point.SetSearchEngineStatus("ZERO_RESULTS");
                //    }

                //    //XmlSerializer smr = new XmlSerializer(typeof(Searchresults));
                //    //using (StringWriter tw = new StringWriter())
                //    //{
                //    //    smr.Serialize(tw, result);
                //    //    point.Xml = tw.ToString();
                //    //}

                //    _logger.Info(string.Format("{0} SearchEngineStatus:{5}, {1} {2} Lat={3}, Lng={4}",
                //        point.CardId.ToString(),
                //        "Point Get OSM:",
                //        point.FormattedAddress,
                //        point.Coordinate != null ? point.Coordinate.Lat : "none",
                //        point.Coordinate != null ? point.Coordinate.Lng : "none",
                //        point.PStatus.ToString()
                //    ));

                //    point.Save(hdb);

                //    _logger.Info(string.Format("{0} {1}", point.CardId.ToString(), "Point Set Data in DB"));

                //    return point;
                //}
            } catch (Exception ex)
            {
                return(point);
            }
        }