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

Method lineToSVG

src/staticmaps.js:405–416  ·  view source on GitHub ↗

* Render Polyline to SVG

(line)

Source from the content-addressed store, hash-verified

403 * Render Polyline to SVG
404 */
405 lineToSVG(line) {
406 const points = line.coords.map((coord) => [
407 this.xToPx(geoutils.lonToX(coord[0], this.zoom)),
408 this.yToPx(geoutils.latToY(coord[1], this.zoom)),
409 ]);
410 return `<${(line.type === 'polyline') ? 'polyline' : 'polygon'}
411 style="fill-rule: inherit;"
412 points="${points.join(' ')}"
413 stroke="${line.color}"
414 fill="${line.fill ? line.fill : 'none'}"
415 stroke-width="${line.width}"/>`;
416 }
417
418 /**
419 * Draw markers to the basemap

Callers 1

drawFeaturesMethod · 0.95

Calls 2

xToPxMethod · 0.95
yToPxMethod · 0.95

Tested by

no test coverage detected