exshape v2.0.13 Exshape

This module just contains a helper function for working wtih zip archives. If you have a stream of bytes that you want to parse directly, use the Shp or Dbf modules to parse.

Link to this section Summary

Functions

Given a zip file path, unzip it and open streams for the underlying shape data

Link to this section Types

Link to this type layer()
layer() :: {layer_name(), projection(), Stream.t()}
Link to this type layer_name()
layer_name() :: String.t()
Link to this type projection()
projection() :: String.t()

Link to this section Functions

Link to this function from_zip(path, opts \\ [])

Given a zip file path, unzip it and open streams for the underlying shape data.

Returns a list of all the layers, where each layer is a tuple of layer name, projection, and the stream of features

By default this unzips to /tmp/exshape_some_uuid. Make sure to clean up when you’re done consuming the stream. Pass the :working_dir option to change this destination.

By default this reads in 1024 * 512 byte chunks. Pass the :read_size option to change this.

By default this shells out to the unzip system cmd, to use the built in erlang one, pass unzip_shell: true. The default behavior is to use the system one because the erlang one tends to not support as many formats.

  [{layer_name, projection, feature_stream}] = Exshape.from_zip("single_layer.zip")