seasketch / next

A modernization version of the SeaSketch platform, released in 2022.
https://seasketch.org
BSD 3-Clause "New" or "Revised" License
7 stars 0 forks source link

Sketch Geojson export quirks #540

Closed twelch closed 1 year ago

twelch commented 1 year ago

When exporting a sketch to geojson:

underbluewaters commented 1 year ago

Yes! Slugified names would be much better. This single export endpoint serves 3 use-cases which may need to be split:

  1. User-initiated export of shapes. This is also used as input for geoprocessing test cases
  2. Map visualization, where by mapbox-gl directly requests geojson for sketches
  3. Running reports, where the endpoint is passed in the initialization event along with a valid auth token.

Currently the client dynamically creates urls to reference sketches, and if we're using slugified names I'd want to centralize that logic and expose an exportUrl property in the GraphQL Schema so that there's no chance of mismatched id generation. Map visualization probably needs a different endpoint, since mapbox-gl-style can't reference the userAttributes property.

I may be able to use the download/attachment header to let the browser rename 12.geojson.json => my-sketch.geojson.json and avoid a lot of the mess with complex url referencing... but I thought I was already doing that.

As a degenerate who piles all my files all into ~/Downloads and uses search to find things, I still like the geojson.json part of the filename and think I will keep that. Just .geojson isn't recognized by QGIS by default and it's easy to confuse what the files are without the extension.