Meaning and conversion algorithm of scale and resolution

Source: Internet
Author: User

Two parts:

Part 1

DPI of the monitor

Recently, it was found that the actual size of the image displayed on the new notebook is not the specified size (for example, to draw a 5 cm-width rectangle, the display width on the screen is only 3.6 ), after carefully checking the code, no error was found, and finally the problem was caused by the DPI of the monitor.

In the code, the DPI obtained through graphic. dpix or graphic. dpix is always 96, regardless of the size and resolution of the display. That is to say, the 96 DPI is not necessarily the actual DPI of the monitor. In fact, 96 is a 14-inch display at a resolution of 1024*768 DPI (when a 17-inch display is at a resolution of 1024*768, the actual DPI should be smaller than 96 ).

Without obtaining the actual DPI (or the width and height of the screen) of the monitor, the display accuracy cannot be guaranteed.

System. windows. forms. the static method getbounds (...) in screen (...) you can get the display resolution, getworkingarea (...) you can obtain the Display Work Area (the work area is the desktop area of the display, excluding the taskbar, dock window, and dock toolbar). However, you cannot obtain the width and height of the display or the width of each vertex, the actual DPI of the current display cannot be obtained. It is expected that. NET will provide functions to obtain the actual dpi or display size of the display.


Part 2

Address: http://gispower.e2.91cdn.com/article/arcgis/ArcServer/2010/67/106711258224E1636AC2442GHJE09.html

When we use ArcGIS Server to build slices, we will find such fragments in the conf. xml generated in the cache:

In the preceding segment, <lodinfo> indicates the information of each level slice, and <levelid> indicates the level of the slice.

Here, <scale> indicates the scale. Scale indicates the degree to which the distance on the graph is smaller than the distance on the field, also known as scale. The formula is: scale = distance on the graph/field distance. The scale is displayed in a proportional or fractional Form of a number. For example, on a map, "1 cm" indicates that the field distance is 500 km, which can be written as or "50,000,000, 1/50.

<Resolution>, indicating the resolution. The actual meaning of resolution indicates the map unit (x map unit/pixel) in the current map range. The map unit depends on the spatial reference of the data.

When we develop Web APIs, we often encounter map scaling based on resolution. But in actual needs, we need to scale according to scale, so the conversion between scale and resolution is involved.

Conversion algorithms for resolution and scale:

The resolution is related to DPI and map unit. (DPI indicates the number of pixels per inch)

Conversion algorithms of resolution and Scale

Example:

Case 1: If the coordinate unit of the map is meter, DPI is 96

1 inch = 2.54 cm;

1 inch = 96 pixels;

The final conversion unit is meter;

If the current map scale is 1: 125000000, it indicates that the map is 1 to 125000000;

The conversion formula between meters and pixels:

1 inch = 0.0254 meters = 96 pixels

1 pixel = 0.0254/96 meters

Then, based on the scale, 1 pixel indicates that the field distance is 125000000*0.0254/96 = 33072.9166666667. The conversion result is slightly different from the slicing result by 0.07 meters. This error is caused by the inch-to-centimeter conversion parameter. The server uses a conversion parameter of about 1 inch to 0.0254000508 meters.

Case 2: If the geographic coordinate system is WGS84, the unit of the map is degree, and the DPI is 96

Server-to-medium and meter conversion parameters:

1 degree equals 111194.872221777 meters

The conversion between degrees and pixels is required:

When the scale is 1: 64000000, equivalent to 1 pixel = 64000000*0.0254000508/96 = 16933.3672

Then convert the meter to degrees 16933.3672/111194.872221777 = 0.1522855043731385 degrees

Therefore, when the unit of a map is degree, the resolution corresponding to 1: 64000000 is approximately 0.1522855043731385 degrees.

 

Verification Result:

Recently, it was found that the actual size of the image displayed on the new notebook is not the specified size (for example, to draw a 5 cm-width rectangle, the display width on the screen is only 3.6 ), after carefully checking the code, no error was found, and finally the problem was caused by the DPI of the monitor.

In the code, the DPI obtained through graphic. dpix or graphic. dpix is always 96, regardless of the size and resolution of the display. That is to say, the 96 DPI is not necessarily the actual DPI of the monitor. In fact, 96 is a 14-inch display at a resolution of 1024*768 DPI (when a 17-inch display is at a resolution of 1024*768, the actual DPI should be smaller than 96 ).

Without obtaining the actual DPI (or the width and height of the screen) of the monitor, the display accuracy cannot be guaranteed.

System. windows. forms. the static method getbounds (...) in screen (...) you can get the display resolution, getworkingarea (...) you can obtain the Display Work Area (the work area is the desktop area of the display, excluding the taskbar, dock window, and dock toolbar). However, you cannot obtain the width and height of the display or the width of each vertex, the actual DPI of the current display cannot be obtained. It is expected that. NET will provide functions to obtain the actual dpi or display size of the display.

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.