Last active
June 19, 2017 11:10
-
-
Save rustedwolf/8858369 to your computer and use it in GitHub Desktop.
Converts HTML map cordinates to SVG path.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function areaToSVGPath($area) { | |
$mapPoints = explode(',', $area); | |
$path = "M" . $mapPoints[0]; | |
$delimiter = " "; | |
for ($i = 1; $i < count($mapPoints); $i++) { | |
$path .= $delimiter . $mapPoints[$i]; | |
$delimiter = ($delimiter === " ") ? " L" : " "; | |
} | |
$path .= "z"; | |
return $path; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment