On the design and realization of webgis principle from the bottom (II.): Exploring the essence, webgis the map of the front-end map Display scale conversion principle naaovegi ... Article Source: http://www.cnblogs.com/naaoveGIS/Hits: 2453 Updated: 2014-9-12
Summary:Before I took the trouble to tell you a lot of this section of the topic, now to the point, we began the series of the first problem, map scale conversion principle. To realize the tile display from the bottom, we must first understand the tile itself. After we have finished using ArcGIS to cut out the diagram, open the published service or open the config configuration file, you can see the associated configuration of the graph being cut.
1. What if there is no soy milk machine?
Drink soy milk is our basic essential in the morning, fried dough sticks soy milk, enjoyable. If I ask you how soy milk comes, grains people will say is money to buy, know that there is soy beans this will be said to be with soy milk machine to grind out the soybeans. If we go backwards for more than 10 years, I believe that the people who have seen the burden of selling soy milk will give a more detailed answer, first water-soaked soybeans for one night, and then fully mashed in the utensils, and then used in the fire has been boiled, and to keep stirring, until the floating foam disappeared, soy milk was made.
Hear this answer, many people will be surprised, so troublesome ah, still have soy milk machine convenient. Now I ask a question, if the power outage, if the soy milk machine is broken, if you do not have the money to buy soy milk machine, you can also make soy milk? Can you just buy someone else's soy milk?
2. What if there are no two development packages?
If I compare the existing map data to soybeans, I ask you a question: how do we let the browser display the topographic map if our project is not providing a genuine runtime or an AGS topographic map service due to funding problems? Of course, some people will point out a set of open source solutions, such as I use geoserver ah and so on.
So if I ask you again, if one day we meet a strange owner, it tells you, we just want the map to show in the first level, we just want the map to show an area, we have too many elements, we want to be able to dynamically load the visible range of features when the map is dragged, and so on and so on. If you are a person who only knows how to use soy milk machine, how can you complete these tricky questions?
Two times development to achieve a certain degree of people, will not be confined to, C/s when loading mxd out a map, b/s when written to a topographic map service URL out of a diagram. He must also understand how to turn a tile on the server into a full map as seen in the browser.
Here I will take a few pages to answer this question in succession.
3. Scale and resolution in map scales
Before I took the trouble to tell you a lot of this section of the topic, now to the point, we began the series of the first problem, map scale conversion principle. To realize the tile display from the bottom, we must first understand the tile itself.
After we have finished using ArcGIS to cut out the diagram, open the published service or open the config configuration file, you can see the associated configuration of the graph being cut. :
Where levels is the scale parameter of the cut graph. Each layer level contains a resolution parameter and a scale parameter.
Scale represents the bar, which means that a centimeter on the map represents the actual number of centimeters. For example, 1 centimeters on the map represents the field distance 500-kilometer, can be written as: 1:50,000,000 or written: 1/50,000,000.
Resolution represents the resolution. The actual meaning of Resolution represents the extent of the current map, where 1 pixels represent how many map units (x map units/pixels), and map units depend on the spatial reference of the data itself. The visible resolution is related to DPI (DPI represents the number of pixels per inch) and is related to the units of the map.
4. Row number--the identification of the storage address of the tile
Here to introduce you to a GIS terminology-the line number. I can imagine, the map of a rectangle, according to a certain pattern (according to the origin of transduction, the extent of the cut, tile size), divided into a lot of the same size of the rectangle, then the position of the rectangle, I can basically use row and Col to express it. Of course, if we understand the concept of image pyramid, then we have to add a level (image), saying that the popular point is that the rectangle you are cutting now belongs to which layer of the entire image.
Here, let's take a look at the storage path of the tile after the map is cut, and I use the discrete tile (exploded) as an example:
Here L06 represents the level of tile location map, r00001179d represents the row number of the tile, C0000A24E is the column number of the tile. How these figures are calculated, let me keep in a few chapters in the back to everyone hit explain.
But here I can responsibly tell you, if you want to know how to convert the line number, then the following question you have to know the answer.
What is 1 pixels on the screen representing the actual distance?
5. What is the actual distance 1 pixels on the screen represent?
Before we calculate the number of tiles, we need to get a pixel on the figure representing the actual distance. Now suppose that the coordinates of the map are in meters and DPI is 96;
1 inches = 2.54 cm;
1 inches = 96 pixels;
The final conversion unit is m;
If the current map scale is 1:125 million, then 1 meters on the figure equals 125000000 meters in the field;
Conversion formula between meters and pixels:
1 inch = 0.0254 m =96 pixels
1 Megapixels =0.0254/96 m
According to the 1:125 million scale, 1 pixels on the figure represent a field distance of 125000000*0.0254/96 = 33072.9166666667 meters.
6. Scale in planar and latitude-longitude coordinate systems6.1 Scale in a planar coordinate system
When the database is a planar coordinate system, the scale needed in the system should be obtained from the scales. Because the actual units represented in the original scale are centimeters, and the units required in our system are meters, when you fill out the map scales, they are divided by 100 and then filled. As described in the second section, we can convert 1 pixels in the system to represent how many meters.
6.2 Scale in the latitude and longitude coordinate system
When the database is a latitude-longitude coordinate system, the required scale in the system should be obtained from resolution. The resolution at this point directly represents how much of a pixel on the map is equal to the actual number of degrees.
However, because the code already has a conversion algorithm as described in the second section, at this point in the database to fill in the scale, you need to reverse the conversion of this algorithm and then fill in.
namely: Resolution*96/inch2centimeter
7. The problem caused by inches to centimeters
The international parameters for inches to centimeters are: 2.5399998, this parameter value can be used when using a map of the world map or other third-party non-AGS transduction.
However, when the chart is cut with AGS, this parameter becomes: 2.54000508001016. This may be a conversion parameter that is defined internally by AGS itself.
Depending on the parameter, when we convert the scale in the latitude and longitude coordinate system, we need to change according to different parameters. When it is an AGS map, it is: resolution*96/2.54000508001016.
8. Summary
After understanding how much of the 1 pixels on the screen represents the actual distance, we can move on to the next chapter-the principle of converting the tile row numbers according to geographic range.
Please keep your eye on me, I will try to do an update every week or weeks, if the work is busy, may update time will be postponed. This series I will roughly write 20 to 25 articles, which relate to the principle, design, implementation of knowledge, which may have a lot of wrong place, forgive me is a small step in the field of GIS is a newcomer, forgive me the stupidity of the qualification, I ventured to summarize the achievements of predecessors, combined with my thoughts and thought, Share it with everyone.
On the design and realization of webgis principle from the bottom (II.): Exploring the essence, Webgis the map scale conversion principle of the front-end map display