<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      【高德地圖API】地理編碼與逆地理編碼

      一、地理編碼

      該功能實現地理編碼服務,即地址匹配,從已知的地址描述到對應的經緯度坐標的轉換,即根據地址信息,查詢該地址所對應的點坐標等,地址(address) 為必選項,城市(city)為可選項。

              <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                  <Grid Opacity="0.8"  Margin="0,0,0,608"  Background="#FF323232"  RenderTransformOrigin="0.497,0.465" Canvas.ZIndex="10" >
                      <Grid.RowDefinitions>
                          <RowDefinition Height="Auto"/>
                          <RowDefinition Height="Auto"/>
                      </Grid.RowDefinitions>
                      <TextBlock Grid.Row="0" Text="地理編碼" Margin="3,0,0,0" />
                      <StackPanel Grid.Row="1"  Orientation="Vertical">
                          <TextBox x:Name="txtAddress" Grid.Row="0" Text="北京市朝陽區望京阜通東大街方恒國際中心" Margin="12,0,0,0" />
                          <Button   Content="地理編碼" Click="Button_Click" Margin="274,0,26,0"  />
                      </StackPanel>
                  </Grid>
              </Grid>
      View Code

       

              AMap amap;
              AMapMarker marker;
              public SearchGeoCode()
              {
                  InitializeComponent();
                  this.ContentPanel.Children.Add(amap = new AMap());
                  amap.MarkerClickListener += amap_MarkerClickListener;
                
              }
      
              private async Task AddressToGeoCode(string address)
              {
                  AMapGeoCodeResult cr = await AMapGeoCodeSearch.AddressToGeoCode(address);
                  this.Dispatcher.BeginInvoke(() =>
                  {
                      if (cr.Erro == null && cr.GeoCodeList != null)
                      {
                          if (cr.GeoCodeList.Count==0)
                          {
                              MessageBox.Show("無查詢結果");
                              return;
                          }
                          IEnumerable<AMapGeoCode> geocode = cr.GeoCodeList;
                          foreach (AMapGeoCode gcs in geocode)
                          {
                              Debug.WriteLine(gcs.Adcode);
                              Debug.WriteLine(gcs.Building);
                              Debug.WriteLine(gcs.City);
                              Debug.WriteLine(gcs.District);
                              Debug.WriteLine(gcs.FormattedAddress);
                              Debug.WriteLine(gcs.Province);
                              Debug.WriteLine(gcs.Township);
                              Debug.WriteLine(gcs.Location.Lon);
                              Debug.WriteLine(gcs.Location.Lat);
                              Debug.WriteLine(gcs.LevelList[0]);
                              marker= amap.AddMarker(new AMapMarkerOptions()
                              {
                                  Position = new LatLng(gcs.Location.Lat, gcs.Location.Lon),
                                  Title = gcs.FormattedAddress,
                                  Snippet = gcs.District,
                                  IconUri = new Uri("Images/AZURE.png", UriKind.Relative),
      
                              });
                          }
                          //如果返回的geocode數大于1個,調整視圖
                          if (geocode.Count()>1)
                          {
                              LatLngBounds.Builder builder = new LatLngBounds.Builder();
                              List<AMapMarker> markers = amap.GetMapMarkers();
                              foreach (AMapMarker marker in markers)
                              {
                                  builder.Include(marker.Position);
                              }
                              this.amap.MoveCamera(CameraUpdateFactory.NewLatLngBounds(builder.Build(), markers.Count()));
                          }
                          else
                          {
                              amap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(geocode.FirstOrDefault().Location.Lat, geocode.FirstOrDefault().Location.Lon), 14));
                          }
                      }
                      else
                      {
                          MessageBox.Show(cr.Erro.Message);
                      }
      
                  });
              }
      
              void amap_MarkerClickListener(AMapMarker sender, AMapEventArgs args)
              {
                  sender.ShowInfoWindow(new AInfoWindow()
                  {
                      Title = sender.Title,
                      ContentText =sender.Snippet,
                  });
              }
      
              private async void Button_Click(object sender, RoutedEventArgs e)
              {
                  amap.Clear();
                  if (!string.IsNullOrWhiteSpace(txtAddress.Text))
                  {
                      await AddressToGeoCode(txtAddress.Text);
                  }
                  
              }        

      二、逆地理編碼

      該功能實現逆地理編碼服務,即地址解析服務,具體是指從已知的經緯度坐標到對應的地址描述(如省市、街區、樓層、房間等)的轉換服務,坐標(location) 為必選項,半徑(radius)為可選項,詳細的參數說明參見參考手冊。

       

      <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                  <Grid Opacity="0.8" Margin="0,0,0,568"  Background="#FF323232"  RenderTransformOrigin="0.497,0.465" Canvas.ZIndex="10" >
                      <Grid.RowDefinitions>
                          <RowDefinition Height="Auto"/>
                          <RowDefinition Height="Auto"/>
                      </Grid.RowDefinitions>
                      <TextBlock Grid.Row="0" Text="逆地理編碼" Margin="3,0,0,0" />
                    
                          <Grid  Grid.Row="1">
                              <Grid.RowDefinitions>
                                  <RowDefinition Height="Auto"/>
                                  <RowDefinition Height="Auto"/>
                              <RowDefinition Height="Auto"/>
                          </Grid.RowDefinitions>
                              <Grid.ColumnDefinitions>
                                  <ColumnDefinition Width="Auto"/>
                                  <ColumnDefinition Width="Auto"/>
                              </Grid.ColumnDefinitions>
                          <TextBlock Grid.Row="0" Grid.Column="0" Text="經度:" Margin="12,0,0,0" VerticalAlignment="Center" />
                          <TextBlock Grid.Row="1" Grid.Column="0" Text="緯度:" Margin="12,0,0,0" VerticalAlignment="Center" />
                          <TextBox x:Name="txtLon" Grid.Row="0" Grid.Column="1" Text="" Width="180" />
                          <TextBox x:Name="txtLat" Grid.Row="1" Grid.Column="1" Text="" Width="180" />
                          <TextBlock  Grid.Row="2" Text="點擊或者輸入獲得經緯度" Grid.ColumnSpan="2" Margin="3,0,0,0" />
                      </Grid>
                          <Button   Content="逆地理編碼" Click="Button_Click" Margin="257,69,29,3" Grid.Row="1"  />
                   
                  </Grid>
      View Code

       

              AMap amap;
              AMapMarker marker;
              LatLng latLng;
              public SearchReGeoCode()
              {
                  InitializeComponent();
                  this.ContentPanel.Children.Add(amap = new AMap());
                  amap.Tap += amap_Tap;
                  amap.MarkerClickListener += amap_MarkerClickListener;
      
              }
      
              void amap_Tap(object sender, System.Windows.Input.GestureEventArgs e)
              {
                  latLng = amap.GetProjection().FromScreenLocation(e.GetPosition(amap));
                  this.txtLat.Text = latLng.latitude.ToString();
                  this.txtLon.Text = latLng.longitude.ToString();
              }
      
              private async Task GeoCodeToAddress(double lon, double lat)
              {
                  AMapReGeoCodeResult rcc = await AMapReGeoCodeSearch.GeoCodeToAddress(lon, lat, 500, "", Extensions.All);
      
                  this.Dispatcher.BeginInvoke(() =>
                      {
                          if (rcc.Erro == null && rcc.ReGeoCode != null)
                          {
                              AMapReGeoCode regeocode = rcc.ReGeoCode;
                              Debug.WriteLine(regeocode.Address_component);
                              Debug.WriteLine(regeocode.Formatted_address);
                              Debug.WriteLine(regeocode.Pois);
      
                              List<AMapPOI> pois = regeocode.Pois.ToList();
                              //POI信息點
                              foreach (AMapPOI poi in pois)
                              {
                                  marker = amap.AddMarker(new AMapMarkerOptions()
                                  {
                                      Position = new LatLng(poi.Location.Lat, poi.Location.Lon),
                                      Title = poi.Name,
                                      Snippet = poi.Address,
                                      IconUri = new Uri("Images/RED.png", UriKind.Relative),
      
                                  });
                              }
      
                              Debug.WriteLine(regeocode.Roadinters);
                              Debug.WriteLine(regeocode.Roadslist);
                              AMapAddressComponent addressComponent = regeocode.Address_component;
                              Debug.WriteLine(addressComponent.Building);
                              Debug.WriteLine(addressComponent.City);
                              Debug.WriteLine(addressComponent.District);
                              Debug.WriteLine(addressComponent.Neighborhood);
                              Debug.WriteLine(addressComponent.Province);
                              Debug.WriteLine(addressComponent.Stree_number);
                              Debug.WriteLine(addressComponent.Township);
                              AMapStreetNumber streetNumber = addressComponent.Stree_number;
                              Debug.WriteLine(streetNumber.Direction);
                              Debug.WriteLine(streetNumber.Distance);
                              Debug.WriteLine(streetNumber.Location.Lat);
                              Debug.WriteLine(streetNumber.Location.Lon);
                              Debug.WriteLine(streetNumber.Number);
                              Debug.WriteLine(streetNumber.Street);
      
      
                              marker = amap.AddMarker(new AMapMarkerOptions()
                                {
                                    Position = new LatLng(streetNumber.Location.Lat, streetNumber.Location.Lon),//amap.Center,//
                                    Title = addressComponent.Province,
                                    Snippet = regeocode.Formatted_address,
                                    IconUri = new Uri("Images/AZURE.png", UriKind.Relative),
      
                                });
      
                              //顯示化彈出信息
                              AInfoWindow info = new AInfoWindow();
                              info.Title = addressComponent.Province;
                              info.ContentText = regeocode.Formatted_address;
                              marker.ShowInfoWindow(info, new Point(0, 0));
      
                              amap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(Convert.ToDouble(txtLon.Text), Convert.ToDouble(txtLat.Text)), 12));
                          }
                          else
                          {
                              MessageBox.Show(rcc.Erro.Message);
                          }
      
                      });
      
              }
      
              void amap_MarkerClickListener(AMapMarker sender, AMapEventArgs args)
              {
                  sender.ShowInfoWindow(new AInfoWindow()
                  {
                      Title = sender.Title,
                      ContentText = sender.Snippet,
                  });
              }
      
              private async void Button_Click(object sender, RoutedEventArgs e)
              {
                  amap.Clear();
                  if (string.IsNullOrWhiteSpace(txtLat.Text) && string.IsNullOrWhiteSpace(txtLon.Text))
                  {
                      return;
                  }
                  await GeoCodeToAddress(Convert.ToDouble(txtLon.Text), Convert.ToDouble(txtLat.Text));
              }    

       

      三、同時使用地理編碼和逆地理編碼

      已知一個地址或者模糊地址,然后你想知道該地址詳細信息或者周邊信息(周邊POI點)。先通過地址獲取經緯度,然后通過逆地理編碼獲取詳細信息。在此不作出示例。

      四、批量逆地理編碼

      目前高德地圖WP SDK中并沒有提供直接批量轉換的接口,而在REST API中已經提供了,你可以在開發者論壇REST API版塊中提出接口使用申請,鏈接:高德地圖rest api接口申請方式 

       

       

       

      posted @ 2014-02-19 11:13  十一_x  閱讀(60625)  評論(5)    收藏  舉報
      主站蜘蛛池模板: 亚洲成aⅴ人在线电影| 日韩中文字幕一二三视频| 亚洲国内精品一区二区| 91精品国产免费人成网站| 亚洲 欧美 清纯 校园 另类| 亚洲熟妇色自偷自拍另类| 黄骅市| 国产一区二区三区不卡观| 国产色无码专区在线观看| 无码精品人妻一区二区三区中| 少妇激情一区二区三区视频小说| 邻居少妇张开腿让我爽了一夜| 日韩精品一区二区三区久| 狠狠色丁香婷婷亚洲综合| 亚洲国产成人精品av区按摩| 无码天堂va亚洲va在线va| 日本熟妇人妻一区二区三区| 国内精品久久人妻无码不卡| 成人无码潮喷在线观看| 99久久精品看国产一区| 亚洲韩国精品无码一区二区三区| 中文字幕亚洲综合久久| 天水市| 熟妇激情一区二区三区| 国产一区二区日韩在线| 亚洲成av人片在线观看www| 成人精品动漫一区二区| 亚洲第一无码AV无码专区| 国产一区二区三区四区色| 国产尤物精品自在拍视频首页| 人妻少妇无码精品专区| 国产亚洲精品超碰热| 色8久久人人97超碰香蕉987| 久久夜色噜噜噜亚洲av| 国产精品点击进入在线影院高清| 在线中文字幕国产一区| 国产一区二区三区国产视频| 无码尹人久久相蕉无码| 一区二区丝袜美腿视频| 国产乱子伦农村xxxx| 四虎永久在线精品8848a|