Skip to content

Commit

Permalink
Automating the geojson generation in the view
Browse files Browse the repository at this point in the history
  • Loading branch information
JustineFricou committed Apr 25, 2024
1 parent 56bccdc commit d793ab7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 2 additions & 2 deletions geotrek/core/static/core/multipath.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 2 additions & 10 deletions geotrek/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,13 +825,5 @@ def post(self, request):
merged_line_string = self.merge_line_strings(line_strings)
merged_line_string.transform(settings.API_SRID)

Check warning on line 826 in geotrek/core/views.py

View check run for this annotation

Codecov / codecov/patch

geotrek/core/views.py#L824-L826

Added lines #L824 - L826 were not covered by tests

# 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)

Check warning on line 829 in geotrek/core/views.py

View check run for this annotation

Codecov / codecov/patch

geotrek/core/views.py#L828-L829

Added lines #L828 - L829 were not covered by tests

0 comments on commit d793ab7

Please sign in to comment.