Projet

Général

Profil

Révision c4802754

Ajouté par Jocelyn Delande il y a plus de 10 ans

moved all_points webservice to use methods from site_point

Voir les différences:

ajax/all_points.php
1 1
<?php
2
require_once('../class/sites_dir.class.php');
3 2
require_once('../class/site_point.class.php');
4 3

  
5 4
function get_ref_points() {
......
24 23
}
25 24

  
26 25

  
27
function site_point_to_geoJSONFeature($sp) {
28
	$prm = $sp->get_params();
29
	$name = $sp->get_name();
30
	$lat = floatval($prm['latitude']);
31
	$lon = floatval($prm['longitude']);
32
	//$alt = $prm['altitude'];
33
	//$title = $prm['titre'];
34

  
35
	return array("type" => "Feature",
36
	             "geometry" => array(
37
	                                 "type" => "Point",
38
	                                 "coordinates" => [$lon, $lat]
39
	                                 ),
40
	             "properties" => array("name" => $name,
41
	                                   "type" => 'pano_point',
42
	                                   "view_url"  => $sp->get_url())
43
	             );
44
}
45

  
46

  
47 26
$json = array(
48 27
              "type" => "FeatureCollection",
49 28
              "features"=> array()
......
55 34

  
56 35

  
57 36
foreach(site_point::get_all() as $site_point) {
58
	$json['features'][] = site_point_to_geoJSONFeature($site_point);
37
	$json['features'][] = $site_point->to_geoJSON();
59 38
}
60 39

  
61 40
echo json_encode($json);

Formats disponibles : Unified diff