MCPcopy Create free account
hub / github.com/StephanGeorg/staticmaps / circleToSVG

Method circleToSVG

src/staticmaps.js:330–346  ·  view source on GitHub ↗

* Render a circle to SVG

(circle)

Source from the content-addressed store, hash-verified

328 * Render a circle to SVG
329 */
330 circleToSVG(circle) {
331 const latCenter = circle.coord[1];
332 const radiusInPixel = geoutils.meterToPixel(circle.radius, this.zoom, latCenter);
333 const x = this.xToPx(geoutils.lonToX(circle.coord[0], this.zoom));
334 const y = this.yToPx(geoutils.latToY(circle.coord[1], this.zoom));
335 return `
336 <circle
337 cx="${x}"
338 cy="${y}"
339 r="${radiusInPixel}"
340 style="fill-rule: inherit;"
341 stroke="${circle.color}"
342 fill="${circle.fill}"
343 stroke-width="${circle.width}"
344 />
345 `;
346 }
347
348 /**
349 * Render text to SVG

Callers 1

drawFeaturesMethod · 0.95

Calls 2

xToPxMethod · 0.95
yToPxMethod · 0.95

Tested by

no test coverage detected