1 | <?php |
---|
2 | |
---|
3 | $marker = array(); |
---|
4 | $all = ''; |
---|
5 | |
---|
6 | /* data */ |
---|
7 | $distros['Fedora'] = 2; |
---|
8 | $distros['Ubuntu'] = 4; |
---|
9 | $distros['OpenSUSE'] = 1; |
---|
10 | $city = "Zagreb"; |
---|
11 | $coord_x = 45.8227; |
---|
12 | $coord_y = 16.0063; |
---|
13 | |
---|
14 | $distro_list = '<ul>'; |
---|
15 | foreach ( $distros as $key => $value ) |
---|
16 | $distro_list .= "<li>$key: $value</li>"; |
---|
17 | $distro_list .= '</ul>'; |
---|
18 | |
---|
19 | $marker[] = array( 'type'=>'Feature', |
---|
20 | 'geometry'=>array( 'type'=>'Point', |
---|
21 | 'coordinates'=>array( (float)$coord_x, (float)$coord_y ) |
---|
22 | ), |
---|
23 | 'properties'=>array( 'title'=>$city, |
---|
24 | 'description'=>"Distribucija:<br /> $distro_list" |
---|
25 | ) |
---|
26 | ); |
---|
27 | |
---|
28 | $all = array( 'type'=>'FeatureCollection', 'features'=>$marker ); |
---|
29 | |
---|
30 | echo 'var map_data = '.json_encode( $all ).';'; |
---|
31 | |
---|
32 | ?> |
---|