Geographic Information technology-the advent of the civilian age (III)

Source: Internet
Author: User

This section describes how to organize geographical objects and how to draw these objects. Geographic objects are the basis of GIS analysis. These geographical objects have been briefly discussed in the previous section. geographical objects can be operated, including spatial analysis, data processing, and object display. To plot these geographic objects, we assume that the development environment is windows, and the drawing engine uses GDI +. Why do we use GDI +? Because the effects of GDI cannot be drawn. if you draw a line, you will find a lot of sertices. If the line type of the map is rough, the effect of sertices is obviously too obvious, and you must complain about it, another advantage of GDI + is the comparison of coordinate transformation. There are certainly some disadvantages, so it is time-consuming to draw a good image, so the rendering efficiency is not very high, but this has little impact.

The key to drawing a geographical object is model conversion. The drawing objects of GDI + are not exactly the same as the custom geographic Model objects. This requires conversion. In the above, we briefly defined three types of geographical objects: point, point, line, and surface, which are represented by point, polyline, and polygon respectively. These three types are advanced objects, which are behind the advanced objects, we can define some low-level objects. These low-level objects can construct these high-level objects, while our rendering process only processes high-level objects.

Point. In GIS, point contains the X and Y coordinates. There is no direct method for using GDI + to draw points, which must be represented by symbols. There can be many symbols. The simplest method can be a circle. more abundant characters can be used to read the library, for example, I can read a circle symbol in TrueType and draw it on a map to represent a city. In the figure below, I drew a pentagram symbol at the longitude 116.3 and latitude 39.9 to represent a city.

Step 1: Convert the geographical coordinates of Beijing to the screen coordinates according to my first article.

Step 2: Find the Unicode encoding that represents the TrueType symbol of the pentagram in the character set

Step 3: Use the drawstring method of GDI + to draw the star symbol

In fact, I have used polyline to draw continent boundaries. Polyline is also known as the multi-definition line. It can also be built with multiple low-level objects. For more information, see ESRI documentation. You can use graphicspath to draw a multi-definition line. Of course, if a multi-definition line has multiple parts (the so-called part is multiple independent lines to represent a whole multi-definition line ).

Polygon rendering is complicated. Compared with the Multi-definition line, polygon can also be composed of multiple parts. For example, a ring is actually composed of two independent polygon, but the internal and external orders are inconsistent. Of course, the most complicated situation is that polygon is composed of both rings and islands. If we can determine the line Order of polygon, we will solve the difficult part of GIS.

I constructed a polygon, which is a ring consisting of three polygon in line order.

Step 1: Coordinate Transformation (geographic coordinates to screen coordinates)

Step 2: obtain each polygon (in fact, multiple parts that can constitute a polygon)

Step 3: Adjust the line order of each polygon (by rule, you can set the outermost layer to clockwise, followed by clockwise, followed by clockwise ...)

Step 4: Draw the image in graphicspatch to get the following results:

 

In fact, there is still much work to do if you want to commercialize applications. For example, you must design an efficient storage container for the corresponding geographic model. This is actually not difficult. We can combine the above process with the open-source OGR to solve this problem. This is the next topic. How can we use OGR to extend the GIS data format reading.

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.