1.3. SVG instance

发布时间 :2024-03-18 01:40:05 UTC      

1.3.1. Simple SVG instance

SVG files are recommended to use .svg (all lowercase) as an extension for such files.

A simple example of SVG graphics:

test.svg File

<svg version="1.1"
  baseProfile="full"
  width="300" height="200"
  xmlns="http://www.w3.org/2000/svg">
  <rect width="100%" height="100%" stroke="red" stroke-width="4"
fill="yellow" />
  <circle cx="150" cy="100" r="80" fill="green" />
  <text x="150" y="115" font-size="16" text-anchor="middle"
fill="white">RUNOOB SVG TEST</text>
</svg>

SVG code parsing:

SVG code to <svg> element start, including the open tag <svg> and close the label </svg> . This is the root element. width and height property to set the width and height of this SVG document. version property to define the version of SVG used xmlns property defines the SVG namespace.

SVG’s <rect> used to create a rectangle, through the fill set the background color to yellow.

SVG’s <circle> used to create a circle. The cx and cy properties definethe x and y coordinates of the center of the circle. If you omit these two attributes, the dot is set to (0,0), and the r attribute defines the radius of the circle. A green circle with a radius of 80px <circle> draw in the right center of the red rectangle (offset 150px to the right, offset 115px down).

stroke and stroke-width property controls how the outline of the shape is displayed. We set the outline of the circle to 4px wide and red border.

fill property to set the color within the shape. We set the fill color to red.

Close the label </svg> the function is to turn off SVG elements and the document itself.

Note: all open tags must be closed!

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.