diff --git a/geotrek/core/static/core/multipath.js b/geotrek/core/static/core/multipath.js index 46afac820e..e778c8979b 100644 --- a/geotrek/core/static/core/multipath.js +++ b/geotrek/core/static/core/multipath.js @@ -533,10 +533,10 @@ L.Handler.MultiPath = L.Handler.extend({ var test_computed_path = { 'computed_paths': computed_paths, - 'geojson': data.geojson, + 'geojson': data, } - console.log("geojson", data.geojson/* , "trek", data.trek */) + console.log("geojson", data/* , "trek", data.trek */) // var mainmap = window.maps[0] // mainmap.addLayers diff --git a/geotrek/core/views.py b/geotrek/core/views.py index 1540b5621d..f3fd09f0f8 100644 --- a/geotrek/core/views.py +++ b/geotrek/core/views.py @@ -825,13 +825,5 @@ def post(self, request): merged_line_string = self.merge_line_strings(line_strings) merged_line_string.transform(settings.API_SRID) - # TODO: use GEOSGeometry.geojson (LineString?) - geojson = merged_line_string.geojson - print(geojson, type(geojson)) - - return JsonResponse({ - 'geojson': { - 'type': 'LineString', - 'coordinates': merged_line_string.coords, - }, - }) + geojson = json.loads(merged_line_string.geojson) + return JsonResponse(geojson)