Method, device, medium and equipment for target region scaling to adapt to display region
By calculating the actual distance and pixel occupancy of the target area, a target resolution array is generated and set onto the map control. This solves the problem of fixed resolution level tiles in electronic maps, achieves the best display effect for the target area, and improves the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAMEN KINGTOP INFORMATION TECH
- Filing Date
- 2022-07-07
- Publication Date
- 2026-08-04
AI Technical Summary
Existing electronic maps have fixed resolution levels and tiles, which cannot meet users' needs for displaying the ideal zoom range of different objects.
By calculating the actual distance and pixel occupancy of the target area, a target resolution array is generated and interpolated into the original resolution array, so that the resolution levels are in an increasing or decreasing relationship. Finally, the target resolution is set on the map control to achieve the best display of the target area.
It achieves the best display effect of the target area on the electronic map, meets the user's zooming needs, simplifies operation and improves user experience.
Smart Images

Figure CN115145673B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic map technology, and in particular to a method, apparatus, medium, and device for scaling a target area to adapt to the display area. Background Technology
[0002] With the development of national cities and the advancement of domestic science and technology, urban management methods are also constantly evolving. From the original simple data table format management to data system management using reports, charts, and other formats, in recent years, with the rapid development of the internet and mobile devices, visualization and intelligent systems have become increasingly common. Many of these systems are related to maps, providing a more intuitive display of results. Electronic maps, also known as digital maps, are maps stored and viewed digitally using computer technology. Electronic maps can be output at any scale and within any area. They are very easy to modify, shortening the mapping time. They can be easily combined with other information sources such as satellite imagery and aerial photographs to generate new map types. New data can be derived from the information recorded on digital maps. For example, contour lines on a map represent landforms, but these are difficult for non-professionals to understand. Using the contour lines and elevation points of an electronic map, a digital elevation model can be generated, representing the surface undulations digitally and providing a direct, three-dimensional representation of the landforms. This is an effect that ordinary topographic maps cannot achieve.
[0003] Zooming in and out are common functions in electronic map usage. Ideally, when observing an area, the area should be large enough and completely displayed on the screen. However, default electronic maps are loaded according to standard resolution levels, such as those used by Google Maps. Standard electronic maps have fixed tile levels, such as... Figure 1 As shown, when locating certain map features, the map cannot be displayed exactly as intended; it can only be forced to a predetermined range. This fails to achieve the user's expected result.
[0004] In summary, existing electronic maps have fixed resolution levels and tiles, which cannot meet users' ideal requirement of scaling different objects to a suitable range for display. Summary of the Invention
[0005] To address the shortcomings of the prior art, the present invention provides a method for scaling a target area to adapt to the display area, comprising the following steps:
[0006] S10: Position the target area to a first state within a preset range, and calculate the target resolution based on the actual distance and occupied pixels in the first state of the map;
[0007] S20: Obtain the original resolution array of the map, interpolate the target resolution into the original resolution array to generate a target resolution array, such that the resolution levels in the target resolution array are in an increasing or decreasing relationship;
[0008] S30: Set the resolution levels in the target resolution array to the map control of the target area.
[0009] In some embodiments, when the target area is positioned to the first state in step S10, the target area is located within the map display area of the screen, and the display range of the target area is a preset ratio of its maximum achievable range within the map display area.
[0010] In some embodiments, the preset ratio is between 0.8 and 1.
[0011] In some embodiments, the step S10 of calculating the target resolution based on the actual distance and occupied pixels in the first state of the map includes the following steps:
[0012] S11: Calculate the first resolution in the horizontal direction based on the actual geographical distance and the number of pixels occupied by the map in the horizontal direction;
[0013] S12: Calculate the second resolution in the vertical direction based on the actual geographical distance and the number of pixels occupied by the map in the vertical direction;
[0014] S13: Take the larger of the first resolution and the second resolution as the target resolution.
[0015] In some embodiments, the algorithms for the first resolution and the second resolution include:
[0016] Resolution = Map distance (meters) / (2 * π * equatorial radius) * 360 / Screen distance (pixels).
[0017] In some embodiments, step S20 includes: inserting the original resolution between the first resolution and the second resolution in the original resolution array, wherein the first resolution is greater than the target resolution, the second resolution is less than the target resolution, and the second resolution and the first resolution are adjacent in the original resolution array.
[0018] In some embodiments, step S20 further includes: if the difference between the first resolution and the target resolution is less than 20% of the target resolution, then the first resolution is deleted from the target resolution array;
[0019] If the difference between the second resolution and the target resolution is less than 20% of the target resolution, then the second resolution is deleted from the target resolution array.
[0020] The present invention also provides an apparatus for scaling a target area to adapt to a display area, comprising:
[0021] The target resolution calculation unit is used to locate the target area to a first state within a preset range, and calculate the target resolution based on the actual distance and the number of pixels occupied in the first state of the map.
[0022] The target resolution array generation unit is used to obtain the original resolution array of the map, interpolate the target resolution into the original resolution array to generate the target resolution array, so that the resolution levels in the target resolution array are in an increasing or decreasing relationship.
[0023] The setting unit is used to set the resolution levels in the target resolution array onto the map control of the target area.
[0024] The present invention also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement a method for scaling a target area to fit a display area as described in any of the preceding claims.
[0025] The present invention also provides a computer device including at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the processor to perform a method for scaling a target area to fit a display area as described in any of the preceding claims.
[0026] Based on the above, compared with the prior art, the present invention provides a method for scaling a target area to adapt to the display area. First, the target area is positioned in a first state within a preset range. The target resolution is calculated based on the actual distance and occupied pixels in the first state of the map. The original resolution array of the map is obtained, and the target resolution is interpolated into the original resolution array to generate a target resolution array, such that the resolution levels in the target resolution array are in an increasing or decreasing relationship. Then, the resolution levels in the target resolution array are set on the map control of the target area. By calculating the target resolution of the map based on the target area when it is positioned in an ideal scaling state, and then inserting the target resolution into the resolution levels of the area, the optimal display effect of the target area can be displayed when scaled to the target resolution.
[0027] Other features and beneficial effects of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other beneficial effects of the invention can be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Unless otherwise specified, the positional relationships shown in the drawings in the following description are based on the direction in which the components are drawn in the figure.
[0029] Figure 1 This is a screenshot of the existing map display interface.
[0030] Figure 2 This is a flowchart of the map interface display range positioning adaptive method of the present invention;
[0031] Figure 3 For the purposes of this embodiment of the invention Figure 1 The example shown is the result after adjustment. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. The technical features designed in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0033] In the description of this invention, it should be understood that the terms "center," "lateral," "upper," "lower," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or component referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more. Additionally, the term "comprising" and any variations thereof mean "at least comprising."
[0034] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integrally formed connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0035] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments. Unless the context clearly indicates otherwise, the singular forms “a” and “an” as used herein are also intended to include the plural. It should also be understood that the terms “comprising” and / or “including” as used herein specify the presence of the stated features, integers, steps, operations, units, and / or components, without excluding the presence or addition of one or more other features, integers, steps, operations, units, components, and / or combinations thereof.
[0036] To achieve at least one or more advantages, such as Figure 2 As shown, the present invention provides a method for scaling a target area to adapt to the display area, comprising the following steps:
[0037] S10: Position the target area to a first state within a preset range, and calculate the target resolution based on the actual distance and occupied pixels in the first state of the map;
[0038] S20: Obtain the original resolution array of the map, interpolate the target resolution into the original resolution array to generate a target resolution array, such that the resolution levels in the target resolution array are in an increasing or decreasing relationship;
[0039] S30: Set the resolution levels in the target resolution array to the map control of the target area.
[0040] In some embodiments, when the target area is positioned to the first state in step S10, the target area is located within the map display area of the screen, and the display range of the target area is a preset ratio of its maximum achievable range within the map display area.
[0041] For example Figure 3 As shown, the target area is located to achieve an ideal scaling ratio within the map display area. Specifically, for example, assume the first four boundaries of the target area's display range are the first minimum longitude (xmin), the first maximum longitude (xmax), the first minimum latitude (ymin), and the first maximum latitude (ymax). The first width (widthFull) and first height (heightFull) of the full-screen display range are in pixels; that is, the pixel dimensions of the display interface range in the horizontal and vertical directions. The second width (width) and second height (height) of the map's visible area, as well as the horizontal offset (xOffset) and vertical offset (yOffset) of the map's visible area's origin, are in pixels; that is, the pixel dimensions of the map's visible area in the horizontal and vertical directions, and the origin offset of the visible area with the top-left corner as its respective origin. However, this is not limited to these definitions; the offsets can be determined according to actual needs.
[0042] The second and fourth boundaries of the map are calculated to locate the target area, and the display interface is positioned relative to the map to ensure that the target area is displayed within the map's visible range and has the maximum display area within that range. The purpose of this invention is to locate the target area within the map's visible range while maximizing its display area for easy observation by the user. In other words, the displayed area of the located target area is just contained within the map's visible range, but is also sufficiently large that further expansion would exceed the map's visible range. The second and fourth boundaries include a second minimum longitude (xminNew), a first maximum longitude (xmaxNew), a first minimum latitude (yminNew), and a first maximum latitude (ymaxNew).
[0043] In some embodiments, the algorithm for the second fourth range includes:
[0044] xminNew=xmin-(xOffset / width)*(xmax-xmin);
[0045] yminNew=ymin-((heightFull-yOffset-height) / height)*(ymax-ymin);
[0046] xmaxNew=xmax+((widthFull-xOffset-width) / width)*(xmax-xmin);
[0047] ymaxNew=ymax+(yOffset / height)*(ymax-ymin).
[0048] The above positioning algorithm can locate the display range of the target area to the maximum range within the map's visible area. Furthermore, this positioning can be adjusted by a preset ratio, such as 0.8-1 times the preset range, to reserve a 0-20% buffer zone at the edges. For example, the following algorithm yields a new boundary range with a 10% buffer zone:
[0049] xminNew1=xminNew-(xmaxNew-xminNew)*0.1;
[0050] yminNew1=yminNew-(ymaxNew-yminNew)*0.1;
[0051] xmaxNew1=xmaxNew+(xmaxNew-xminNew)*0.1;
[0052] ymaxNew1=ymaxNew+(ymaxNew-yminNew)*0.1.
[0053] In some embodiments, the step S10 of calculating the target resolution based on the actual distance and occupied pixels in the first state of the map includes the following steps:
[0054] S11: Calculate the first resolution in the horizontal direction based on the actual geographical distance and the number of pixels occupied by the map in the horizontal direction;
[0055] S12: Calculate the second resolution in the vertical direction based on the actual geographical distance and the number of pixels occupied by the map in the vertical direction;
[0056] S13: Take the larger of the first resolution and the second resolution as the target resolution.
[0057] In some embodiments, the algorithms for the first resolution and the second resolution include:
[0058] Resolution = Map distance (meters) / (2 * π * equatorial radius) * 360 / Screen distance (pixels).
[0059] By calculating the first resolution and the second resolution and taking the larger of the two as the target resolution, the problem of the target area being displayed beyond the map's visible area in another direction when scaling is avoided if the two are inconsistent and the smaller one is taken as the target resolution.
[0060] Furthermore, it should be understood that the resolution mentioned in the description of target resolution and original resolution in this invention refers to map resolution in the GIS field, also known as ground resolution or spatial resolution, which represents the actual ground distance (meters) represented by one pixel on the screen.
[0061] In some embodiments, step S20 includes: inserting the original resolution between the first resolution and the second resolution in the original resolution array, wherein the first resolution is greater than the target resolution, the second resolution is less than the target resolution, and the second resolution and the first resolution are adjacent in the original resolution array.
[0062] In some embodiments, step S20 further includes: if the difference between the first resolution and the target resolution is less than 20% of the target resolution, then the first resolution is deleted from the target resolution array;
[0063] If the difference between the second resolution and the target resolution is less than 20% of the target resolution, then the second resolution is deleted from the target resolution array.
[0064] By removing resolution levels with minor differences, the target resolution array can be simplified, making the changes in each level of the target area more obvious and reducing the user's operational burden. After setting the simplified target resolution array in the map control of the target area, zooming in and out of the target area will switch the map resolution level to the target resolution level, allowing the target area to be positioned as shown... Figure 3 The correct display range shown perfectly displays the target area within the map's visible range, making it easy for users to observe the target area.
[0065] The present invention also provides an apparatus for scaling a target area to adapt to a display area, comprising:
[0066] The target resolution calculation unit is used to locate the target area to a first state within a preset range, and calculate the target resolution based on the actual distance and the number of pixels occupied in the first state of the map.
[0067] The target resolution array generation unit is used to obtain the original resolution array of the map, interpolate the target resolution into the original resolution array to generate the target resolution array, so that the resolution levels in the target resolution array are in an increasing or decreasing relationship.
[0068] The setting unit is used to set the resolution levels in the target resolution array onto the map control of the target area.
[0069] The present invention also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement a method for scaling a target area to fit a display area as described in any of the preceding claims.
[0070] The present invention also provides a computer device including at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the processor to perform a method for scaling a target area to fit a display area as described in any of the preceding claims.
[0071] Based on the above, compared with the prior art, the present invention provides a method for scaling a target area to adapt to the display area. First, the target area is positioned in a first state within a preset range. The target resolution is calculated based on the actual distance and occupied pixels in the first state of the map. The original resolution array of the map is obtained, and the target resolution is interpolated into the original resolution array to generate a target resolution array, such that the resolution levels in the target resolution array are in an increasing or decreasing relationship. Then, the resolution levels in the target resolution array are set on the map control of the target area. By calculating the target resolution of the map based on the target area when it is positioned in an ideal scaling state, and then inserting the target resolution into the resolution levels of the area, the optimal display effect of the target area can be displayed when scaled to the target resolution.
[0072] Furthermore, those skilled in the art should understand that although many problems exist in the prior art, each embodiment or technical solution of the present invention can be improved in only one or a few aspects, without necessarily solving all the technical problems listed in the prior art or the background art simultaneously. Those skilled in the art should understand that any content not mentioned in a claim should not be construed as a limitation on that claim.
[0073] Although this paper frequently uses terms such as mesh, mesh index set, texture feature, target color feature, mosaic result image, and color uniform result image, the possibility of using other terms is not excluded. These terms are used merely for the convenience of describing and explaining the essence of the invention; interpreting them as any additional limitation would contradict the spirit of the invention.
[0074] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for scaling a target area to fit a display area, characterized by, Includes the following steps: S10: Position the target area to a first state within a preset range, and calculate the target resolution based on the actual distance and occupied pixels in the first state of the map; when the target area is positioned to the first state in step S10, the target area is located within the map display area of the screen, and the display range of the target area is a preset ratio of its maximum achievable range in the map display area; S20: Obtain the original resolution array of the map, interpolate the target resolution into the original resolution array to generate a target resolution array, such that the resolution levels in the target resolution array are in an increasing or decreasing relationship; S30: Set the resolution levels in the target resolution array to the map control of the target area.
2. The method for scaling a target area to fit a display area according to claim 1, wherein: The preset ratio is between 0.8 and 1.
3. The method for scaling a target area to fit a display area according to claim 1, wherein: Step S10, which involves calculating the target resolution based on the actual distance and occupied pixels in the first state of the map, includes the following steps: S11: Calculate the first resolution in the horizontal direction based on the actual geographical distance and the number of pixels occupied by the map in the horizontal direction; S12: Calculate the second resolution in the vertical direction based on the actual geographical distance and the number of pixels occupied by the map in the vertical direction; S13: Take the larger of the first resolution and the second resolution as the target resolution.
4. The method of claim 3, wherein: The algorithms for the first resolution and the second resolution include: Resolution = Map Distance (meters) / (2 π Equatorial Radius 360 / Screen Distance (pixels).
5. The method for scaling a target area to fit a display area of claim 1, wherein: Step S20 includes: inserting the original resolution between the first resolution and the second resolution in the original resolution array, wherein the first resolution is greater than the target resolution, the second resolution is less than the target resolution, and the second resolution and the first resolution are adjacent in the original resolution array.
6. The method of claim 5, wherein: Step S20 further includes: if the difference between the first resolution and the target resolution is less than 20% of the target resolution, then the first resolution is deleted from the target resolution array; If the difference between the second resolution and the target resolution is less than 20% of the target resolution, then the second resolution is deleted from the target resolution array.
7. A device for scaling a target area to adapt to a display area, characterized in that, include: The target resolution calculation unit is used to position the target area to a first state within a preset range. When the target area is positioned to the first state, the target area is located within the map display area of the screen, and the display range of the target area is a preset ratio of its maximum achievable range within the map display area. Calculate the target resolution based on the actual distance and the number of pixels occupied in the first state of the map; The target resolution array generation unit is used to obtain the original resolution array of the map, interpolate the target resolution into the original resolution array to generate the target resolution array, so that the resolution levels in the target resolution array are in an increasing or decreasing relationship. The setting unit is used to set the resolution levels in the target resolution array onto the map control of the target area.
8. A computer-readable storage medium, characterized in that: The computer readable storage medium stores computer instructions, and the computer is used to implement the method for scaling the target region to adapt to the display region according to any one of claims 1-6 when the computer instructions are executed by the processor.
9. A computer device, comprising: The computer readable storage medium stores computer instructions, and the computer is used to implement the method for scaling the target region to adapt to the display region according to any one of claims 1-6 when the computer instructions are executed by the processor.