LocationRect Class Method fromEdges(north:number, west:number, south:number, east:number) RRS feed

  • General discussion

  • I tried to implement the fromEdges method in two different ways and neither worked.

    var mb = new Microsoft.Maps.LocationRect.fromEdges(mapBounds[0], mapBounds[1], mapBounds[2], mapBounds[3]);

    mapBounds contains 4 strings of latitude and longitude values and the method threw an error of Invalid Latitude.  The string values are valid.

    Next I tried using the bracketed method:

    var mb = new Microsoft.Maps.LocationRect.fromEdges({north:mapBounds[0], west:mapBounds[1], south:mapBounds[2], east:mapBounds[3]});

    Threw the same error.

    Final solution was to use a different constructor and it worked:

    var mb = new Microsoft.Maps.LocationRect.fromLocations(new Microsoft.Maps.Location(mapBounds[0], mapBounds[1]), new Microsoft.Maps.Location(mapBounds[2], mapBounds[3]));
    I don't think fromEdges is working and fromLocations is.

    I am using the V8 Web Control API.
    • Edited by developer68 Thursday, June 20, 2019 6:29 PM
    Thursday, June 20, 2019 6:28 PM

All replies

  • Hi Developer68,

    I can't really tell what you are sending so I will point you to a sample from Ricky (https://gis.stackexchange.com/questions/153594/zoom-to-fit-pushpins-in-bing-maps)

    box=new Microsoft.Maps.LocationRect.fromEdges(maxLat,minLong,minLat,maxLong);



    Friday, June 21, 2019 4:08 AM
  • mapBounds[0] = maxLat = north
    mapBounds[1] = minLong = west
    mapBounds[2] = minLat = south
    mapBounds[3] = maxLong = east

    and to reiterate "Final solution was to use a different constructor and it worked"

    Friday, June 21, 2019 10:38 PM