convert stops feed to GeoJSON

This commit is contained in:
Sanj 2012-02-19 17:44:19 +05:30
parent 68e18398fd
commit 1c16d27d99

View File

@ -3,8 +3,11 @@ from ox.django.shortcuts import get_object_or_404_json, render_to_json_response
def route(request, code):
route = get_object_or_404_json(Route, code=code)
stops = [r.stop.get_dict() for r in RouteDetail.objects.filter(route=route)]
stops = [r.stop.get_geojson() for r in RouteDetail.objects.filter(route=route)]
return render_to_json_response({
'route': route.get_dict(),
'stops': stops
'stops': {
'type': 'FeatureCollection',
'features': stops
}
})