1.9. SVG <polygon>

发布时间 :2023-12-07 00:55:31 UTC      

1.9.1. SVG Polygon- <polygon>

Example 1

<polygon> Labels are used to create shapes with no less than three sides.

A polygon is made up of straight lines and its shape is “closed” (all the lines are connected).

Polygon is from Greece. “Poly” means “many” and “gon” means “angle”.

Here is the SVG code:

Example

<svgheight="210"width="500"><polygonpoints="200,10 250,190
160,210"style="fill:lime;stroke:purple;stroke-width:1"/></svg>

For Opera users: view the SVG file (right-click the SVG drawing preview source).

Code parsing:

  • points Property defines the x and y coordinates of each corner of a polygon

Example 2

The following example creates a four-sided polygon:

Here is the SVG code:

Example

<svgheight="250"width="500"><polygonpoints="220,10 300,210 170,250
123,234"style="fill:lime;stroke:purple;stroke-width:1"/></svg>

For Opera users: view the SVG file (right-click the SVG drawing preview source).

Example 3

Use <polygon> element to create a star:

Here is the SVG code:

Example

<svgheight="210"width="500"><polygonpoints="100,10 40,198 190,78 10,78
160,198"style="fill:lime;stroke:purple;stroke-width:5;fill-rule:nonzero;"/></svg>

For Opera users: view the SVG file (right-click the SVG drawing preview source).

Example 4

Change the fill-rule property to “evenodd”:

Here is the SVG code:

Example

<svgheight="210"width="500"><polygonpoints="100,10 40,198 190,78 10,78
160,198"style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;"/></svg>

For Opera users: view the SVG file (right-click the SVG drawing preview source).

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.