Important parameters for controlling the map display range

Source: Internet
Author: User

There are several important parameters for controlling the map display range:

1,ZoomThe width of the MAP range displayed in the current window;

2,CenterThe central point of the MAP range displayed in the current window;

3,CurrentrangeThe MAP range displayed in the current window.

The following describes the meanings and relationships of these parameters and how to control the map display range.

 

What is the relationship between these three parameters? Next we will explain through a question.

The map center of the current window is known. Center Coordinates ( X Center , Y Center ) , MAP range width Zoom And the size of the window canvas. Size To find the display range of the current window. Currentrange , That is Currentrange. xmin , Currentrange. ymin And Currentrange. xmax , Currentrange. Ymax ?

 

Solution:Currentrange. width = zoom;

 

Currentrange. xmin =XCenter-Zoom/2;

Currentrange. xmax =XCenter+Zoom/2;

 

SetPixelwidthThe actual map width,PixelheightIt is the actual map height represented by a pixel portrait. To keep the elements displayed unchangedPixelwidth = pixelheight;

That isCurrentrange. width/size. width = currentrange. Height/size. Height;

That isZoom/size. width = currentrange. Height/size. Height;

That isCurrentrange. Height=(Zoom/size. width) * size. Height;

 

Currentrange. ymin=YCenter-Currentrange. Height/2;

Currentrange. Ymax=YCenter+Currentrange. Height/2;

 

Through solving the above questions, we realized that,Zoom,Center,CurrentrangeThese three parameters are closely related. If you change any of these parameters, at least one of the other two will change. Set the values of these parameters, it is an important means for us to control the map display range. Therefore, it is often used in the secondary development process.

 

Let us think about another question: when a map is zoomed in with a zoom-in tool, what will happen if the pulled zoom-in box is a long and narrow rectangle? How has the preceding three parameters changed?

Solution: According to the human's visual and psychological habits, the center point is the center point of the rectangle in the enlarged box.(XCenter, YCenter);

If the enlarged box is a horizontal and narrow rectangle, the horizontal rectangle is taken as the standard;

Horizontal SpanZoomThat is, the width of the map contained in the enlarged box (the horizontal span of the enlarged box is calculated by converting the screen coordinates to the map coordinates.Zoom, That isCurrentrange. Width);

Longitudinal SpanCurrentrange. Height,

SetPixelwidthThe actual map width,PixelheightIt is the actual map height represented by a pixel portrait. To keep the elements displayed unchangedPixelwidth = pixelheight;

 

Zoom/size. width = currentrange. Height/size. Height;

Currentrange. Height=(Zoom/size. width) * size. Height;

 

In this way, the three parameters that control the map display range can be obtained;

If the enlarged box is a long and narrow rectangle, the vertical rectangle is taken as the standard;

Vertical SpanCurrentrange. HeightThat is, the height of the map contained in the enlarged box (the portrait span included in the enlarged box is calculated by converting the screen coordinates to the map coordinates );

Horizontal SpanCurrentrange. WidthThat isZoom,

 

Zoom/size. width = currentrange. Height/size. Height;

Zoom = (currentrange. Height/size. Height) * size. Width;

 

In this way, you can obtain the three parameters for controlling the map display.

All of the above discussions are about how to change the display range of a map without changing the size of the screen canvas? How should the above three parameters be changed?

Solution: The premise is that no matter how the screen canvas changes,ZoomAlways unchanged, center Always unchanged;

Horizontal SpanZoomNo changes.Pixelwidth(The actual map width represented by a pixel horizontal );

Transverse stretchSize. WidthLarger, thenPixelwidth=Zoom/size. WidthSmall, verticalSize. HeightNot changed.Pixelheight = pixelwidth, SoSize. Height * pixelheightThe height is reduced;

Scale down horizontally,PixelwidthLarger, verticalSize. HeightNot changed.Pixelheight = pixelwidth, SoSize. Height * pixelheightThe height increases;

If vertically stretched or squashedZoomThe value is not changed.Size. WidthThe value is not changed either.PixelwidthIt won't change, becausePixelheight = pixelwidth, Vertical stretching,Size. Height * pixelheightThis leads to more content displayed in the vertical direction, and less content displayed in the reverse direction.

 

The preceding analysis shows the three parameters for controlling the display range of a map, and the influence of canvas or drop-box browsing on the display range.GISWe often encounter secondary development issues. These considerations are designed based on the visual and psychological habits of people. Readers can also choose not to do so and have their own designs, you have the initiative.

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.