ArcGIS server9.3 dynamically obtains the current map scale

Source: Internet
Author: User

// ArcGIS server9.3 ADF Javascript

VaR scale = "";

If (Map. _ extent! = NULL)

{

// Obtain the coordinates of the MAP range in the current field of view

VaR Maxx = map. _ extent. _ xmax;

VaR Minx = map. _ extent. _ xmin;

VaR Maxy = map. _ extent. _ Ymax;

VaR miny = map. _ extent. _ ymin;

// Width and height of the map control (image)

VaR imagewidth = map. _ mapsize [0];

VaR imageheight = map. _ mapsize [1];

// Map coordinates of the current map's field of view Center
VaR centerpoint = map. get_center ();
VaR centerx = centerpoint. Coordinates [0];
VaR centery = centerpoint. Coordinates [1];

// DPI of the current screen (points per inch)

VaR DPI = 96;

// Number of points on the current screen in meters

VaR dots_per_m = DPI/2.54*100;

// The width of the map control is half (in meters)

VaR width_size_in_m = (imagewidth/2)/dots_per_m;

Scale = (Maxx-centerx)/width_size_in_m;

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.