Create GeoJSON object in PHP code

this way the SQL query is much simpler
the code to create the GeoJSON object can be reused
fixed small bug in JavaScript code so that results are listed now