Beispiel #1
0
        private void btnPesquisarEndereco_Click(object sender, EventArgs e)
        {
            string             address = tbxEndereço.Text;
            GeoCoderStatusCode status;

            GeocodingProvider geocode = MainMap.MapProvider as GeocodingProvider;

            if (geocode == null)
            {
                MessageBox.Show("O tipo de mapa escolhido não possui \n serviço de geocoding !!!");
                return;
            }

            PointLatLng?point = geocode.GetPoint(address, out status);

            //PointLatLng? point = GMapProviders.GoogleMap.GetPoint(address, out status);



            if (status == GeoCoderStatusCode.G_GEO_SUCCESS && point != null)
            {
                //MessageBox.Show(point.ToString());
                MainMap.Position = point.Value;
                MainMap.Zoom     = 18;
            }
        }
Beispiel #2
0
        public static PointLatLng GetPositionByKeywords(string keys)
        {
            GeoCoderStatusCode status;
            GeocodingProvider  geocodingProvider = GMapProviders.GoogleMap;

            if (geocodingProvider != null)
            {
                PointLatLng?point = geocodingProvider.GetPoint(keys, out status);
                if (status == GeoCoderStatusCode.G_GEO_SUCCESS && point.HasValue)
                {
                    return(point.Value);
                }
            }
            return(new PointLatLng());
        }