2. Exploring the essence,map scale conversion principle shown in webGIS front-end map

2.1. How to do if there is no soymilk machine?

Drinking soybean milk is a basic part of our morning,fried fritters soybean milk with pleasure and harmony.If I ask you how soybean milk comes from, people who have no distinction among grains will say that they bought it with money, people who know about soybeans will say that they ground soybeans with soybean milk machine.If we go back more than a decade,I believe that people who have ever seen soybean milk on a shoulder will give a more detailed answer.First,soak soybeans overnight with water, then mash them fully in a dish,cook them over medium heat, and stir them continuously until the foam disappears,then the soybean milk is made.

Hearing this answer,many people will be surprised that soybean milk machine is still convenient.Now let me ask you a question. If the power fails,if the soymilk machine breaks down, if you don’t have the money to buy the soymilk machine,can you make soybean milk by yourself? Can you just buy someone else’s soy milk to drink?

2.2. What if there is no secondary development package?

If I compare the existing map data to soybeans,I ask you a question.If our project does not provide genuine Runtime or AGS topographic map service due to financial problems,then how do we let the browser display the topographic map? Of course, some people will point out a set of open source solutions,such as I use Geoserver and so on.

If I ask you again, if one day we meet a strange owner, who tells you, we just want the map at the first level to show, we just want the map to show an area, we have too many elements, we want to be able to drag the map when the visual range of the elements loaded and so on. If you are a person who only knows the soybean milk machine, how do you complete these drills?

Secondary development to a certain extent, people will not be limited to loading MXD out of the map in C/S, writing a topographic map service URL out of the map in B/S. He also had to understand how to turn tiles on the server into a complete map in the browser.

Here I will spend several consecutive days to answer this question one by one.

2.3. Scale and Resolution in the map scale

I tell you a lot of off-topics in this section extremely patiently, now, let’s get down to business, start with the first question in this series, the principle of map scale conversion.We must first understand the tiles themselves To display tiles from the bottom.

After we cut the graph with arcgis, open the published service or open the config.xml configuration file to see the related configuration of the cut graph. As shown in the figure:

../_images/img_11.png

The level is the scale parameter of the tangent graph. Each level contains a resolution parameter and a scale parameter.

Scale represents a scale, which means that a centimeter on the map represents how many centimeters actually. For example, 1 cm on the map represents a field distance of 500 km, which can be written as: 1: 50,000,000 or written as: 1/50,000,000.

Resolution represents resolution.Resolution represents how many map units (X map units/pixels) a pixel represents within the current map range actually, and the map units depend on the spatial reference of the data itself.We can see Resolutions and DPI is related (dpi stands for the number of pixels per inch) to the unit of the map.

2.4. Ranks number - Identification of Tile Storage Address

Here we introduce another term in GIS - ranks number. We can imagine that if a rectangular map is divided into a number of rectangles of the same size according to certain rules (according to the origin, scope and tile size of the cut map), then the location of the rectangle can be basically expressed by Row and Col. Of course, if we understand the concept of image pyramid, then we need to add a Level (image level) to the front, which saying that the common point is which layer of the entire image you are currently cutting.

Here, let’s take a look at the path of the tile after the map is cut, and I take the discrete tile (Exploded) as an example:

../_images/img_2.png

The L06 here represents the level of the tile location map, R00001179d represents the row number of the tile, and C0000a24e is the column number of the tile.How these figures are calculated, let me stay in the next few chapters to explain to you one by one.

But here I can tell you responsibly that if you want to know how to convert ranks number, you must know the answer to the following question.

What is the actual distance of 1 pixel on the screen?

2.5. What is the actual distance represented by 1 pixel on the screen?

Before calculating the ranks number of tiles, we need to get how many meters a pixel on the graph represents the actual distance. Now suppose that the coordinate unit of the map is meter and DPI is 96. ;
    1 inch = 2.54 cm;
1 inch = 96 pixels;
The unit of final conversion is meters.
If the current map scale is 1:125 000 000 000, then 1 meter on the representative map is equal to 125 000 000 000 meters in the field.
Conversion formulas between meters and pixels:
1 inch = 0.0254 m = 96 pixels
1 pixel = 0.0254/96 m
According to the scale of 1:125 000 000 000, one pixel on the graph represents the distance from the field.

125000000*0.0254/96 = 33072.9166666667 m.

2.6. Scale in plane coordinate system and longitude-latitude coordinate system

2.6.1. Scale in plane coordinate system

When the database is a planar coordinate system, the scale required in the system should be taken from the scale. Because the actual unit represented in the original scale is centimeter, and the unit required in our system is meter,so when filling the map scale, the scale will be divided by one hundred and then filled out. According to the second section, we can convert how many meters a pixel represents in the system.

2.6.2. Scale in latitude and longitude coordinate system

When the database is a latitude and longitude coordinate system, the scale required in the system should be taken from the resolution. The resolution at this time directly represents how many degrees a pixel on the map is equal to the actual.

However, because there is already a conversion algorithm in the code as described in the second section, when you fill in the scale in the database, you need to reverse the conversion of the algorithm and then fill it in. Which is:resolution*96/inch2centimeter

2.7. Problems caused by inches to centimeters

The international parameter of inch to centimeter is: 2.5399998, which can be used when using a map of the sky or other third-party non-AGS titage.

However, when the figure cut with AGS, this parameter becomes: 2.54000508001016, which may be a conversion parameter defined internally by AGS itself.

Depending on the parameters, when we convert the scale scale under the longitude and latitude coordinate system, we have to convert according to different parameters. When it is an AGS map, it is: resolution*96/2.54000508001016.

2.8. Summary

Once we know how the actual distance of a pixel on the screen is calculated, we can go on to the next section–the principle of converting the tile column number according to the geographic range.

Please keep your attention.I will strive to update every week or two.If the work is busy, the update time may be delayed. This series I will roughly write 20 to 25 articles, which involve the knowledge of principles, design and implementation, where may have a lot of mistakes, forgive me for being a newcomer who has only taken a small step in the field of GIS,and the stupid qualification,allow me to take the liberty to summarize the achievements of my predecessors and combine what I think,I want to share with you.