Some discussion on using AE to make the tool of cutting graph

Source: Internet
Author: User

1. Preface

This week used the evening at home time to study how to use AE to develop the graph tool. The initial idea was to call the GP service directly, using three classes such as Createmapservercache, Managemapservercachetiles, and Geoprocessor. But there is a huge drawback to this idea of having to publish a map service first. Then I immediately change the thinking, I would like to be able to use the tile location algorithm and some of the AE's fine-grained class to achieve this function. After three nights of suffering, the entire tool is basically shaped, including the optimization of the algorithm and the resolution of some specific problems. Here I share with you roughly.

2. Basic principles and implementation of transduction

If you are unfamiliar with the algorithms associated with tiling and tile addressing, please refer to the principle Series I wrote from the bottom to explore Webgis: http://www.cnblogs.com/naaoveGIS/category/600559.html.

I'll give you a few of the formulas that are involved here.

2.1Resolution Conversion Formula

resolution=scale*inch2centimeter/dpi. Where scale is the map bar, Inch2centimeter is an inch to centimeter parameter, and DPI is 1 inches of pixels.

2.2 Row number Get formula

Assuming that the origin of the map transduction is (originx,oringiny), the tile size of the map is tilesize, and the actual distance represented by the 1 pixels on the map screen is resolution. The formula for calculating the row number of the tile where the coordinate point (x, Y) resides is:

Col = Floor ((originx-x)/(tilesize*resolution))

Row = Floor ((oringiny-y)/(tilesize*resolution))

Features of 2.3AGS Tiles

The goal of this tool is to cut out tiles in the same format as AGS tiles. The AGS tiles have the following characteristics (in http://www.cnblogs.com/naaoveGIS/p/3903270.html I did a detailed explanation):

(a). The beginning of the level,r represents the beginning of the row,c represented by Col.

The number after (b). L is a two-bit string, followed by a eight-bit string, and a eight-bit string after C.

(c) The number after the English language is 16 decimal, then the amount of the shortfall is supplemented with 0.

2.3 Based on the above formula flow

We first get the user input transduction level array Levelscalearr, tile size (imgwidth,imgheight), transduction origin (Originx,originy) and pixel value dpi. At the same time we have to get the scope of the map (Dxmin,dymin,dxmax,dymax) through the interface.

The box model for the process is as follows:

2.4 implementation

Implemented, the main use of AE has done such several functions:

(a). Use the Imapcontrol class to obtain the four-corner coordinates of the mxd.

(b). Use Iactiveview, Exportpngclass, and Envelopeclass to implement the map local export feature.

Others are implemented in accordance with the above flowchart.

3. Function Optimization 3.1 Export image type optimization

You can export images in multiple formats in AE. It can be realized by Exportjpegclass (), Exportbmpclass (), Exportemfclass (), Exportgifclass (), etc.

3.2 Picture Transparent optimization

Pictures exported directly from the above class have their background color default to white. In the AGS chart, the background color is transparent, so there is an image transparency optimization process. C # relays into bitmap, using the class of the maketransparent can be implemented.

4. Optimization of the algorithm 4.1 reduce the range of the cut graph

In the process, our default transduction is started from the transduction origin, which is cut into a lot of useless graphs. We can start from the map dxmin and Dymax to the nearest location.

Startxbylevel = (int) math.abs ((Math.floor ((Dxmin-originx)/dimagewidth));

Startybylevel = (int) math.abs ((Math.floor ((Originy-dymax)/dimageheight));

Startxbylevel and Startybylevel are the transduction initial points of the x and Y axes.

4.2 Non-tangent invalid diagram

We often cut out the entire picture as a transparent blank. However, in the AGS chart, you can not see such an invalid diagram. We can judge whether there are any elements in this range before transduction, and if not, continue off. This can also reduce the number of cut graphs.

5. Note

In Levelscalearr, the scale of the number is increased with the index increase, but the larger the scale number, the corresponding level is smaller. Therefore, when we traverse the level layer, it should be a descending traversal, so that the production of the L folder is the correct number.

6.

The following are:

7. Insufficient

(a). It is not possible to cut out compact tiles at this time. To solve the idea, using the above method to export the diagram, you need to turn the diagram into a binary and then according to the bundle format from the new generation, and also to survive the index file Bundlex.

(b). The AE used is, after all, a good component library for encapsulation. With Gdal, the efficiency should be better because of the poor package level.

Some discussion on using AE to make the tool of cutting graph

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.