none
Replacement for getTargetMetersPerPixel RRS feed

  • Question

  • Found another "Rarely Used" feature which has been deprecated in v8 but is crucial to my application.

    getTargetMetersPerPixel

    Do you know of a good algorithm for replacing this function? I am hoping I don't have to spend the afternoon (on a Friday where the temp is supposed to reach 108 and the A/C barely works) figuring it out myself (maybe it will be easier than my overheated pessimism believes?)

    Thanks, Brad


    Friday, September 1, 2017 4:21 PM

Answers

  • If you know the zoom level and approximate latitude of the center of the map you plan on moving to (i.e. target zoom level/center), you can easily calculate this using the Spatial Math module in Bing Maps V8. In most cases using the latitude of the current center of the map would be accurate enough. 

    The Spatial Math module has a set of calculations specific to the tile system used in Bing Maps. You will want to use the Microsoft.Maps.SpatialMath.Tiles.groundResolution(latitude, zoom) function. This will return the resolution in meters per pixel. 

    As for 'rarely used', this is the first time anyone has asked about the getTargetMetersPerPixel function in the forums, ever.


    [Blog] [twitter] [LinkedIn]

    Friday, September 1, 2017 5:02 PM

All replies

  • If you know the zoom level and approximate latitude of the center of the map you plan on moving to (i.e. target zoom level/center), you can easily calculate this using the Spatial Math module in Bing Maps V8. In most cases using the latitude of the current center of the map would be accurate enough. 

    The Spatial Math module has a set of calculations specific to the tile system used in Bing Maps. You will want to use the Microsoft.Maps.SpatialMath.Tiles.groundResolution(latitude, zoom) function. This will return the resolution in meters per pixel. 

    As for 'rarely used', this is the first time anyone has asked about the getTargetMetersPerPixel function in the forums, ever.


    [Blog] [twitter] [LinkedIn]

    Friday, September 1, 2017 5:02 PM
  • Thanks, that looks easier than what was going through my head (div width in pixels, width of mbr in meters using distance function, do the math: Actually not that hard! Must be in a mood today, it's already 85 at 10:30am already, sorry about that.)

    I am famous for doing things no one else has ever done. ;-)

    - Brad

    Friday, September 1, 2017 6:24 PM