Moj kod wygląda tak :
Kod:
<?php
$Query = "
SELECT GPSLatitude,GPSLongitude,GPSImgDirection,Path,Opis,Nr_zlecenia,Data_zrobienia,Data_wgrania FROM gps";
$con = mysql_connect("localhost","root","root") or die ('Error connecting to mysql');
mysql_select_db("gis");
$result = mysql_query($Query);
$geojson = array(
'type' => 'FeatureCollection',
'features' => array()
);
// Add edges to GeoJSON array
while($row=mysql_fetch_row($result)) {
$feature = array(
'type' => 'Feature',
'id' => '$row[5]',
'properties' => array(
'gid' => $row[3],
'fid' => $row[4]
),
'geometry' => array(
'type' => 'Point',
'coordinates' => '['.$row[0].','.$row[1].']'
)
);
// Add feature array to feature collection array
array_push($geojson['features'], $feature);
}
// Close database connection
mysql_close($con);
// Return routing result
//header('Content-type: application/json',true);
echo json_encode($geojson);
?>
I ostatnie echo wywala mi :
Kod:
{"type":"FeatureCollection","features":[]}
Ja mam kolumny w bazie tak że w osobnej kolumnie jest lon i osobno lat