diff --git a/place.php b/place.php new file mode 100644 index 0000000..d80f282 --- /dev/null +++ b/place.php @@ -0,0 +1,46 @@ +select('places', '*', ['osmid' => $VARS['osmid']])[0]; + +$geo['name'] = "Places"; +$geo['type'] = 'FeatureCollection'; +$geo['features'] = []; + +$geo['features'][] = array("type" => "Feature", + "geometry" => [ + "type" => "Point", + "coordinates" => [ + floatval($place['longitude']), + floatval($place['latitude']) + ] + ], + "properties" => [ + "osm_id" => intval($place['osmid']), + "name" => ($place['name'] == '' ? null : $place['name']) + ] +); + +$out = json_encode($geo); +if ($out == false) { + sendError("Server error."); +} else { + echo $out; +} \ No newline at end of file