How to find exact lat / lng coordinates in a bird scene in Virtual Earth?

I try to find the latitude and longitude of the corners of my map, being in a bird's eye view. I want to be able to display contacts on a map, but I have hundreds of thousands of addresses that I want to limit to those that should be displayed on a map.

In normal mode, VEMap.GetMapView (). TopLeftLatLong and .BottomRightLatLong return the coordinates I need; but in Birdseye mode, they return null (or encrypted values). The SDK recommends using VEBirdseyeScene.GetBoundingRectangle (), but this returns borders up to two miles from the center of my scene, which in large cities still return too many addresses.

In previous versions of VE Control, there was an undocumented VEDecoder object that I could use to decrypt LatLong values ​​for birdseye scenes, but this object seems to have disappeared (probably been renamed). How can I decode these values ​​in version 6.1?

+3
source share
5 answers

Here is the code to get the Lat / Long center point on the map. This method works in the Road / Aerial and Birdseye / Oblique map styles.

function GetCenterLatLong()
        {
            //Check if in Birdseye or Oblique Map Style
            if (map.GetMapStyle() == VEMapStyle.Birdseye || map.GetMapStyle() == VEMapStyle.BirdseyeHybrid)
            {
                //IN Birdseye or Oblique Map Style


                //Get the BirdseyeScene being displayed
                var birdseyeScene = map.GetBirdseyeScene();


                //Get approximate center coordinate of the map
                var x = birdseyeScene.GetWidth() / 2;
                var y = birdseyeScene.GetHeight() / 2;

                // Get the Lat/Long 
                var center = birdseyeScene.PixelToLatLong(new VEPixel(x,y), map.GetZoomLevel());

                // Convert the BirdseyeScene LatLong to a normal LatLong we can use
                return (new _xy1).Decode(center);
            }
            else
            {
                // NOT in Birdseye or Oblique Map Style
                return map.GetCenter();
            }
        } 

This code has been copied here: http://pietschsoft.com/post/2008/06/Virtual-Earth-Get-Center-LatLong-When-In-Birdseye-or-Oblique-Map-Style.aspx

+2
source

, , , ! , , , , VELatLong . ( , - , ).

VEPixel, x y, . , onclick .

function getBirdseyeViewLatLong(vePixel)
{
    var be = map.GetBirdseyeScene();

    var centrePixel = be.LatLongToPixel(map.GetCenter(), map.GetZoomLevel());

    var currentPixelWidth = be.GetWidth();
    var currentPixelHeight = be.GetHeight();

    var mapDiv = document.getElementById("map");
    var mapDivPixelWidth = mapDiv.offsetWidth;
    var mapDivPixelHeight = mapDiv.offsetHeight;

    var xScreenPixel = centrePixel.x - (mapDivPixelWidth / 2) + vePixel.x;
    var yScreenPixel = centrePixel.y - (mapDivPixelHeight / 2) + vePixel.y;

    var position = be.PixelToLatLong(new VEPixel(xScreenPixel, yScreenPixel), map.GetZoomLevel())
    return (new _xy1).Decode(position);
}
+2

VEMap.GetCenter:

null, VEMapStyle.Birdseye VEMapStyle.BirdseyeHybrid.

, :

var northWestLL = (new _xy1).Decode(map.GetMapView().TopLeftLatLong);
var southEastLL = (new _xy1).Decode(map.GetMapView().BottomRightLatLong);

( _xy1), , , VEDecoder, .

+1

According to http://dev.live.com/virtualearth/sdk/ this should do the trick:

function GetInfo()         
{
  alert('The latitude,longitude at the center of the map is: '+map.GetCenter());         
}
0
source

An interesting point in the Bing Maps Terms of Use. http://www.microsoft.com/maps/product/terms.html

Limit the use of aerial photography of bird eyes: You cannot display latitude, longitude, altitude or other metadata;

0
source

Source: https://habr.com/ru/post/1696568/


All Articles