簡體   English   中英

c#如何在放大的地圖中將緯度和經度轉換為xy平面

[英]c# How to convert latitude and longitude to xy plane in enlarged map

我有一張地圖,不是圖片框中的GOOGLE地圖。 我知道地圖的寬度和高度。 而且我知道地圖圖像邊緣的緯度和經度。 地圖圖像僅顯示小區域(一些建築物和街道)而不是整個WORLD。 我想要做的是獲得地圖圖像的xy坐標,如果我有某些點的lat和lon。 該點不會超出地圖圖像。

簡而言之,如果我知道edge'lat&lon,主要任務是從lat&lon轉換為xy坐標。

// The mapping between latitude, longitude and pixels is defined by the web
// mercator projection.
function project(latLng) {
   var siny = Math.sin(latLng.lat() * Math.PI / 180);

   // Truncating to 0.9999 effectively limits latitude to 89.189. This is
   // about a third of a tile past the edge of the world tile.
   siny = Math.min(Math.max(siny, -0.9999), 0.9999);

   return new google.maps.Point(
      TILE_SIZE * (0.5 + latLng.lng() / 360),
      TILE_SIZE * (0.5 - Math.log((1 + siny) / (1 - siny)) / (4 * Math.PI)));
}

來自https://developers.google.com/maps/documentation/javascript/examples/map-coordinates?csw=1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM