xentia
xentia

Reputation: 435

svg text does not appear

I use svg to draw soe geographic data. In order to do that i set my viewbox to match a real world and I use GPS coordinates. I want to draw a circle by given coordinates and write some text inside it. Circle is ok, but where is text? Below is a fiddle example.

<svg 
	id="svg"
	width="1000" height="1000"
	viewBox="27.9043663 -43.2012437 0.0366674 0.0366674"
	preserveAspectRatio="xMidYMid meet" 
	xmlns="http://www.w3.org/2000/svg" 
	xlink="http://www.w3.org/1999/xlink" 
	ev="http://www.w3.org/2001/xml-events" 	
	shape-rendering="geometricPrecision"
	>
  
  <circle cx=27.9227000 cy=-43.1829100 r="0.016667" style="stroke:#000; stroke-width:0.00016667;" fill="none"/>
  <text x=27.9227000 y=-43.1829100 fill="#000"  font-family="'Lucida Grande', sans-serif" font-size="12">test</text>
  </svg>

Upvotes: 0

Views: 71

Answers (1)

enxaneta
enxaneta

Reputation: 33072

Your text is very big. So big that your circle stays within the gaps of the text. Try font-size=".014". I'm afraid smaller than this won't render.

svg{border:1px solid;width:90vh;}
<svg 
	id="svg"
	viewBox="27.9043663 -43.2012437 0.0366674 0.0366674"
	preserveAspectRatio="xMidYMid meet" 
	xmlns="http://www.w3.org/2000/svg" 
	xlink="http://www.w3.org/1999/xlink" 
	ev="http://www.w3.org/2001/xml-events" 	
	shape-rendering="geometricPrecision"
	>
  
  <circle cx=27.9227000 cy=-43.1829100 r="0.016667" style="stroke:#000; stroke-width:0.00016667;" fill="none"/>
  <text x=27.91 y=-43.179 fill="#000"  font-family="'Lucida Grande', sans-serif" font-size=".014">test</text>
  </svg>

I would recomend reading about The Limits of Numbers in SVG

Upvotes: 1

Related Questions