Refactor export code

Use SQLite as the ogr2ogr input format to avoid the memory explosions that come along with traditional GeoJSON processing.

Get metadata through a separate, stream-processed query rather than using a separate temporary file.

Allow export mode to be set through the export options, so that we can simplify the API code a bit and more easily add future formats.

/cc @hampelm