-
Notifications
You must be signed in to change notification settings - Fork 2
/
api_map.php
55 lines (40 loc) · 1.31 KB
/
api_map.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
$coordinates = array();
if (isset($_GET['coordinates']))
{
$coordinates = json_decode($_GET['coordinates']);
}
if (isset($_POST['coordinates']))
{
$coordinates = json_decode($_POST['coordinates']);
}
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
width="360px" height="180px">
<style type="text/css">
<![CDATA[
.region
{
fill:blue;
opacity:0.4;
stroke:blue;
}
]]>
</style>
<!-- <rect id="dot" x="-3" y="-3" width="6" height="6" style="stroke:black; stroke-width:1; fill:white"/> -->
<!-- <rect id="dot" x="-1" y="-1" width="3" height="3" style="stroke:none; stroke-width:0; fill:yellow;opacity:0.7;"/> -->
<!-- <rect id="dot" x="-10" y="-1" width="2" height="2" style="stroke:none; stroke-width:0; fill:black"/> -->
<circle id="dot" x="-2" y="-2" r="2" style="stroke:none; stroke-width:0; fill:black; opacity:0.7;"/>
<image x="0" y="0" width="360" height="180" xlink:href="' . 'static/map.jpg"/>
<g transform="translate(180,90) scale(1,-1)">';
foreach ($coordinates as $loc)
{
$xml .= ' <use xlink:href="#dot" transform="translate(' . $loc[0] . ',' . $loc[1] . ')" />';
}
$xml .= '
</g>
</svg>';
header("Content-type: image/svg+xml");
echo $xml;
?>