Skip to content

Commit

Permalink
Add geometry column to csv export vector layer. (#965)
Browse files Browse the repository at this point in the history
* Add geometry column to csv export vector layer.

* Fix test

---------

Co-authored-by: wlorenzetti <[email protected]>
  • Loading branch information
wlorenzetti and wlorenzetti authored Oct 29, 2024
1 parent 4a93ade commit 5b56628
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions g3w-admin/qdjango/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1367,8 +1367,8 @@ def test_download_vector_api_selected_wms_fields(self):

fields = [f for f in vl.fields()]

self.assertEqual(len(fields), 1)
self.assertEqual(fields[0].name(), 'NAME')
self.assertEqual(len(fields), 2)
self.assertEqual(fields[1].name(), 'NAME')

# TEST API GPX DOWNLOAD
# ==============================================
Expand Down
1 change: 1 addition & 0 deletions g3w-admin/qdjango/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,7 @@ def response_csv_mode(self, request):
save_options = QgsVectorFileWriter.SaveVectorOptions()
save_options.driverName = 'csv'
save_options.fileEncoding = 'utf-8'
save_options.layerOptions = ['GEOMETRY=AS_WKT']

# Set attributes
self._set_download_attributes(qgs_request, save_options)
Expand Down

0 comments on commit 5b56628

Please sign in to comment.